bug 611855 - work around incorrect font traits for helvetica light oblique on 10.6.5. r=jdaggett approval2.0=dbaron
authorJonathan Kew <jfkthame@gmail.com>
Tue, 16 Nov 2010 08:34:38 +0000
changeset 57566 fedc658ef505386cc09e24e05b15181452ab7bfd
parent 57565 2951546c734a5d4b919af1cd0b31d9c72051c5c6
child 57567 db24505d74e9fcedb413c2bf0f674b00ab8513c5
push id16984
push userjkew@mozilla.com
push dateTue, 16 Nov 2010 08:41:03 +0000
treeherdermozilla-central@db24505d74e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs611855
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 611855 - work around incorrect font traits for helvetica light oblique on 10.6.5. r=jdaggett approval2.0=dbaron
gfx/thebes/gfxMacPlatformFontList.mm
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -438,17 +438,22 @@ gfxMacFontFamily::FindStyleVariations()
         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;
         }
 
 #ifdef PR_LOGGING
         if (LOG_ENABLED()) {