Fonts: avoid baking ExtraSizeScale twice into Ascent/Descent.

Amend 55ad3b4
With extreme values of ExtraSizeScale offset would be noticeable in Descent - TextLink() function - or Ascent - TableAngledHeadersRow() function.
This commit is contained in:
ocornut
2026-02-05 16:46:15 +01:00
parent 524f01d248
commit 1bcc23ef12
2 changed files with 2 additions and 2 deletions

View File

@@ -4699,7 +4699,7 @@ static bool ImGui_ImplStbTrueType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig
{
// FIXME-NEWFONTS: reevaluate how to use sizing metrics
// 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 / src->ExtraSizeScale;
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
stbtt_GetFontVMetrics(&bd_font_data->FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
baked->Ascent = ImCeil(unscaled_ascent * scale_for_layout);