Skip to content

Commit

Permalink
FontManager: text rendering quality improvements by ensuring fonts ar…
Browse files Browse the repository at this point in the history
…e aligned to pixel grid, avoiding fractional line heights and excessive resampling
  • Loading branch information
azonenberg committed Sep 8, 2023
1 parent 86da563 commit b5677d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib
5 changes: 4 additions & 1 deletion src/ngscopeclient/FontManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ bool FontManager::UpdateFonts(PreferenceCategory& root, float contentScale)
builder.BuildRanges(&ranges);

//Load the fonts
ImFontConfig config;
config.PixelSnapH = true;
config.OversampleH = 1;
for(auto f : fonts)
m_fonts[f] = atlas->AddFontFromFileTTF(f.first.c_str(), f.second * contentScale, nullptr, ranges.Data);
m_fonts[f] = atlas->AddFontFromFileTTF(f.first.c_str(), round(f.second * contentScale), &config, ranges.Data);

//Done loading fonts, build the texture
atlas->Flags = ImFontAtlasFlags_NoMouseCursors;
Expand Down

0 comments on commit b5677d0

Please sign in to comment.