зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1582749 - try to load only the advance width from FreeType when possible. r=jfkthame
During metrics initialization we load a few uncached glyph widths which can occasionally show up in a profile. This should reduce the overhead of that somewhat. Differential Revision: https://phabricator.services.mozilla.com/D46786 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cb082e96f2
Коммит
30af0c2548
|
@ -157,7 +157,8 @@ uint32_t gfxFT2FontBase::GetCharExtents(char aChar, gfxFloat* aWidth,
|
|||
FT_UInt gid = GetGlyph(aChar);
|
||||
int32_t width;
|
||||
IntRect bounds;
|
||||
if (gid && GetFTGlyphExtents(gid, &width, &bounds)) {
|
||||
if (gid && GetFTGlyphExtents(gid, aWidth ? &width : nullptr,
|
||||
aBounds ? &bounds : nullptr)) {
|
||||
if (aWidth) {
|
||||
*aWidth = FLOAT_FROM_16_16(width);
|
||||
}
|
||||
|
@ -529,7 +530,11 @@ bool gfxFT2FontBase::GetFTGlyphExtents(uint16_t aGID, int32_t* aAdvance,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Factory::LoadFTGlyph(face.get(), aGID, mFTLoadFlags) != FT_Err_Ok) {
|
||||
FT_Int32 flags = mFTLoadFlags;
|
||||
if (!aBounds) {
|
||||
flags |= FT_LOAD_ADVANCE_ONLY;
|
||||
}
|
||||
if (Factory::LoadFTGlyph(face.get(), aGID, flags) != FT_Err_Ok) {
|
||||
// FT_Face was somehow broken/invalid? Don't try to access glyph slot.
|
||||
// This probably shouldn't happen, but does: see bug 1440938.
|
||||
NS_WARNING("failed to load glyph!");
|
||||
|
|
Загрузка…
Ссылка в новой задаче