bug 626299 patch 2 - don't use subpixel-AA mode with DWrite fonts when bitmaps are present. r=jdaggett a=blocking
authorJonathan Kew <jfkthame@gmail.com>
Fri, 21 Jan 2011 19:26:30 +0000
changeset 61104 4cfa1d632c93ead96d4afc0742f83ce68b54bf55
parent 61103 7294ab636e1d10985ac01d53ecbd1cd21e59b645
child 61105 fe9298abe0696c164334f214c376721b84ed068d
push idunknown
push userunknown
push dateunknown
reviewersjdaggett, blocking
bugs626299
milestone2.0b10pre
bug 626299 patch 2 - don't use subpixel-AA mode with DWrite fonts when bitmaps are present. r=jdaggett a=blocking
gfx/thebes/gfxDWriteFonts.cpp
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -223,16 +223,22 @@ gfxDWriteFont::ComputeMetrics()
         mAdjustedSize = mStyle.GetAdjustedSize(aspect);
     } else {
         mAdjustedSize = mStyle.size;
     }
 
     if (HasBitmapStrikeForSize(NS_lround(mAdjustedSize))) {
         mAdjustedSize = NS_lround(mAdjustedSize);
         mUseSubpixelPositions = PR_FALSE;
+        // if we have bitmaps, we need to tell Cairo NOT to use subpixel AA,
+        // to avoid the manual-subpixel codepath in cairo-d2d-surface.cpp
+        // which fails to render bitmap glyphs (see bug 626299)
+        if (mAntialiasOption == kAntialiasDefault && UsingClearType()) {
+            mAntialiasOption = kAntialiasGrayscale;
+        }
     }
 
     mMetrics = new gfxFont::Metrics;
     ::memset(mMetrics, 0, sizeof(*mMetrics));
 
     mMetrics->xHeight =
         ((gfxFloat)fontMetrics.xHeight /
                    fontMetrics.designUnitsPerEm) * mAdjustedSize;