mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Make fixed font more compact.
Note that the negative glyph spacing is const here, regardless of the font scaling. The alternative of using proportional spacing in reality does not work as good as it sounds. With fractional scaling some of the glyphs will no longer land on exact pixel boundaries, which results in blurry text. Looking at the potential solutions for this problem is moot point, as with the non-fractional scale of 2x and glyph spacing of -2, there is no longer enough space separating some letters, which is especially visible in words like "common" or register "xmm", where the "mm" pair becomes joined.
This commit is contained in:
parent
26e7d6eb3e
commit
d9d31e4d51
@ -36,11 +36,14 @@ void LoadFonts( float scale, ImFont*& cb_fixedWidth, ImFont*& cb_bigFont, ImFont
|
|||||||
ImFontConfig configMerge;
|
ImFontConfig configMerge;
|
||||||
configMerge.MergeMode = true;
|
configMerge.MergeMode = true;
|
||||||
configMerge.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
configMerge.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||||
|
ImFontConfig configFixed;
|
||||||
|
configFixed.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||||
|
configFixed.GlyphExtraSpacing.x = -1;
|
||||||
|
|
||||||
io.Fonts->Clear();
|
io.Fonts->Clear();
|
||||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 15.0f * scale ), &configBasic, rangesBasic );
|
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 15.0f * scale ), &configBasic, rangesBasic );
|
||||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 14.0f * scale ), &configMerge, rangesIcons );
|
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 14.0f * scale ), &configMerge, rangesIcons );
|
||||||
s_fixedWidth = cb_fixedWidth = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FiraCodeRetina_compressed_data, tracy::FiraCodeRetina_compressed_size, round( 15.0f * scale ), &configBasic );
|
s_fixedWidth = cb_fixedWidth = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FiraCodeRetina_compressed_data, tracy::FiraCodeRetina_compressed_size, round( 15.0f * scale ), &configFixed );
|
||||||
s_bigFont = cb_bigFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 21.0f * scale ), &configBasic );
|
s_bigFont = cb_bigFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 21.0f * scale ), &configBasic );
|
||||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 20.0f * scale ), &configMerge, rangesIcons );
|
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 20.0f * scale ), &configMerge, rangesIcons );
|
||||||
s_smallFont = cb_smallFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 10.0f * scale ), &configBasic );
|
s_smallFont = cb_smallFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 10.0f * scale ), &configBasic );
|
||||||
|
Loading…
Reference in New Issue
Block a user