Bug 420822. Missing 500 weight font should fallback to lighter weights. r+sr=stuart
authorjdaggett@mozilla.com
Tue, 04 Mar 2008 02:24:32 -0800
changeset 12541 8e158750476e8191cefbead8ba265a81e4071503
parent 12540 9fd1dd34df4d964947525c736cfbe6c0ede26ca8
child 12542 aca312fb40991dcacb46160ff8ec622b81a5d723
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs420822
milestone1.9b5pre
Bug 420822. Missing 500 weight font should fallback to lighter weights. r+sr=stuart
gfx/thebes/src/gfxQuartzFontCache.mm
--- a/gfx/thebes/src/gfxQuartzFontCache.mm
+++ b/gfx/thebes/src/gfxQuartzFontCache.mm
@@ -466,23 +466,21 @@ MacOSFamilyEntry::FindFontWeight(MacOSFo
         baseMatch = baseWeight;
         
     } else {
     
         // CSS2.1 and draft CSS3 Fonts specs are ambiguous about how to handle missing 400 weight face
         // substitute 400 and 500 for each other (example: Futura family that ships with Mac OS X)
         if (baseWeight == 4 && aFontsForWeights[5]) {
             baseMatch = 5;
-        } else if (baseWeight == 5 && aFontsForWeights[4]) {
-            baseMatch = 4;
         } else {
         
             // otherwise, use explicit CSS rules
-            // weights above 400 ==> look up in weights, then down, otherwise look down, then up
-            direction = (baseWeight > 4 ? 1 : -1);
+            // weights above 500 ==> look up in weights, then down, otherwise look down, then up
+            direction = (baseWeight > 5 ? 1 : -1);
             
             // search in one direction
             for (w = baseWeight + direction; w >= 1 && w <= 9; w += direction) {
                 if (aFontsForWeights[w]) {
                     baseMatch = w;
                     break;
                 }
             }