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 92092 3bd6203cc61bdbaddf26e2a54a9f4e671aeb4bb8
parent 92091 e158b91dd28a36ae101c2426fc059581eed94cd4
child 92093 4f8477634e9055888fd7707a259cb8fc6c6bbec2
push idunknown
push userunknown
push dateunknown
reviewersbas, lsblakk
bugs744480
milestone13.0a2
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
@@ -151,19 +151,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) {