Fixed computation of ImFont::MetricsTotalSurface not taking oversampling into account

This commit is contained in:
omar
2017-05-14 16:27:10 +02:00
parent bd9868f447
commit 0828a1fd6c
2 changed files with 2 additions and 2 deletions

View File

@ -1456,7 +1456,7 @@ bool ImFontAtlas::Build()
glyph.XAdvance = (pc.xadvance + cfg.GlyphExtraSpacing.x); // Bake spacing into XAdvance
if (cfg.PixelSnapH)
glyph.XAdvance = (float)(int)(glyph.XAdvance + 0.5f);
dst_font->MetricsTotalSurface += (int)(glyph.X1 - glyph.X0 + 1.99f) * (int)(glyph.Y1 - glyph.Y0 + 1.99f); // +1 to account for average padding, +0.99 to round
dst_font->MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * TexHeight + 1.99f); // +1 to account for average padding, +0.99 to round
}
}
cfg.DstFont->BuildLookupTable();