Closed se5a closed 5 years ago
Ok so I was being dense, incase anyone else has problems with this, here's how to do it:
unsafe
{
string rf = "Resources";
var fontAtlas = ImGui.GetIO().Fonts;
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
builder.AddText("Ωων");
builder.AddRanges(fontAtlas.GetGlyphRangesDefault());
builder.BuildRanges(out ImVector ranges);
fontAtlas.AddFontFromFileTTF(Path.Combine(rf, "DejaVuSans.ttf"), 15, null, ranges.Data);
}
Thanks to mellione and SomeAnon42 helping me out in gitter.
Note that not all fonts will work, ie ProggyClean (imgui's default) does not appear to have those chars (though opening the char map in linux it looks like it does? I'm also still unsure how to find the correct size for a given font, I've yet to get anything looking as crisp as ProggyClean.
I'm trying to add some greek chars so I can display Ω, ω among some others used in orbital mechanics.
However following the instructions for DearImGui here: https://github.com/ocornut/imgui/blob/master/misc/fonts/README.txt#L185 I'm stuck, as ImFontGlyphRangesBuilder does not have any of the functions noted there, specifically
AddText
,AddChar
,AddRanges
, andBuildRanges
. There also does not apear to be anImWchar
type.Is this done a slightly different way in imgui.net and I'm just being dense, or is it a feature that's missing in ImGui.Net, or cimgui? Is there another way to add the chars I'm after?