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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
, FontWeight desiredWeight, float size) | 131 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
, FontWeight desiredWeight, float size) |
132 { | 132 { |
133 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { | 133 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { |
134 // On OSX 10.9, the default system font depends on the SDK version. When | 134 // On OSX 10.9, the default system font depends on the SDK version. When |
135 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When | 135 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When |
136 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout | 136 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout |
137 // tests don't support different expectations based on the SDK version, | 137 // tests don't support different expectations based on the SDK version, |
138 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK | 138 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK |
139 // switch is made, this should be changed to return .LucidaGrandeUI and | 139 // switch is made, this should be changed to return .LucidaGrandeUI and |
140 // the Layout Expectations should be updated. http://crbug.com/515836. | 140 // the Layout Expectations should be updated. http://crbug.com/515836. |
141 if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) { | 141 if (LayoutTestSupport::isRunningLayoutTest() && IsOS10_9()) { |
142 if (desiredWeight >= blink::FontWeightBold) | 142 if (desiredWeight >= blink::FontWeightBold) |
143 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; | 143 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; |
144 else | 144 else |
145 return [NSFont fontWithName:@"Lucida Grande" size:size]; | 145 return [NSFont fontWithName:@"Lucida Grande" size:size]; |
146 } | 146 } |
147 | 147 |
148 NSFont* font = nil; | 148 NSFont* font = nil; |
149 if (IsOSMavericks()) { | 149 if (IsOS10_9()) { |
150 // On older OSX versions, only bold and regular are available. | 150 // On older OSX versions, only bold and regular are available. |
151 if (desiredWeight >= blink::FontWeightBold) | 151 if (desiredWeight >= blink::FontWeightBold) |
152 font = [NSFont boldSystemFontOfSize:size]; | 152 font = [NSFont boldSystemFontOfSize:size]; |
153 else | 153 else |
154 font = [NSFont systemFontOfSize:size]; | 154 font = [NSFont systemFontOfSize:size]; |
155 } | 155 } |
156 else { | 156 else { |
157 // On OSX 10.10+, the default system font has more weights. | 157 // On OSX 10.10+, the default system font has more weights. |
158 font = [NSFont systemFontOfSize:size weight:toYosemiteFontWeight(des
iredWeight)]; | 158 font = [NSFont systemFontOfSize:size weight:toYosemiteFontWeight(des
iredWeight)]; |
159 } | 159 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 6, // FontWeight500 | 284 6, // FontWeight500 |
285 8, // FontWeight600 | 285 8, // FontWeight600 |
286 9, // FontWeight700 | 286 9, // FontWeight700 |
287 10, // FontWeight800 | 287 10, // FontWeight800 |
288 12, // FontWeight900 | 288 12, // FontWeight900 |
289 }; | 289 }; |
290 return appKitFontWeights[fontWeight]; | 290 return appKitFontWeights[fontWeight]; |
291 } | 291 } |
292 | 292 |
293 } // namespace blink | 293 } // namespace blink |
OLD | NEW |