Bug 1000370 - Call SetupCairoFont at the beginning of gfxFont::GetGlyphHAdvance. r=jfkthame
authorFrédéric Wang <fred.wang@free.fr>
Wed, 23 Apr 2014 14:12:31 -0700
changeset 180213 3202a3687c0add91406017d0e204f572ad1529b9
parent 180212 12b7dbec13152fbe226aaece504565d1ecde2160
child 180214 30e0c1b4a757dc95bc543e2faaac33232d62a3e7
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersjfkthame
bugs1000370
milestone31.0a1
Bug 1000370 - Call SetupCairoFont at the beginning of gfxFont::GetGlyphHAdvance. r=jfkthame DONTBUILD
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2026,30 +2026,33 @@ gfxFont::~gfxFont()
     if (mGlyphChangeObservers) {
         mGlyphChangeObservers->EnumerateEntries(NotifyFontDestroyed, nullptr);
     }
 }
 
 gfxFloat
 gfxFont::GetGlyphHAdvance(gfxContext *aCtx, uint16_t aGID)
 {
+    if (!SetupCairoFont(aCtx)) {
+        return 0;
+    }
     if (ProvidesGlyphWidths()) {
         return GetGlyphWidth(aCtx, aGID) / 65536.0;
     }
     if (mFUnitsConvFactor == 0.0f) {
         GetMetrics();
     }
     NS_ASSERTION(mFUnitsConvFactor > 0.0f,
                  "missing font unit conversion factor");
     if (!mHarfBuzzShaper) {
         mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
     }
     gfxHarfBuzzShaper* shaper =
         static_cast<gfxHarfBuzzShaper*>(mHarfBuzzShaper.get());
-    if (!shaper->Initialize() || !SetupCairoFont(aCtx)) {
+    if (!shaper->Initialize()) {
         return 0;
     }
     return shaper->GetGlyphHAdvance(aCtx, aGID) / 65536.0;
 }
 
 /*static*/
 PLDHashOperator
 gfxFont::AgeCacheEntry(CacheHashEntry *aEntry, void *aUserData)