mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 457194. Be careful when we do NS_ceil for font max-ascent/max-descent; we don't want a number that's an integer plus epsilon to round up to the next integer. r=vlad
This commit is contained in:
parent
da78ac865a
commit
7a386793fc
@ -205,6 +205,12 @@ DisableCommonLigatures(ATSUStyle aStyle)
|
||||
ATSUSetFontFeatures(aStyle, NS_ARRAY_LENGTH(types), types, selectors);
|
||||
}
|
||||
|
||||
static double
|
||||
RoundToNearestMultiple(double aValue, double aFraction)
|
||||
{
|
||||
return floor(aValue/aFraction + 0.5)*aFraction;
|
||||
}
|
||||
|
||||
void
|
||||
gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
||||
{
|
||||
@ -274,8 +280,10 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
||||
|
||||
mMetrics.emHeight = size;
|
||||
|
||||
mMetrics.maxAscent = NS_ceil(atsMetrics.ascent * size);
|
||||
mMetrics.maxDescent = NS_ceil(- (atsMetrics.descent * size));
|
||||
mMetrics.maxAscent =
|
||||
NS_ceil(RoundToNearestMultiple(atsMetrics.ascent*size, 1/1024.0));
|
||||
mMetrics.maxDescent =
|
||||
NS_ceil(-RoundToNearestMultiple(atsMetrics.descent*size, 1/1024.0));
|
||||
|
||||
mMetrics.maxHeight = mMetrics.maxAscent + mMetrics.maxDescent;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user