You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
staticvoidShowGlyphWindow(){
unsafe {ImGui.Begin("Glyphs List");vario=ImGui.GetIO();varfont=io.Fonts.Fonts[0];// Access the default font (usually the first one)ImGui.Text(Regex.Unescape(font.GetDebugName().ToString()));// Iterate through all the glyphs in the default fontfor(inti=0;i<font.Glyphs.Size;i++){varglyph=font.Glyphs[i];if(glyph.Codepoint==0)continue;// Create a string to display the glyph character and its Unicode codepointvarglyphString=newStringBuilder();stringtext=$"\\u{glyph.Codepoint:X4}";stringtext2=$"{glyph.Codepoint:X4}";byte[]bytes=Encoding.Default.GetBytes(text2);text2=Encoding.UTF8.GetString(bytes);glyphString.Append($"Char: {text} Unicode: U+{glyph.Codepoint:X4}");// Display the glyph stringImGui.Text(Regex.Unescape(glyphString.ToString()));}ImGui.End();}}
The text was updated successfully, but these errors were encountered:
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. ^___^
Same issue as #206. The Colored/Visible/Codepoint fields in the ImFontGlyph struct are bit packed and ImGui.NET doesn't honor this. Your original code snippet could have worked if you incorrectly access the ImFontGlyph structure to compensate for the incorrect layout and do:
glyph.Colored >> 2
PR #245 should fix this but I don't know what the status is.
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!
The text was updated successfully, but these errors were encountered: