<!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 <mmaxfield@apple.com>
+
+ [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 <andersca@apple.com>
</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&, Vector<unsigned>&);
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT RefPtr<Font> fontForFamily(const FontDescription&, const AtomicString&, 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 "FontCache.h"
</span><span class="cx">
</span><span class="cx"> #include "CoreTextSPI.h"
</span><ins>+#include "Font.h"
+
</ins><span class="cx"> #include <CoreText/SFNTLayoutTypes.h>
</span><span class="cx">
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</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 < -0.6)
+ weightMask = FontWeight100Mask;
+ else if (weight < -0.365)
+ weightMask = FontWeight200Mask;
+ else if (weight < -0.115)
+ weightMask = FontWeight300Mask;
+ else if (weight < 0.130)
+ weightMask = FontWeight400Mask;
+ else if (weight < 0.235)
+ weightMask = FontWeight500Mask;
+ else if (weight < 0.350)
+ weightMask = FontWeight600Mask;
+ else if (weight < 0.500)
+ weightMask = FontWeight700Mask;
+ else if (weight < 0.700)
+ weightMask = FontWeight800Mask;
+ else
+ weightMask = FontWeight900Mask;
+ return static_cast<FontTraitsMask>(((ctFontTraits & kCTFontTraitItalic) ? FontStyleItalicMask : FontStyleNormalMask)
+ | FontVariantNormalMask | weightMask);
</ins><span class="cx"> }
</span><ins>+
+static inline bool isFontWeightBold(FontWeight fontWeight)
+{
+ return fontWeight >= FontWeight600;
+}
+
+RefPtr<Font> FontCache::similarFont(const FontDescription& 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 "Arabic" to Geeza Pro.
+ RefPtr<Font> font;
+ for (unsigned i = 0; i < description.familyCount(); ++i) {
+ const AtomicString& family = description.familyAt(i);
+ if (family.isEmpty())
+ continue;
+
+#if PLATFORM(IOS)
+ // Substitute the default monospace font for well-known monospace fonts.
+ static NeverDestroyed<AtomicString> monaco("monaco", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> menlo("menlo", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
+ if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
+ font = fontForFamily(description, courier);
+ continue;
+ }
+
+ // Substitute Verdana for Lucida Grande.
+ static NeverDestroyed<AtomicString> lucidaGrande("lucida grande", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
+ if (equalIgnoringCase(family, lucidaGrande)) {
+ font = fontForFamily(description, verdana);
+ continue;
+ }
+#endif
+
+ static NeverDestroyed<String> arabic(ASCIILiteral("Arabic"));
+ static NeverDestroyed<String> pashto(ASCIILiteral("Pashto"));
+ static NeverDestroyed<String> urdu(ASCIILiteral("Urdu"));
+ static String* matchWords[3] = { &arabic.get(), &pashto.get(), &urdu.get() };
+ static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> geezaBold("GeezaPro-Bold", 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& familyName, Vector<unsigned>& traitsMasks)
+{
+ RetainPtr<CFStringRef> familyNameStr = familyName.string().createCFString();
+ CFStringRef familyNameStrPtr = familyNameStr.get();
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontFamilyNameAttribute, (const void**)&familyNameStrPtr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
+ RetainPtr<CFArrayRef> matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr));
+ if (!matchedDescriptors)
+ return;
+
+ CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get());
+ if (!numMatches)
+ return;
+
+ for (CFIndex i = 0; i < numMatches; ++i) {
+ RetainPtr<CFDictionaryRef> 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 && weightRef) {
+ CTFontSymbolicTraits symbolicTraits;
+ CFNumberGetValue(resultRef, kCFNumberIntType, &symbolicTraits);
+ CGFloat weight = 0;
+ CFNumberGetValue(weightRef, kCFNumberCGFloatType, &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<Font> FontCache::similarFont(const FontDescription& 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 "Arabic" to Geeza Pro.
- RefPtr<Font> font;
- for (unsigned i = 0; i < description.familyCount(); ++i) {
- const AtomicString& family = description.familyAt(i);
- if (family.isEmpty())
- continue;
-
- // Substitute the default monospace font for well-known monospace fonts.
- static NeverDestroyed<AtomicString> monaco("monaco", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> menlo("menlo", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
- if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
- font = fontForFamily(description, courier);
- continue;
- }
-
- // Substitute Verdana for Lucida Grande.
- static NeverDestroyed<AtomicString> lucidaGrande("lucida grande", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
- if (equalIgnoringCase(family, lucidaGrande)) {
- font = fontForFamily(description, verdana);
- continue;
- }
-
- static NeverDestroyed<String> arabic(ASCIILiteral("Arabic"));
- static NeverDestroyed<String> pashto(ASCIILiteral("Pashto"));
- static NeverDestroyed<String> urdu(ASCIILiteral("Urdu"));
- static String* matchWords[3] = { &arabic.get(), &pashto.get(), &urdu.get() };
- static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> geezaBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral);
- for (unsigned j = 0; j < 3 && !font; ++j) {
- if (family.contains(*matchWords[j], false))
- font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
- }
- }
-
- return font.release();
-}
-
</del><span class="cx"> Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<AtomicString> fallbackFontFamily(".PhoneFallback", 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<FontTraitsMask>(((ctFontTraits & 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 & kCTFontTraitBold) ? FontWeight700Mask : FontWeight300Mask));
-}
-
-void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
-{
- RetainPtr<CFStringRef> familyNameStr = familyName.string().createCFString();
- NSDictionary *attributes = @{ (id)kCTFontFamilyNameAttribute: (NSString*)familyNameStr.get() };
- RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes));
- RetainPtr<NSArray> matchedDescriptors = adoptNS((NSArray *)CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr));
-
- NSInteger numMatches = [matchedDescriptors.get() count];
- if (!matchedDescriptors || !numMatches)
- return;
-
- for (NSInteger i = 0; i < numMatches; ++i) {
- RetainPtr<CFDictionaryRef> traits = adoptCF((CFDictionaryRef)CTFontDescriptorCopyAttribute((CTFontDescriptorRef)[matchedDescriptors.get() objectAtIndex:i], kCTFontTraitsAttribute));
- CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait);
- if (resultRef) {
- CTFontSymbolicTraits symbolicTraits;
- CFNumberGetValue(resultRef, kCFNumberIntType, &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<FontTraitsMask>(((appKitTraits & NSFontItalicTrait) ? FontStyleItalicMask : FontStyleNormalMask)
- | FontVariantNormalMask
- | (appKitWeight == 1 ? FontWeight100Mask :
- appKitWeight == 2 ? FontWeight200Mask :
- appKitWeight <= 4 ? FontWeight300Mask :
- appKitWeight == 5 ? FontWeight400Mask :
- appKitWeight == 6 ? FontWeight500Mask :
- appKitWeight <= 8 ? FontWeight600Mask :
- appKitWeight == 9 ? FontWeight700Mask :
- appKitWeight <= 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<std::pair<AtomicString, NSFontTraitMask>, AtomicString>;
</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<Font> FontCache::similarFont(const FontDescription& 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 "Arabic" to Geeza Pro.
- RefPtr<Font> font;
- for (unsigned i = 0; i < description.familyCount(); ++i) {
- const AtomicString& family = description.familyAt(i);
- if (family.isEmpty())
- continue;
- static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
- DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral));
- for (unsigned j = 0; j < 3 && !font; ++j) {
- if (family.contains(*matchWords[j], false))
- font = fontForFamily(description, geezaStr);
- }
- }
- return font.release();
-}
-
</del><span class="cx"> Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
</span><span class="cx"> {
</span><span class="cx"> DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times", 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& familyName, Vector<unsigned>& 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<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
</span><span class="cx"> {
</span><span class="cx"> NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0;
</span></span></pre>
</div>
</div>
</body>
</html>