Bug 1308316 - ensure Skia disables hinting if Fontconfig disables it. r=jrmuizel, a=gchang
☠☠ backed out by 8da98b978cfc ☠ ☠
authorLee Salzman <lsalzman@mozilla.com>
Fri, 21 Oct 2016 22:26:20 -0400
changeset 358475 a730703766df1e901496524d8baff44e3ead1697
parent 358474 74ddf7de7dc9f95eb63b140e7cb318a41584c91a
child 358476 d4fda3ccf384b0079bcff211e4dda7ea92d1ad06
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, gchang
bugs1308316
milestone51.0a2
Bug 1308316 - ensure Skia disables hinting if Fontconfig disables it. r=jrmuizel, a=gchang MozReview-Commit-ID: KGQfXQ82qfJ
gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
--- a/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
+++ b/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
@@ -470,21 +470,27 @@ void SkScalerContext_CairoFT::parsePatte
                 fLcdFilter = FT_LCD_FILTER_LEGACY;
                 break;
             }
         }
     } else {
         fRec.fMaskFormat = SkMask::kBW_Format;
     }
 
-    if (fRec.getHinting() != SkPaint::kNo_Hinting &&
-        (FcPatternGetBool(pattern, FC_HINTING, 0, &hinting) != FcResultMatch || hinting)) {
+    if (fRec.getHinting() != SkPaint::kNo_Hinting) {
+        // Hinting was requested, so check if the fontconfig pattern needs to override it.
+        // If hinting is either explicitly enabled by fontconfig or not configured, try to
+        // parse the hint style. Otherwise, ensure hinting is disabled.
         int hintstyle;
-        if (FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch) {
-            hintstyle = FC_HINT_FULL;
+        if (FcPatternGetBool(pattern, FC_HINTING, 0, &hinting) != FcResultMatch || hinting) {
+            if (FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch) {
+                hintstyle = FC_HINT_FULL;
+            }
+        } else {
+            hintstyle = FC_HINT_NONE;
         }
         switch (hintstyle) {
         case FC_HINT_NONE:
             fRec.setHinting(SkPaint::kNo_Hinting);
             break;
         case FC_HINT_SLIGHT:
             fRec.setHinting(SkPaint::kSlight_Hinting);
             break;