ImGui.NET
ImGui.NET copied to clipboard
AddFontFromFileTTF + GetGlyphRangesChineseFull does not work?
ImGui.NET.SampleProgram, i add some code:
ImGuiIOPtr ioptr = ImGui.GetIO(); ioptr.Fonts.AddFontFromFileTTF("c:\Windows\Fonts\ArialUni.ttf", 18.0f, null, ioptr.Fonts.GetGlyphRangesChineseFull());
string text = "中文abc"; //chinese text ImGui.Text(text);
it does not work, why? it display --> ??abc
i use dear imgui-master :
io.Fonts->AddFontFromFileTTF("c:\Windows\Fonts\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesChineseFull()); ImGui::Text(u8"中文abc");
it works well.
It works fine in my project. For example implementation try looking at this line: https://github.com/zaafar/ClickableTransparentOverlay/blob/master/Examples/SingleThreadedOverlayWithCoroutines/SampleOverlay.cs#L88
It works fine in my project. For example implementation try looking at this line: https://github.com/zaafar/ClickableTransparentOverlay/blob/master/Examples/SingleThreadedOverlayWithCoroutines/SampleOverlay.cs#L88
it does not work in ImGui.NET.SampleProgram
i dont know where insert code ---> io.Fonts.AddFontFromFileTTF...
Yeah SampleProgram isn’t updated to support this feature but that’s fine because it’s just a Sample Program. However, this is a supported feature of ImGui.NET library and can be used by the users of ImGui library as demonstrated in the URL I shared.
Yeah SampleProgram isn’t updated to support this feature but that’s fine because it’s just a Sample Program. However, this is a supported feature of ImGui.NET library and can be used by the users of ImGui library as demonstrated in the URL I shared.
大哥,你那代码我实在看不下去。而且,调用Fonts.clear之后,Sample的代码会花屏。不调用它,你的代码就不工作。 Could you please add Chinese support to the official Sample?
Could you please add Chinese support to the official Sample?
what’s the benefit? I have already shared with you an example that works.
Make sure Font.Clear happens after ‘ _gd.SwapBuffers(_gd.MainSwapchain);’ function call. Remember, you can not change fonts while they are being used.
also, look at my https://github.com/zaafar/ClickableTransparentOverlay/blob/master/ClickableTransparentOverlay/ImGuiController.cs file. I changed it. The one in sample program is broken.
In ImGui.NET.SampleProgram,you should remove the code: //ImGui.GetIO().Fonts.AddFontDefault();
also,you could choose the font in style editor:
it works well.