mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-09 12:58:22 +00:00
Fonts: fixed broken support for legacy backend due to a mismatch with initial pre-build baked id.
This commit is contained in:
@@ -8657,7 +8657,7 @@ void ImGui::UpdateCurrentFontSize()
|
|||||||
// - We may support it better later and remove this rounding.
|
// - We may support it better later and remove this rounding.
|
||||||
final_size = GetRoundedFontSize(final_size);
|
final_size = GetRoundedFontSize(final_size);
|
||||||
final_size = ImMax(1.0f, final_size);
|
final_size = ImMax(1.0f, final_size);
|
||||||
if (g.Font != NULL)
|
if (g.Font != NULL && (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures))
|
||||||
g.Font->CurrentRasterizerDensity = g.FontRasterizerDensity;
|
g.Font->CurrentRasterizerDensity = g.FontRasterizerDensity;
|
||||||
g.FontBaked = (g.Font != NULL) ? g.Font->GetFontBaked(final_size) : NULL;
|
g.FontBaked = (g.Font != NULL) ? g.Font->GetFontBaked(final_size) : NULL;
|
||||||
g.FontSize = final_size;
|
g.FontSize = final_size;
|
||||||
|
2
imgui.h
2
imgui.h
@@ -3467,7 +3467,7 @@ struct ImFontConfig
|
|||||||
float GlyphExtraAdvanceX; // 0 // Extra spacing (in pixels) between glyphs. Please contact us if you are using this.
|
float GlyphExtraAdvanceX; // 0 // Extra spacing (in pixels) between glyphs. Please contact us if you are using this.
|
||||||
unsigned int FontBuilderFlags; // 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
|
unsigned int FontBuilderFlags; // 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
|
||||||
float RasterizerMultiply; // 1.0f // Linearly brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. This is a silly thing we may remove in the future.
|
float RasterizerMultiply; // 1.0f // Linearly brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. This is a silly thing we may remove in the future.
|
||||||
float RasterizerDensity; // 1.0f // DPI scale multiplier for rasterization. Not altering other font metrics: makes it easy to swap between e.g. a 100% and a 400% fonts for a zooming display, or handle Retina screen. IMPORTANT: If you change this it is expected that you increase/decrease font scale roughly to the inverse of this, otherwise quality may look lowered.
|
float RasterizerDensity; // 1.0f // (Legacy: this only makes sense when ImGuiBackendFlags_RendererHasTextures is not supported). DPI scale multiplier for rasterization. Not altering other font metrics: makes it easy to swap between e.g. a 100% and a 400% fonts for a zooming display, or handle Retina screen. IMPORTANT: If you change this it is expected that you increase/decrease font scale roughly to the inverse of this, otherwise quality may look lowered.
|
||||||
ImWchar EllipsisChar; // 0 // Explicitly specify Unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
|
ImWchar EllipsisChar; // 0 // Explicitly specify Unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
|
@@ -3002,6 +3002,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in)
|
|||||||
font->FontId = FontNextUniqueID++;
|
font->FontId = FontNextUniqueID++;
|
||||||
font->Flags = font_cfg_in->Flags;
|
font->Flags = font_cfg_in->Flags;
|
||||||
font->DefaultSize = font_cfg_in->SizePixels;
|
font->DefaultSize = font_cfg_in->SizePixels;
|
||||||
|
font->CurrentRasterizerDensity = font_cfg_in->RasterizerDensity;
|
||||||
Fonts.push_back(font);
|
Fonts.push_back(font);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user