cimgui-go: Incorrect data type in imgui.Wchar

In “extra_types.go” “Wchar” has data type “C.uint” By default in imgui “typedef ImWchar16 ImWchar” with “IMGUI_USE_WCHAR32” flag “typedef ImWchar32 ImWchar”.

and with current data types to pass the font range you should use

Ranges = []uint16{0x0020, 0xA69F, 0}
io.Fonts().AddFontFromFileTTFV("fonts/ttf/JetBrainsMono-Medium.ttf",
		baseFontSize,
		jetBrainsConfig,
		(*imgui.Wchar)(unsafe.Pointer(&Ranges[0])))))

correct usage

Ranges = []imgui.Wchar{0x0020, 0xA69F, 0}
io.Fonts().AddFontFromFileTTFV("fonts/ttf/JetBrainsMono-Medium.ttf",
		baseFontSize,
		jetBrainsConfig,
		&Ranges[0])

and it looks like “IMGUI_USE_WCHAR32” is not applied and “golang” expects the flag to be applied.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21

Most upvoted comments

Yeah, now it’s working as intended.