Bug 1118943 - Ensure mFUnitsConvFactor is set up properly for vertical fonts in the FT2 backend. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Wed, 07 Jan 2015 23:42:40 +0000
changeset 249184 e5e4ceeb399a1f7f62dec157941b94142beb9eba
parent 249183 1269384028d0169f323ba879a87bbf78052d4c7c
child 249185 6a80f8abd749faea0ab28cdb3ed8bf6098573360
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1118943
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1118943 - Ensure mFUnitsConvFactor is set up properly for vertical fonts in the FT2 backend. r=smontagu
gfx/thebes/gfxFT2FontBase.cpp
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFT2FontBase.cpp
+++ b/gfx/thebes/gfxFT2FontBase.cpp
@@ -15,16 +15,18 @@ using namespace mozilla::gfx;
 gfxFT2FontBase::gfxFT2FontBase(cairo_scaled_font_t *aScaledFont,
                                gfxFontEntry *aFontEntry,
                                const gfxFontStyle *aFontStyle)
     : gfxFont(aFontEntry, aFontStyle, kAntialiasDefault, aScaledFont),
       mSpaceGlyph(0),
       mHasMetrics(false)
 {
     cairo_scaled_font_reference(mScaledFont);
+    gfxFT2LockedFace face(this);
+    mFUnitsConvFactor = face.XScale();
 }
 
 gfxFT2FontBase::~gfxFT2FontBase()
 {
     cairo_scaled_font_destroy(mScaledFont);
 }
 
 uint32_t
@@ -112,17 +114,16 @@ gfxFT2FontBase::GetHorizontalMetrics()
     if (mHasMetrics)
         return mMetrics;
 
     if (MOZ_UNLIKELY(GetStyle()->size <= 0.0)) {
         new(&mMetrics) gfxFont::Metrics(); // zero initialize
         mSpaceGlyph = 0;
     } else {
         gfxFT2LockedFace face(this);
-        mFUnitsConvFactor = face.XScale();
         face.GetMetrics(&mMetrics, &mSpaceGlyph);
     }
 
     SanitizeMetrics(&mMetrics, false);
 
 #if 0
     //    printf("font name: %s %f\n", NS_ConvertUTF16toUTF8(GetName()).get(), GetStyle()->size);
     //    printf ("pango font %s\n", pango_font_description_to_string (pango_font_describe (font)));
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3156,17 +3156,17 @@ gfxFont::InitMetricsFromSfntTables(Metri
 
     if (mFUnitsConvFactor == 0.0) {
         // If the conversion factor from FUnits is not yet set,
         // get the unitsPerEm from the 'head' table via the font entry
         uint16_t unitsPerEm = GetFontEntry()->UnitsPerEm();
         if (unitsPerEm == gfxFontEntry::kInvalidUPEM) {
             return false;
         }
-        mFUnitsConvFactor = mAdjustedSize / unitsPerEm;
+        mFUnitsConvFactor = GetAdjustedSize() / unitsPerEm;
     }
 
     // 'hhea' table is required to get vertical extents
     gfxFontEntry::AutoTable hheaTable(mFontEntry, kHheaTableTag);
     if (!hheaTable) {
         return false; // no 'hhea' table -> not an sfnt
     }
     const MetricsHeader* hhea =