Changeset 183895 in webkit
- Timestamp:
- May 6, 2015, 3:55:09 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac/fast/text/systemFont-expected.txt (modified) (2 diffs)
-
LayoutTests/platform/mac/fast/text/systemFont.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/mac/FontCacheMac.mm (modified) (2 diffs)
-
Source/WebCore/platform/spi/mac/NSFontSPI.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183894 r183895 1 2015-05-06 Jon Lee <jonlee@apple.com> 2 3 Expose more font weights for -apple-system 4 https://bugs.webkit.org/show_bug.cgi?id=144707 5 6 Reviewed by Dean Jackson. 7 8 * platform/mac/fast/text/systemFont.html: Update test to include font weights for -apple-system. 9 * platform/mac/fast/text/systemFont-expected.txt: Update expectations. 10 1 11 2015-05-06 Dean Jackson <dino@apple.com> 2 12 -
trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt
r183662 r183895 1 layer at (0,0) size 785x2 0361 layer at (0,0) size 785x2198 2 2 RenderView at (0,0) size 785x600 3 layer at (0,0) size 785x2 0364 RenderBlock {HTML} at (0,0) size 785x2 0365 RenderBody {BODY} at (8,8) size 769x2 0203 layer at (0,0) size 785x2198 4 RenderBlock {HTML} at (0,0) size 785x2198 5 RenderBody {BODY} at (8,8) size 769x2182 6 6 RenderBlock {DIV} at (0,0) size 769x897 7 7 RenderBlock {DIV} at (0,0) size 769x28 … … 79 79 text run at (0,0) width 756: "This is a test for -apple-" 80 80 text run at (0,85) width 373: "system font" 81 RenderBlock {DIV} at (0,1738) size 769x282 81 RenderBlock {DIV} at (0,1738) size 769x162 82 RenderBlock {DIV} at (0,0) size 769x18 83 RenderText {#text} at (0,0) size 302x18 84 text run at (0,0) width 302: "This is a font weight test for -apple-system font" 85 RenderBlock {DIV} at (0,18) size 769x18 86 RenderText {#text} at (0,0) size 316x18 87 text run at (0,0) width 316: "This is a font weight test for -apple-system font" 88 RenderBlock {DIV} at (0,36) size 769x18 89 RenderText {#text} at (0,0) size 335x18 90 text run at (0,0) width 335: "This is a font weight test for -apple-system font" 91 RenderBlock {DIV} at (0,54) size 769x18 92 RenderText {#text} at (0,0) size 350x18 93 text run at (0,0) width 350: "This is a font weight test for -apple-system font" 94 RenderBlock {DIV} at (0,72) size 769x18 95 RenderText {#text} at (0,0) size 362x18 96 text run at (0,0) width 362: "This is a font weight test for -apple-system font" 97 RenderBlock {DIV} at (0,90) size 769x18 98 RenderText {#text} at (0,0) size 374x18 99 text run at (0,0) width 374: "This is a font weight test for -apple-system font" 100 RenderBlock {DIV} at (0,108) size 769x18 101 RenderText {#text} at (0,0) size 374x18 102 text run at (0,0) width 374: "This is a font weight test for -apple-system font" 103 RenderBlock {DIV} at (0,126) size 769x18 104 RenderText {#text} at (0,0) size 396x18 105 text run at (0,0) width 396: "This is a font weight test for -apple-system font" 106 RenderBlock {DIV} at (0,144) size 769x18 107 RenderText {#text} at (0,0) size 396x18 108 text run at (0,0) width 396: "This is a font weight test for -apple-system font" 109 RenderBlock {DIV} at (0,1900) size 769x282 82 110 RenderBlock {DIV} at (0,0) size 769x56 83 111 RenderText {#text} at (0,0) size 644x56 -
trunk/LayoutTests/platform/mac/fast/text/systemFont.html
r183662 r183895 25 25 </div> 26 26 <div> 27 <div style="font-family: -apple-system; font-weight: 100">This is a font weight test for -apple-system font</div> 28 <div style="font-family: -apple-system; font-weight: 200">This is a font weight test for -apple-system font</div> 29 <div style="font-family: -apple-system; font-weight: 300">This is a font weight test for -apple-system font</div> 30 <div style="font-family: -apple-system; font-weight: 400">This is a font weight test for -apple-system font</div> 31 <div style="font-family: -apple-system; font-weight: 500">This is a font weight test for -apple-system font</div> 32 <div style="font-family: -apple-system; font-weight: 600">This is a font weight test for -apple-system font</div> 33 <div style="font-family: -apple-system; font-weight: 700">This is a font weight test for -apple-system font</div> 34 <div style="font-family: -apple-system; font-weight: 800">This is a font weight test for -apple-system font</div> 35 <div style="font-family: -apple-system; font-weight: 900">This is a font weight test for -apple-system font</div> 36 </div> 37 <div> 27 38 <div style="font-family: -apple-system-monospaced-numbers; font-size: 24px">This is a test for -apple-system-monospaced-numbers font - 00:11:22:33</div> 28 39 <div style="font: 30.0px '-apple-system-monospaced-numbers'">This is a test for -apple-system-monospaced-numbers font - 00:11:22:33</div> -
trunk/Source/WebCore/ChangeLog
r183894 r183895 1 2015-05-06 Jon Lee <jonlee@apple.com> 2 3 Expose more font weights for -apple-system 4 https://bugs.webkit.org/show_bug.cgi?id=144707 5 6 Reviewed by Dean Jackson. 7 8 Update to platform/mac/fast/text/systemFont.html 9 10 * platform/graphics/mac/FontCacheMac.mm: 11 (WebCore::toNSFontWeight): New static method to map font weights to NSFontWeight constants available on 12 Yosemite and later. 13 (WebCore::fontWithFamily): Request the system font with a mapped weight on Yosemite and later. 14 * platform/spi/mac/NSFontSPI.h: Add [NSFont systemFontWithSize:weight:], and the proper NSFontWeight 15 constants. 16 1 17 2015-05-06 Dean Jackson <dino@apple.com> 2 18 -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r183662 r183895 204 204 } 205 205 206 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 207 static CGFloat toNSFontWeight(FontWeight fontWeight) 208 { 209 static CGFloat nsFontWeights[] = { 210 NSFontWeightUltraLight, // Values between ultra-light and thin are swapped. 211 NSFontWeightThin, 212 NSFontWeightLight, 213 NSFontWeightRegular, 214 NSFontWeightMedium, 215 NSFontWeightSemibold, 216 NSFontWeightBold, 217 NSFontWeightHeavy, 218 NSFontWeightBlack 219 }; 220 return nsFontWeights[fontWeight]; 221 } 222 #endif 223 206 224 // Family name is somewhat of a misnomer here. We first attempt to find an exact match 207 225 // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails … … 211 229 if (equalIgnoringASCIICase(family.string(), String(@"-webkit-system-font")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system-font"))) { 212 230 // We ignore italic for system font. 231 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 232 return [NSFont systemFontOfSize:size weight:toNSFontWeight(weight)]; 233 #else 213 234 return (weight >= FontWeight600) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size]; 235 #endif 214 236 } 215 237 -
trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h
r176112 r183895 26 26 #if USE(APPLE_INTERNAL_SDK) 27 27 28 #import <AppKit/NSFontDescriptor_Private.h> 28 29 #import <AppKit/NSFont_Private.h> 29 30 … … 33 34 + (NSFont *)findFontLike:(NSFont *)aFont forCharacter:(UInt32)c inLanguage:(id) language; 34 35 + (NSFont *)findFontLike:(NSFont *)aFont forString:(NSString *)string withRange:(NSRange)range inLanguage:(id) language; 36 37 + (NSFont *)systemFontOfSize:(CGFloat)size weight:(CGFloat)weight; 35 38 @end 36 39 40 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 41 extern const CGFloat NSFontWeightUltraLight; 42 extern const CGFloat NSFontWeightThin; 43 extern const CGFloat NSFontWeightLight; 44 extern const CGFloat NSFontWeightRegular; 45 extern const CGFloat NSFontWeightMedium; 46 extern const CGFloat NSFontWeightSemibold; 47 extern const CGFloat NSFontWeightBold; 48 extern const CGFloat NSFontWeightHeavy; 49 extern const CGFloat NSFontWeightBlack; 37 50 #endif 51 52 #endif
Note:
See TracChangeset
for help on using the changeset viewer.