bug 611855 - work around incorrect font traits for helvetica light oblique on 10.6.5. r=jdaggett a1.9.2.13=LegNeato
authorJonathan Kew <jfkthame@gmail.com>
Tue, 16 Nov 2010 08:34:38 +0000
changeset 34744 28d98b480e3d6744710cb1a6e43134ba325a0fa3
parent 34743 3956db8d0373c5c5402f1d75eec837f2d75abac9
child 34745 320791250625b1bf7e74dbd1309a9c923254fbde
push id1678
push userjkew@mozilla.com
push dateWed, 17 Nov 2010 06:58:55 +0000
reviewersjdaggett
bugs611855
milestone1.9.2.13pre
bug 611855 - work around incorrect font traits for helvetica light oblique on 10.6.5. r=jdaggett a1.9.2.13=LegNeato
gfx/thebes/src/gfxMacPlatformFontList.mm
--- a/gfx/thebes/src/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/src/gfxMacPlatformFontList.mm
@@ -522,17 +522,22 @@ gfxMacPlatformFontList::InitFontList()
             if (!fontEntry) break;
 
             // set additional properties based on the traits reported by Cocoa
             if (macTraits & (NSCondensedFontMask | NSNarrowFontMask | NSCompressedFontMask)) {
                 fontEntry->mStretch = NS_FONT_STRETCH_CONDENSED;
             } else if (macTraits & NSExpandedFontMask) {
                 fontEntry->mStretch = NS_FONT_STRETCH_EXPANDED;
             }
-            if (macTraits & NSItalicFontMask) {
+            // Cocoa fails to set the Italic traits bit for HelveticaLightItalic,
+            // at least (see bug 611855), so check for style name endings as well
+            if ((macTraits & NSItalicFontMask) ||
+                [facename hasSuffix:@"Italic"] ||
+                [facename hasSuffix:@"Oblique"])
+            {
                 fontEntry->mItalic = PR_TRUE;
             }
             if (macTraits & NSFixedPitchFontMask) {
                 fontEntry->mFixedPitch = PR_TRUE;
             }
 
             // insert into font entry array of family
             familyEntry->AddFontEntry(fontEntry);