Title: [193440] branches/safari-601.1.46-branch/Source/WebCore
Revision
193440
Author
timo...@apple.com
Date
2015-12-04 12:51:31 -0800 (Fri, 04 Dec 2015)

Log Message

Merge r188227. rdar://problem/23581597

Modified Paths

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193439 => 193440)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-04 20:51:26 UTC (rev 193439)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-04 20:51:31 UTC (rev 193440)
@@ -1,5 +1,21 @@
 2015-12-04  Timothy Hatcher  <timo...@apple.com>
 
+        Merge r188227. rdar://problem/23581597
+
+    2015-08-10  Devin Rousso  <drou...@apple.com>
+
+            Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
+            https://bugs.webkit.org/show_bug.cgi?id=147033
+
+            Reviewed by Joseph Pecoraro.
+
+            Implement systemFontFamilies for iOS.
+
+            * platform/graphics/ios/FontCacheIOS.mm:
+            (WebCore::FontCache::systemFontFamilies):
+
+2015-12-04  Timothy Hatcher  <timo...@apple.com>
+
         Merge r187249. rdar://problem/23581597
 
     2015-07-23  Devin Rousso  <drou...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (193439 => 193440)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-12-04 20:51:26 UTC (rev 193439)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-12-04 20:51:31 UTC (rev 193440)
@@ -33,6 +33,7 @@
 #import "CoreTextSPI.h"
 #import "FontCascade.h"
 #import "RenderThemeIOS.h"
+#import <wtf/HashSet.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/text/CString.h>
@@ -464,8 +465,25 @@
 
 Vector<String> FontCache::systemFontFamilies()
 {
-    // FIXME: <https://webkit.org/b/147033> Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
+    // FIXME: <rdar://problem/21890188>
     Vector<String> fontFamilies;
+    auto emptyFontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes((CFDictionaryRef) @{ }));
+    auto matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(emptyFontDescriptor.get(), nullptr));
+    if (!matchedDescriptors)
+        return fontFamilies;
+
+    CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get());
+    if (!numMatches)
+        return fontFamilies;
+
+    HashSet<String> visited;
+    for (CFIndex i = 0; i < numMatches; ++i) {
+        auto fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matchedDescriptors.get(), i));
+        if (auto familyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute))))
+            visited.add(familyName.get());
+    }
+
+    copyToVector(visited, fontFamilies);
     return fontFamilies;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to