<!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>[188795] trunk/Source/WebCore</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/188795">188795</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-08-21 16:28:08 -0700 (Fri, 21 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] Unify two more FontCache functions
https://bugs.webkit.org/show_bug.cgi?id=148217

Reviewed by Dean Jackson.

Move duplicated code from FontCacheMac and FontCacheIOS into
FontCacheCoreText.

No new tests because there is no behavior change.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::toTraitsMask):
(WebCore::isFontWeightBold):
(WebCore::FontCache::similarFont):
(WebCore::FontCache::getTraitsInFamily):
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::FontCache::similarFont): Deleted.
(WebCore::toTraitsMask): Deleted.
(WebCore::FontCache::getTraitsInFamily): Deleted.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::toTraitsMask): Deleted.
(WebCore::FontCache::similarFont): Deleted.
(WebCore::FontCache::getTraitsInFamily): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCacheh">trunk/Source/WebCore/platform/graphics/FontCache.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCacheCoreTextcpp">trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosFontCacheIOSmm">trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188794 => 188795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-21 23:16:48 UTC (rev 188794)
+++ trunk/Source/WebCore/ChangeLog        2015-08-21 23:28:08 UTC (rev 188795)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-08-21  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Unify two more FontCache functions
+        https://bugs.webkit.org/show_bug.cgi?id=148217
+
+        Reviewed by Dean Jackson.
+
+        Move duplicated code from FontCacheMac and FontCacheIOS into
+        FontCacheCoreText.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::toTraitsMask):
+        (WebCore::isFontWeightBold):
+        (WebCore::FontCache::similarFont):
+        (WebCore::FontCache::getTraitsInFamily):
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::FontCache::similarFont): Deleted.
+        (WebCore::toTraitsMask): Deleted.
+        (WebCore::FontCache::getTraitsInFamily): Deleted.
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::toTraitsMask): Deleted.
+        (WebCore::FontCache::similarFont): Deleted.
+        (WebCore::FontCache::getTraitsInFamily): Deleted.
+
</ins><span class="cx"> 2015-08-21  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Stop using the old callOnMainThread variant on Windows
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (188794 => 188795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCache.h        2015-08-21 23:16:48 UTC (rev 188794)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h        2015-08-21 23:28:08 UTC (rev 188795)
</span><span class="lines">@@ -164,6 +164,8 @@
</span><span class="cx">     static IMultiLanguage* getMultiLanguageInterface();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    // This function exists so CSSFontSelector can have a unified notion of preinstalled fonts and @font-face.
+    // It comes into play when you create an @font-face which shares a family name as a preinstalled font.
</ins><span class="cx">     void getTraitsInFamily(const AtomicString&amp;, Vector&lt;unsigned&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT RefPtr&lt;Font&gt; fontForFamily(const FontDescription&amp;, const AtomicString&amp;, bool checkingAlternateName = false);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCacheCoreTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (188794 => 188795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp        2015-08-21 23:16:48 UTC (rev 188794)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp        2015-08-21 23:28:08 UTC (rev 188795)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> #include &quot;FontCache.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CoreTextSPI.h&quot;
</span><ins>+#include &quot;Font.h&quot;
+
</ins><span class="cx"> #include &lt;CoreText/SFNTLayoutTypes.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="lines">@@ -161,4 +163,106 @@
</span><span class="cx">     return adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline FontTraitsMask toTraitsMask(CTFontSymbolicTraits ctFontTraits, CGFloat weight)
+{
+    FontTraitsMask weightMask = FontWeight100Mask;
+    if (weight &lt; -0.6)
+        weightMask = FontWeight100Mask;
+    else if (weight &lt; -0.365)
+        weightMask = FontWeight200Mask;
+    else if (weight &lt; -0.115)
+        weightMask = FontWeight300Mask;
+    else if (weight &lt;  0.130)
+        weightMask = FontWeight400Mask;
+    else if (weight &lt;  0.235)
+        weightMask = FontWeight500Mask;
+    else if (weight &lt;  0.350)
+        weightMask = FontWeight600Mask;
+    else if (weight &lt;  0.500)
+        weightMask = FontWeight700Mask;
+    else if (weight &lt;  0.700)
+        weightMask = FontWeight800Mask;
+    else
+        weightMask = FontWeight900Mask;
+    return static_cast&lt;FontTraitsMask&gt;(((ctFontTraits &amp; kCTFontTraitItalic) ? FontStyleItalicMask : FontStyleNormalMask)
+        | FontVariantNormalMask | weightMask);
</ins><span class="cx"> }
</span><ins>+
+static inline bool isFontWeightBold(FontWeight fontWeight)
+{
+    return fontWeight &gt;= FontWeight600;
+}
+
+RefPtr&lt;Font&gt; FontCache::similarFont(const FontDescription&amp; description)
+{
+    // Attempt to find an appropriate font using a match based on the presence of keywords in
+    // the requested names. For example, we'll match any name that contains &quot;Arabic&quot; to Geeza Pro.
+    RefPtr&lt;Font&gt; font;
+    for (unsigned i = 0; i &lt; description.familyCount(); ++i) {
+        const AtomicString&amp; family = description.familyAt(i);
+        if (family.isEmpty())
+            continue;
+
+#if PLATFORM(IOS)
+        // Substitute the default monospace font for well-known monospace fonts.
+        static NeverDestroyed&lt;AtomicString&gt; monaco(&quot;monaco&quot;, AtomicString::ConstructFromLiteral);
+        static NeverDestroyed&lt;AtomicString&gt; menlo(&quot;menlo&quot;, AtomicString::ConstructFromLiteral);
+        static NeverDestroyed&lt;AtomicString&gt; courier(&quot;courier&quot;, AtomicString::ConstructFromLiteral);
+        if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
+            font = fontForFamily(description, courier);
+            continue;
+        }
+
+        // Substitute Verdana for Lucida Grande.
+        static NeverDestroyed&lt;AtomicString&gt; lucidaGrande(&quot;lucida grande&quot;, AtomicString::ConstructFromLiteral);
+        static NeverDestroyed&lt;AtomicString&gt; verdana(&quot;verdana&quot;, AtomicString::ConstructFromLiteral);
+        if (equalIgnoringCase(family, lucidaGrande)) {
+            font = fontForFamily(description, verdana);
+            continue;
+        }
+#endif
+
+        static NeverDestroyed&lt;String&gt; arabic(ASCIILiteral(&quot;Arabic&quot;));
+        static NeverDestroyed&lt;String&gt; pashto(ASCIILiteral(&quot;Pashto&quot;));
+        static NeverDestroyed&lt;String&gt; urdu(ASCIILiteral(&quot;Urdu&quot;));
+        static String* matchWords[3] = { &amp;arabic.get(), &amp;pashto.get(), &amp;urdu.get() };
+        static NeverDestroyed&lt;AtomicString&gt; geezaPlain(&quot;GeezaPro&quot;, AtomicString::ConstructFromLiteral);
+        static NeverDestroyed&lt;AtomicString&gt; geezaBold(&quot;GeezaPro-Bold&quot;, AtomicString::ConstructFromLiteral);
+        for (String* matchWord : matchWords) {
+            if (family.contains(*matchWord, false))
+                font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
+        }
+    }
+
+    return font.release();
+}
+
+void FontCache::getTraitsInFamily(const AtomicString&amp; familyName, Vector&lt;unsigned&gt;&amp; traitsMasks)
+{
+    RetainPtr&lt;CFStringRef&gt; familyNameStr = familyName.string().createCFString();
+    CFStringRef familyNameStrPtr = familyNameStr.get();
+    RetainPtr&lt;CFDictionaryRef&gt; attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&amp;kCTFontFamilyNameAttribute, (const void**)&amp;familyNameStrPtr, 1, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
+    RetainPtr&lt;CTFontDescriptorRef&gt; fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
+    RetainPtr&lt;CFArrayRef&gt; matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr));
+    if (!matchedDescriptors)
+        return;
+
+    CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get());
+    if (!numMatches)
+        return;
+
+    for (CFIndex i = 0; i &lt; numMatches; ++i) {
+        RetainPtr&lt;CFDictionaryRef&gt; traits = adoptCF((CFDictionaryRef)CTFontDescriptorCopyAttribute((CTFontDescriptorRef)CFArrayGetValueAtIndex(matchedDescriptors.get(), i), kCTFontTraitsAttribute));
+        CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait);
+        CFNumberRef weightRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
+        if (resultRef &amp;&amp; weightRef) {
+            CTFontSymbolicTraits symbolicTraits;
+            CFNumberGetValue(resultRef, kCFNumberIntType, &amp;symbolicTraits);
+            CGFloat weight = 0;
+            CFNumberGetValue(weightRef, kCFNumberCGFloatType, &amp;weight);
+            traitsMasks.append(toTraitsMask(symbolicTraits, weight));
+        }
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosFontCacheIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (188794 => 188795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2015-08-21 23:16:48 UTC (rev 188794)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2015-08-21 23:28:08 UTC (rev 188795)
</span><span class="lines">@@ -150,48 +150,6 @@
</span><span class="cx">     return fontFamilies;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Font&gt; FontCache::similarFont(const FontDescription&amp; description)
-{
-    // Attempt to find an appropriate font using a match based on the presence of keywords in
-    // the requested names. For example, we'll match any name that contains &quot;Arabic&quot; to Geeza Pro.
-    RefPtr&lt;Font&gt; font;
-    for (unsigned i = 0; i &lt; description.familyCount(); ++i) {
-        const AtomicString&amp; family = description.familyAt(i);
-        if (family.isEmpty())
-            continue;
-
-        // Substitute the default monospace font for well-known monospace fonts.
-        static NeverDestroyed&lt;AtomicString&gt; monaco(&quot;monaco&quot;, AtomicString::ConstructFromLiteral);
-        static NeverDestroyed&lt;AtomicString&gt; menlo(&quot;menlo&quot;, AtomicString::ConstructFromLiteral);
-        static NeverDestroyed&lt;AtomicString&gt; courier(&quot;courier&quot;, AtomicString::ConstructFromLiteral);
-        if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
-            font = fontForFamily(description, courier);
-            continue;
-        }
-
-        // Substitute Verdana for Lucida Grande.
-        static NeverDestroyed&lt;AtomicString&gt; lucidaGrande(&quot;lucida grande&quot;, AtomicString::ConstructFromLiteral);
-        static NeverDestroyed&lt;AtomicString&gt; verdana(&quot;verdana&quot;, AtomicString::ConstructFromLiteral);
-        if (equalIgnoringCase(family, lucidaGrande)) {
-            font = fontForFamily(description, verdana);
-            continue;
-        }
-
-        static NeverDestroyed&lt;String&gt; arabic(ASCIILiteral(&quot;Arabic&quot;));
-        static NeverDestroyed&lt;String&gt; pashto(ASCIILiteral(&quot;Pashto&quot;));
-        static NeverDestroyed&lt;String&gt; urdu(ASCIILiteral(&quot;Urdu&quot;));
-        static String* matchWords[3] = { &amp;arabic.get(), &amp;pashto.get(), &amp;urdu.get() };
-        static NeverDestroyed&lt;AtomicString&gt; geezaPlain(&quot;GeezaPro&quot;, AtomicString::ConstructFromLiteral);
-        static NeverDestroyed&lt;AtomicString&gt; geezaBold(&quot;GeezaPro-Bold&quot;, AtomicString::ConstructFromLiteral);
-        for (unsigned j = 0; j &lt; 3 &amp;&amp; !font; ++j) {
-            if (family.contains(*matchWords[j], false))
-                font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
-        }
-    }
-
-    return font.release();
-}
-
</del><span class="cx"> Ref&lt;Font&gt; FontCache::lastResortFallbackFont(const FontDescription&amp; fontDescription)
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;AtomicString&gt; fallbackFontFamily(&quot;.PhoneFallback&quot;, AtomicString::ConstructFromLiteral);
</span><span class="lines">@@ -227,37 +185,6 @@
</span><span class="cx">     return getCachedFontPlatformData(description, *family);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline FontTraitsMask toTraitsMask(CTFontSymbolicTraits ctFontTraits)
-{
-    return static_cast&lt;FontTraitsMask&gt;(((ctFontTraits &amp; kCTFontTraitItalic) ? FontStyleItalicMask : FontStyleNormalMask)
-        | FontVariantNormalMask
-        // FontWeight600 or higher is bold for CTFonts, so choose middle values for
-        // bold (600-900) and non-bold (100-500)
-        | ((ctFontTraits &amp; kCTFontTraitBold) ? FontWeight700Mask : FontWeight300Mask));
-}
-
-void FontCache::getTraitsInFamily(const AtomicString&amp; familyName, Vector&lt;unsigned&gt;&amp; traitsMasks)
-{
-    RetainPtr&lt;CFStringRef&gt; familyNameStr = familyName.string().createCFString();
-    NSDictionary *attributes = @{ (id)kCTFontFamilyNameAttribute: (NSString*)familyNameStr.get() };
-    RetainPtr&lt;CTFontDescriptorRef&gt; fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes));
-    RetainPtr&lt;NSArray&gt; matchedDescriptors = adoptNS((NSArray *)CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr));
-
-    NSInteger numMatches = [matchedDescriptors.get() count];
-    if (!matchedDescriptors || !numMatches)
-        return;
-
-    for (NSInteger i = 0; i &lt; numMatches; ++i) {
-        RetainPtr&lt;CFDictionaryRef&gt; traits = adoptCF((CFDictionaryRef)CTFontDescriptorCopyAttribute((CTFontDescriptorRef)[matchedDescriptors.get() objectAtIndex:i], kCTFontTraitsAttribute));
-        CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait);
-        if (resultRef) {
-            CTFontSymbolicTraits symbolicTraits;
-            CFNumberGetValue(resultRef, kCFNumberIntType, &amp;symbolicTraits);
-            traitsMasks.append(toTraitsMask(symbolicTraits));
-        }
-    }
-}
-
</del><span class="cx"> float FontCache::weightOfCTFont(CTFontRef font)
</span><span class="cx"> {
</span><span class="cx">     float result = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (188794 => 188795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-08-21 23:16:48 UTC (rev 188794)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-08-21 23:28:08 UTC (rev 188795)
</span><span class="lines">@@ -114,21 +114,6 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-static inline FontTraitsMask toTraitsMask(NSFontTraitMask appKitTraits, NSInteger appKitWeight)
-{
-    return static_cast&lt;FontTraitsMask&gt;(((appKitTraits &amp; NSFontItalicTrait) ? FontStyleItalicMask : FontStyleNormalMask)
-        | FontVariantNormalMask
-        | (appKitWeight == 1 ? FontWeight100Mask :
-            appKitWeight == 2 ? FontWeight200Mask :
-            appKitWeight &lt;= 4 ? FontWeight300Mask :
-            appKitWeight == 5 ? FontWeight400Mask :
-            appKitWeight == 6 ? FontWeight500Mask :
-            appKitWeight &lt;= 8 ? FontWeight600Mask :
-            appKitWeight == 9 ? FontWeight700Mask :
-            appKitWeight &lt;= 11 ? FontWeight800Mask :
-                FontWeight900Mask));
-}
-
</del><span class="cx"> #if !ENABLE(PLATFORM_FONT_LOOKUP)
</span><span class="cx"> // Keep a cache for mapping desired font families to font families actually available on the system for performance.
</span><span class="cx"> using AvailableFamilyMap = HashMap&lt;std::pair&lt;AtomicString, NSFontTraitMask&gt;, AtomicString&gt;;
</span><span class="lines">@@ -607,26 +592,6 @@
</span><span class="cx">     return fontFamilies;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Font&gt; FontCache::similarFont(const FontDescription&amp; description)
-{
-    // Attempt to find an appropriate font using a match based on 
-    // the presence of keywords in the the requested names.  For example, we'll
-    // match any name that contains &quot;Arabic&quot; to Geeza Pro.
-    RefPtr&lt;Font&gt; font;
-    for (unsigned i = 0; i &lt; description.familyCount(); ++i) {
-        const AtomicString&amp; family = description.familyAt(i);
-        if (family.isEmpty())
-            continue;
-        static String* matchWords[3] = { new String(&quot;Arabic&quot;), new String(&quot;Pashto&quot;), new String(&quot;Urdu&quot;) };
-        DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, geezaStr, (&quot;Geeza Pro&quot;, AtomicString::ConstructFromLiteral));
-        for (unsigned j = 0; j &lt; 3 &amp;&amp; !font; ++j) {
-            if (family.contains(*matchWords[j], false))
-                font = fontForFamily(description, geezaStr);
-        }
-    }
-    return font.release();
-}
-
</del><span class="cx"> Ref&lt;Font&gt; FontCache::lastResortFallbackFont(const FontDescription&amp; fontDescription)
</span><span class="cx"> {
</span><span class="cx">     DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, timesStr, (&quot;Times&quot;, AtomicString::ConstructFromLiteral));
</span><span class="lines">@@ -645,39 +610,6 @@
</span><span class="cx">     return *fontForFamily(fontDescription, lucidaGrandeStr, false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCache::getTraitsInFamily(const AtomicString&amp; familyName, Vector&lt;unsigned&gt;&amp; traitsMasks)
-{
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-
-    NSString *availableFamily;
-    for (availableFamily in [fontManager availableFontFamilies]) {
-        if ([familyName caseInsensitiveCompare:availableFamily] == NSOrderedSame)
-            break;
-    }
-
-    if (!availableFamily) {
-        // Match by PostScript name.
-        for (NSString *availableFont in [fontManager availableFonts]) {
-            if ([familyName caseInsensitiveCompare:availableFont] == NSOrderedSame) {
-                NSFont *font = [NSFont fontWithName:availableFont size:10];
-                NSInteger weight = [fontManager weightOfFont:font];
-                traitsMasks.append(toTraitsMask([fontManager traitsOfFont:font], weight));
-                break;
-            }
-        }
-        return;
-    }
-
-    NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
-    traitsMasks.reserveCapacity([fonts count]);
-    for (NSArray *fontInfo in fonts) {
-        // Array indices must be hard coded because of lame AppKit API.
-        NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
-        NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
-        traitsMasks.uncheckedAppend(toTraitsMask(fontTraits, fontWeight));
-    }
-}
-
</del><span class="cx"> std::unique_ptr&lt;FontPlatformData&gt; FontCache::createFontPlatformData(const FontDescription&amp; fontDescription, const AtomicString&amp; family)
</span><span class="cx"> {
</span><span class="cx">     NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0;
</span></span></pre>
</div>
</div>

</body>
</html>