Skip to content

Commit

Permalink
Better glyph positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Aug 22, 2022
1 parent 6dc13a0 commit f6af55f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions DebugGUI/src/DebugGUI.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ void* initGUI(const char* name, void(*error_callback)(int, char const*descriptio
io.Fonts->AddFontDefault();
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; icons_config.FontDataOwnedByAtlas = false;
io.Fonts->AddFontFromMemoryTTF((void*)s_iconsFontAwesomeTtf, sizeof(s_iconsFontAwesomeTtf), 12.0f, &icons_config, icons_ranges);

icons_config.GlyphOffset = {0, 2};
icons_config.GlyphMinAdvanceX = 17;
io.Fonts->AddFontFromMemoryTTF((void *)s_iconsFontAwesomeTtf,
sizeof(s_iconsFontAwesomeTtf), 13.0f,
&icons_config, icons_ranges);

// this initializes the texture
if (io.Fonts->ConfigData.empty())
io.Fonts->AddFontDefault();
Expand Down
14 changes: 10 additions & 4 deletions DebugGUI/src/DebugGUIMacos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ static void default_error_callback(int error, const char *description) {
icons_config.MergeMode = true;
icons_config.PixelSnapH = true;
icons_config.FontDataOwnedByAtlas = false;
io.Fonts->AddFontFromMemoryTTF((void *)s_iconsFontAwesomeTtf, sizeof(s_iconsFontAwesomeTtf),
12.0f, &icons_config, icons_ranges);
icons_config.GlyphOffset = {0, 2};
icons_config.GlyphMinAdvanceX = 17;
io.Fonts->AddFontFromMemoryTTF((void *)s_iconsFontAwesomeTtf,
sizeof(s_iconsFontAwesomeTtf), 13.0f,
&icons_config, icons_ranges);

if (io.Fonts->ConfigData.empty()) io.Fonts->AddFontDefault();
// io.Fonts->Build();
Expand Down Expand Up @@ -123,9 +126,12 @@ static void default_error_callback(int error, const char *description) {
ImFontConfig icons_config;
icons_config.MergeMode = true;
icons_config.PixelSnapH = true;
icons_config.GlyphOffset = {0, 2};
icons_config.GlyphMinAdvanceX = 17;
icons_config.FontDataOwnedByAtlas = false;
io.Fonts->AddFontFromMemoryTTF((void *)s_iconsFontAwesomeTtf, sizeof(s_iconsFontAwesomeTtf),
12.0f, &icons_config, icons_ranges);
io.Fonts->AddFontFromMemoryTTF((void *)s_iconsFontAwesomeTtf,
sizeof(s_iconsFontAwesomeTtf), 13.0f,
&icons_config, icons_ranges);

if (io.Fonts->ConfigData.empty()) io.Fonts->AddFontDefault();
// io.Fonts->Build();
Expand Down

0 comments on commit f6af55f

Please sign in to comment.