<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183895] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183895">183895</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2015-05-06 15:55:09 -0700 (Wed, 06 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Expose more font weights for -apple-system
https://bugs.webkit.org/show_bug.cgi?id=144707
Reviewed by Dean Jackson.
Source/WebCore:
Update to platform/mac/fast/text/systemFont.html
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::toNSFontWeight): New static method to map font weights to NSFontWeight constants available on
Yosemite and later.
(WebCore::fontWithFamily): Request the system font with a mapped weight on Yosemite and later.
* platform/spi/mac/NSFontSPI.h: Add [NSFont systemFontWithSize:weight:], and the proper NSFontWeight
constants.
LayoutTests:
* platform/mac/fast/text/systemFont.html: Update test to include font weights for -apple-system.
* platform/mac/fast/text/systemFont-expected.txt: Update expectations.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttextsystemFontexpectedtxt">trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttextsystemFonthtml">trunk/LayoutTests/platform/mac/fast/text/systemFont.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacNSFontSPIh">trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/LayoutTests/ChangeLog        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-06 Jon Lee <jonlee@apple.com>
+
+ Expose more font weights for -apple-system
+ https://bugs.webkit.org/show_bug.cgi?id=144707
+
+ Reviewed by Dean Jackson.
+
+ * platform/mac/fast/text/systemFont.html: Update test to include font weights for -apple-system.
+ * platform/mac/fast/text/systemFont-expected.txt: Update expectations.
+
</ins><span class="cx"> 2015-05-06 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Handle backdrop views that have to tile
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttextsystemFontexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><del>-layer at (0,0) size 785x2036
</del><ins>+layer at (0,0) size 785x2198
</ins><span class="cx"> RenderView at (0,0) size 785x600
</span><del>-layer at (0,0) size 785x2036
- RenderBlock {HTML} at (0,0) size 785x2036
- RenderBody {BODY} at (8,8) size 769x2020
</del><ins>+layer at (0,0) size 785x2198
+ RenderBlock {HTML} at (0,0) size 785x2198
+ RenderBody {BODY} at (8,8) size 769x2182
</ins><span class="cx"> RenderBlock {DIV} at (0,0) size 769x897
</span><span class="cx"> RenderBlock {DIV} at (0,0) size 769x28
</span><span class="cx"> RenderText {#text} at (0,0) size 438x28
</span><span class="lines">@@ -78,7 +78,35 @@
</span><span class="cx"> RenderText {#text} at (0,0) size 756x170
</span><span class="cx"> text run at (0,0) width 756: "This is a test for -apple-"
</span><span class="cx"> text run at (0,85) width 373: "system font"
</span><del>- RenderBlock {DIV} at (0,1738) size 769x282
</del><ins>+ RenderBlock {DIV} at (0,1738) size 769x162
+ RenderBlock {DIV} at (0,0) size 769x18
+ RenderText {#text} at (0,0) size 302x18
+ text run at (0,0) width 302: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,18) size 769x18
+ RenderText {#text} at (0,0) size 316x18
+ text run at (0,0) width 316: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,36) size 769x18
+ RenderText {#text} at (0,0) size 335x18
+ text run at (0,0) width 335: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,54) size 769x18
+ RenderText {#text} at (0,0) size 350x18
+ text run at (0,0) width 350: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,72) size 769x18
+ RenderText {#text} at (0,0) size 362x18
+ text run at (0,0) width 362: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,90) size 769x18
+ RenderText {#text} at (0,0) size 374x18
+ text run at (0,0) width 374: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,108) size 769x18
+ RenderText {#text} at (0,0) size 374x18
+ text run at (0,0) width 374: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,126) size 769x18
+ RenderText {#text} at (0,0) size 396x18
+ text run at (0,0) width 396: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,144) size 769x18
+ RenderText {#text} at (0,0) size 396x18
+ text run at (0,0) width 396: "This is a font weight test for -apple-system font"
+ RenderBlock {DIV} at (0,1900) size 769x282
</ins><span class="cx"> RenderBlock {DIV} at (0,0) size 769x56
</span><span class="cx"> RenderText {#text} at (0,0) size 644x56
</span><span class="cx"> text run at (0,0) width 644: "This is a test for -apple-system-monospaced-numbers font -"
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttextsystemFonthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont.html (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/systemFont.html        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont.html        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -24,6 +24,17 @@
</span><span class="cx"> <div style="font-family: -apple-system; font-size: 72px">This is a test for -apple-system font</div>
</span><span class="cx"> </div>
</span><span class="cx"> <div>
</span><ins>+ <div style="font-family: -apple-system; font-weight: 100">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 200">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 300">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 400">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 500">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 600">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 700">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 800">This is a font weight test for -apple-system font</div>
+ <div style="font-family: -apple-system; font-weight: 900">This is a font weight test for -apple-system font</div>
+ </div>
+ <div>
</ins><span class="cx"> <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>
</span><span class="cx"> <div style="font: 30.0px '-apple-system-monospaced-numbers'">This is a test for -apple-system-monospaced-numbers font - 00:11:22:33</div>
</span><span class="cx"> <div style="font-family: -apple-system-monospaced-numbers; font-size: 30px">This is a test for -apple-system-monospaced-numbers font - 00:11:22:33</div>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/Source/WebCore/ChangeLog        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-05-06 Jon Lee <jonlee@apple.com>
+
+ Expose more font weights for -apple-system
+ https://bugs.webkit.org/show_bug.cgi?id=144707
+
+ Reviewed by Dean Jackson.
+
+ Update to platform/mac/fast/text/systemFont.html
+
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::toNSFontWeight): New static method to map font weights to NSFontWeight constants available on
+ Yosemite and later.
+ (WebCore::fontWithFamily): Request the system font with a mapped weight on Yosemite and later.
+ * platform/spi/mac/NSFontSPI.h: Add [NSFont systemFontWithSize:weight:], and the proper NSFontWeight
+ constants.
+
</ins><span class="cx"> 2015-05-06 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Handle backdrop views that have to tile
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -203,6 +203,24 @@
</span><span class="cx"> return appKitFontWeights[fontWeight];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+static CGFloat toNSFontWeight(FontWeight fontWeight)
+{
+ static CGFloat nsFontWeights[] = {
+ NSFontWeightUltraLight, // Values between ultra-light and thin are swapped.
+ NSFontWeightThin,
+ NSFontWeightLight,
+ NSFontWeightRegular,
+ NSFontWeightMedium,
+ NSFontWeightSemibold,
+ NSFontWeightBold,
+ NSFontWeightHeavy,
+ NSFontWeightBlack
+ };
+ return nsFontWeights[fontWeight];
+}
+#endif
+
</ins><span class="cx"> // Family name is somewhat of a misnomer here. We first attempt to find an exact match
</span><span class="cx"> // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
</span><span class="cx"> // we then do a search based on the family names of the installed fonts.
</span><span class="lines">@@ -210,7 +228,11 @@
</span><span class="cx"> {
</span><span class="cx"> if (equalIgnoringASCIICase(family.string(), String(@"-webkit-system-font")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system-font"))) {
</span><span class="cx"> // We ignore italic for system font.
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ return [NSFont systemFontOfSize:size weight:toNSFontWeight(weight)];
+#else
</ins><span class="cx"> return (weight >= FontWeight600) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (equalIgnoringASCIICase(family.string(), String(@"-apple-system-monospaced-numbers"))) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacNSFontSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h (183894 => 183895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h        2015-05-06 22:46:01 UTC (rev 183894)
+++ trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h        2015-05-06 22:55:09 UTC (rev 183895)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx">
</span><ins>+#import <AppKit/NSFontDescriptor_Private.h>
</ins><span class="cx"> #import <AppKit/NSFont_Private.h>
</span><span class="cx">
</span><span class="cx"> #else
</span><span class="lines">@@ -32,6 +33,20 @@
</span><span class="cx"> @interface NSFont (Private)
</span><span class="cx"> + (NSFont *)findFontLike:(NSFont *)aFont forCharacter:(UInt32)c inLanguage:(id) language;
</span><span class="cx"> + (NSFont *)findFontLike:(NSFont *)aFont forString:(NSString *)string withRange:(NSRange)range inLanguage:(id) language;
</span><ins>+
++ (NSFont *)systemFontOfSize:(CGFloat)size weight:(CGFloat)weight;
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+extern const CGFloat NSFontWeightUltraLight;
+extern const CGFloat NSFontWeightThin;
+extern const CGFloat NSFontWeightLight;
+extern const CGFloat NSFontWeightRegular;
+extern const CGFloat NSFontWeightMedium;
+extern const CGFloat NSFontWeightSemibold;
+extern const CGFloat NSFontWeightBold;
+extern const CGFloat NSFontWeightHeavy;
+extern const CGFloat NSFontWeightBlack;
</ins><span class="cx"> #endif
</span><ins>+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>