Bug 1430216 - For non-scalable fonts, we can't use the linearHoriAdvance field from the glyph slot; use the advance field instead to get proper metrics. r=lsalzman

This commit is contained in:
Jonathan Kew 2018-01-13 15:16:44 +00:00
parent 37efe4d0e6
commit 42e35bdbd0

View File

@ -519,7 +519,11 @@ gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID)
mozilla::DebugOnly<FT_Error> ftError =
FT_Load_Glyph(face.get(), aGID, flags);
MOZ_ASSERT(!ftError);
advance = face.get()->glyph->linearHoriAdvance;
if (face.get()->face_flags & FT_FACE_FLAG_SCALABLE) {
advance = face.get()->glyph->linearHoriAdvance;
} else {
advance = face.get()->glyph->advance.x << 10; // convert 26.6 to 16.16
}
// If freetype emboldening is being used, and it's not a zero-width glyph,
// adjust the advance to account for the increased width.