OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Otherwise, prefer the one closer to the desired weight. | 126 // Otherwise, prefer the one closer to the desired weight. |
127 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; | 127 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; |
128 } | 128 } |
129 | 129 |
130 // Family name is somewhat of a misnomer here. We first attempt to find an exac
t match | 130 // Family name is somewhat of a misnomer here. We first attempt to find an exac
t match |
131 // comparing the desiredFamily to the PostScript name of the installed fonts. I
f that fails | 131 // comparing the desiredFamily to the PostScript name of the installed fonts. I
f that fails |
132 // we then do a search based on the family names of the installed fonts. | 132 // we then do a search based on the family names of the installed fonts. |
133 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
, FontWeight desiredWeight, float size) | 133 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
, FontWeight desiredWeight, float size) |
134 { | 134 { |
135 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { | 135 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { |
| 136 // On OSX 10.11, returning the default system font causes rendering |
| 137 // problems. In the short term, return nil, which is what would be |
| 138 // returned if "BlinkMacSystemFont" was never introduced. |
| 139 // TODO(erikchen): Fix the rendering problems. |
| 140 // http://crbug.com/521034. |
| 141 if (IsOSElCapitan()) { |
| 142 return nil; |
| 143 } |
| 144 |
136 // On OSX 10.9, the default system font depends on the SDK version. When | 145 // On OSX 10.9, the default system font depends on the SDK version. When |
137 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When | 146 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When |
138 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout | 147 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout |
139 // tests don't support different expectations based on the SDK version, | 148 // tests don't support different expectations based on the SDK version, |
140 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK | 149 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK |
141 // switch is made, this should be changed to return .LucidaGrandeUI and | 150 // switch is made, this should be changed to return .LucidaGrandeUI and |
142 // the Layout Expectations should be updated. http://crbug.com/515836. | 151 // the Layout Expectations should be updated. http://crbug.com/515836. |
143 if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) { | 152 if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) { |
144 if (desiredWeight >= blink::FontWeightBold) | 153 if (desiredWeight >= blink::FontWeightBold) |
145 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; | 154 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 6, // FontWeight500 | 295 6, // FontWeight500 |
287 8, // FontWeight600 | 296 8, // FontWeight600 |
288 9, // FontWeight700 | 297 9, // FontWeight700 |
289 10, // FontWeight800 | 298 10, // FontWeight800 |
290 12, // FontWeight900 | 299 12, // FontWeight900 |
291 }; | 300 }; |
292 return appKitFontWeights[fontWeight]; | 301 return appKitFontWeights[fontWeight]; |
293 } | 302 } |
294 | 303 |
295 } // namespace blink | 304 } // namespace blink |
OLD | NEW |