bug 973682 - ensure emHeight is initialized even if no 'head' table is available. r=karlt
authorJonathan Kew <jkew@mozilla.com>
Mon, 17 Feb 2014 23:01:00 +0000
changeset 169516 c1e8c919bb74e73288501a64057dcb7d33e81436
parent 169515 c9d80d79b817a189af478785e01c0de8ed3aa6a5
child 169557 6a957f4fe3086ebbfc4d75210967ee35ede48ec9
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerskarlt
bugs973682
milestone30.0a1
bug 973682 - ensure emHeight is initialized even if no 'head' table is available. r=karlt
gfx/thebes/gfxFT2Utils.cpp
--- a/gfx/thebes/gfxFT2Utils.cpp
+++ b/gfx/thebes/gfxFT2Utils.cpp
@@ -89,25 +89,25 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Me
         //
         // FT_Size_Metrics::y_scale is in 16.16 fixed point format.  Its
         // (fractional) value is a factor that converts vertical metrics from
         // design units to units of 1/64 pixels, so that the result may be
         // interpreted as pixels in 26.6 fixed point format.
         yScale = FLOAT_FROM_26_6(FLOAT_FROM_16_16(ftMetrics.y_scale));
         emHeight = mFace->units_per_EM * yScale;
     } else { // Not scalable.
+        emHeight = ftMetrics.y_ppem;
         // FT_Face doc says units_per_EM and a bunch of following fields
         // are "only relevant to scalable outlines". If it's an sfnt,
         // we can get units_per_EM from the 'head' table instead; otherwise,
         // we don't have a unitsPerEm value so we can't compute/use yScale.
         const TT_Header* head =
             static_cast<TT_Header*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_head));
         if (head) {
             gfxFloat emUnit = head->Units_Per_EM;
-            emHeight = ftMetrics.y_ppem;
             yScale = emHeight / emUnit;
         }
     }
 
     TT_OS2 *os2 =
         static_cast<TT_OS2*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_os2));
 
     aMetrics->maxAscent = FLOAT_FROM_26_6(ftMetrics.ascender);