Bug 1120102 - Use absolute value of vhea descender field, because fonts differ in the sign of the coordinate system they assume. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Mon, 12 Jan 2015 14:24:05 +0000
changeset 249183 1269384028d0169f323ba879a87bbf78052d4c7c
parent 249182 a44152aabff48952b4fb78db68d53ce84d323fc3
child 249184 e5e4ceeb399a1f7f62dec157941b94142beb9eba
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
bugs1120102
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 1120102 - Use absolute value of vhea descender field, because fonts differ in the sign of the coordinate system they assume. r=smontagu
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3449,17 +3449,17 @@ gfxFont::CreateVerticalMetrics()
         const MetricsHeader* vhea =
             reinterpret_cast<const MetricsHeader*>
                 (hb_blob_get_data(vheaTable, &len));
         if (len >= sizeof(MetricsHeader)) {
             SET_UNSIGNED(maxAdvance, vhea->advanceWidthMax);
             // Redistribute space between ascent/descent because we want a
             // centered vertical baseline by default.
             gfxFloat halfExtent = 0.5 * gfxFloat(mFUnitsConvFactor) *
-                (int16_t(vhea->ascender) - int16_t(vhea->descender));
+                (int16_t(vhea->ascender) + std::abs(int16_t(vhea->descender)));
             metrics->maxAscent = halfExtent;
             metrics->maxDescent = halfExtent;
             SET_SIGNED(externalLeading, vhea->lineGap);
         }
     }
 
     // If we didn't set aveCharWidth above, we must be dealing with a non-sfnt
     // font of some kind (Type1, bitmap, vector, ...), so fall back to using