Open tingspain opened 1 week ago
At the end I solved it by using different approach. I dont know if it is the most optimal way, but it works for me. I hope it will be useful for someone else. ^___^
Does anyone have any feedback?
unsafe {
ImGui.Begin("Glyphs List");
var io = ImGui.GetIO();
var font = io.Fonts.Fonts[0];
string[] icons = ImGuiExt.getIconList();
List<string> glyphs = new List<string>();
for (ushort i = '\ue800'; i <= '\uf2db'; i++)
{
char unicodeChar = (char)i;
if(font.FindGlyphNoFallback(unicodeChar).NativePtr == null)
continue;
glyphs.Add($"U+{i:X4} - {unicodeChar}");
}
ImGui.Text("Font Name: " + Regex.Unescape(font.GetDebugName().ToString()));
ImGui.Text("Characters: " + font.Glyphs.Size);
ImGui.Text("Glyphs: " + glyphs.Count);
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new System.Numerics.Vector2(10, 10));
ImGui.BeginChild("scrolling", new System.Numerics.Vector2(0,0) , ImGuiChildFlags.FrameStyle);
ImGui.Columns(6, null, false);
foreach (var glyph in glyphs){
ImGui.Text(glyph);
ImGui.NextColumn();
}
ImGui.Columns(1);
ImGui.EndChild();
ImGui.PopStyleVar();
ImGui.End();
}
Hello,
I am trying to create a simple window to list all the glyphs and theirs Unicode of a font. But I dont manage to use properly the Codepoint to render the character.
Does anyone know how I can achieve that?
Thanks in advance!