mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: Baked system, fix subsequent sources overriding shared font metrics.
This commit is contained in:
parent
dc1320df64
commit
92993e68c8
2 changed files with 7 additions and 3 deletions
|
|
@ -4313,7 +4313,8 @@ static void ImGui_ImplStbTrueType_FontBakedInit(ImFontAtlas* atlas, ImFontBaked*
|
||||||
{
|
{
|
||||||
ImFontConfig* src = &font->Sources[src_n];
|
ImFontConfig* src = &font->Sources[src_n];
|
||||||
ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData;
|
ImGui_ImplStbTrueType_FontSrcData* bd_font_data = (ImGui_ImplStbTrueType_FontSrcData*)src->FontLoaderData;
|
||||||
|
if (src_n != 0)
|
||||||
|
continue;
|
||||||
// FIXME-NEWFONTS: reevaluate how to use sizing metrics
|
// FIXME-NEWFONTS: reevaluate how to use sizing metrics
|
||||||
// FIXME-NEWFONTS: make use of line gap value
|
// FIXME-NEWFONTS: make use of line gap value
|
||||||
float scale_for_layout = bd_font_data->ScaleFactor * baked->Size;
|
float scale_for_layout = bd_font_data->ScaleFactor * baked->Size;
|
||||||
|
|
|
||||||
|
|
@ -479,8 +479,11 @@ void ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontBaked* baked)
|
||||||
bd_baked_data->MaxAdvanceWidth = (float)FT_CEIL(metrics.max_advance) * bd_font_data->InvRasterizationDensity;
|
bd_baked_data->MaxAdvanceWidth = (float)FT_CEIL(metrics.max_advance) * bd_font_data->InvRasterizationDensity;
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
baked->Ascent = bd_baked_data->Ascender;
|
if (src_n == 0)
|
||||||
baked->Descent = bd_baked_data->Descender;
|
{
|
||||||
|
baked->Ascent = bd_baked_data->Ascender;
|
||||||
|
baked->Descent = bd_baked_data->Descender;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue