bug 744480 - check for failure to set up the cairo font. r=bas a=lsblakk
authorJonathan Kew <jfkthame@gmail.com>
Fri, 13 Apr 2012 17:39:39 +0100
changeset 88695 1117e4172a90e59d6de484be81d546cb50eba3e6
parent 88694 e6be81269d27ea806fd98739e038ee9f03916615
child 88696 6e53f939f79514bc4a0980b2212ce3b5fea58992
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersbas, lsblakk
bugs744480
milestone12.0
bug 744480 - check for failure to set up the cairo font. r=bas a=lsblakk
gfx/thebes/gfxGDIFont.cpp
--- a/gfx/thebes/gfxGDIFont.cpp
+++ b/gfx/thebes/gfxGDIFont.cpp
@@ -152,19 +152,23 @@ gfxGDIFont::ShapeWord(gfxContext *aConte
     }
     if (!mIsValid) {
         NS_WARNING("invalid font! expect incorrect text rendering");
         return false;
     }
 
     bool ok = false;
 
-    // ensure the cairo font is set up, so there's no risk it'll fall back to
-    // creating a "toy" font internally (see bug 544617)
-    SetupCairoFont(aContext);
+    // Ensure the cairo font is set up, so there's no risk it'll fall back to
+    // creating a "toy" font internally (see bug 544617).
+    // We must check that this succeeded, otherwise we risk cairo creating the
+    // wrong kind of font internally as a fallback (bug 744480).
+    if (!SetupCairoFont(aContext)) {
+        return false;
+    }
 
 #ifdef MOZ_GRAPHITE
     if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
         ok = mGraphiteShaper->ShapeWord(aContext, aShapedWord, aString);
     }
 #endif
 
     if (!ok && mHarfBuzzShaper) {