bug 635768 - restore explicit font selection in gfxGDIFont::GetGlyphWidth to fix spacing issues when printing. r=roc a=blocker
authorJonathan Kew <jfkthame@gmail.com>
Wed, 23 Feb 2011 09:39:21 +0000
changeset 62991 88752f2b3088a6ac13e925912d8274971c81e60f
parent 62990 3bf94b2e88336a0bef325dcda7fbde11d0f263df
child 62992 7dda35eab7fc665025a7b6c8ac67ac5fd8979aab
push id18978
push userjkew@mozilla.com
push dateWed, 23 Feb 2011 09:40:28 +0000
treeherdermozilla-central@88752f2b3088 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocker
bugs635768
milestone2.0b13pre
first release with
nightly win64
88752f2b3088 / 4.0b13pre / 20110223030201 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
bug 635768 - restore explicit font selection in gfxGDIFont::GetGlyphWidth to fix spacing issues when printing. r=roc a=blocker
gfx/thebes/gfxGDIFont.cpp
--- a/gfx/thebes/gfxGDIFont.cpp
+++ b/gfx/thebes/gfxGDIFont.cpp
@@ -478,18 +478,21 @@ gfxGDIFont::GetGlyphWidth(gfxContext *aC
         mGlyphWidths.Init(200);
     }
 
     PRInt32 width;
     if (mGlyphWidths.Get(aGID, &width)) {
         return width;
     }
 
+    DCFromContext dc(aCtx);
+    AutoSelectFont fs(dc, GetHFONT());
+
     int devWidth;
-    if (GetCharWidthI(DCFromContext(aCtx), aGID, 1, NULL, &devWidth)) {
+    if (GetCharWidthI(dc, aGID, 1, NULL, &devWidth)) {
         // ensure width is positive, 16.16 fixed-point value
         width = (devWidth & 0x7fff) << 16;
         mGlyphWidths.Put(aGID, width);
         return width;
     }
 
     return -1;
 }