RESOLVED FIXED 147033
Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
https://bugs.webkit.org/show_bug.cgi?id=147033
Summary Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
Devin Rousso
Reported 2015-07-16 23:51:57 PDT
This will be really useful for a font picker and for autocompletion. See https://bugs.webkit.org/show_bug.cgi?id=147009 for more details.
Attachments
Patch (2.73 KB, patch)
2015-07-31 18:10 PDT, Devin Rousso
no flags
Patch (2.44 KB, patch)
2015-08-07 21:06 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2015-07-16 23:52:15 PDT
Devin Rousso
Comment 2 2015-07-31 18:10:10 PDT
Joseph Pecoraro
Comment 3 2015-07-31 18:28:17 PDT
Comment on attachment 257985 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257985&action=review r=me, but should probably get a nod from Myles. > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:471 > + NSDictionary *attributes = @{ }; > + RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes)); You can just inline this dictionary. > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:472 > + RetainPtr<NSArray> matchedDescriptors = adoptNS((NSArray *)CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr)); Nit: static_cast. Also, both of these can be "auto", the type is relatively easy to determine. > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:474 > + NSInteger numMatches = [matchedDescriptors.get() count]; Style: I actually think the ".git()" is unnecessary here. It should just work without it. > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:480 > + RetainPtr<CFStringRef> familyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute((CTFontDescriptorRef)[matchedDescriptors.get() objectAtIndex:i], kCTFontFamilyNameAttribute))); Nit: static_cast. You can split this out into a couple lines to be more readable. Could also be auto given the CFStringRef cast will be on the line anyways.
Myles C. Maxfield
Comment 4 2015-07-31 20:55:18 PDT
Comment on attachment 257985 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257985&action=review >> Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:480 >> + RetainPtr<CFStringRef> familyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute((CTFontDescriptorRef)[matchedDescriptors.get() objectAtIndex:i], kCTFontFamilyNameAttribute))); > > Nit: static_cast. You can split this out into a couple lines to be more readable. Could also be auto given the CFStringRef cast will be on the line anyways. Why are you using CF* here when everywhere else you are using NS*? > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:488 > + if (familyName.startsWith('.')) Please move this check into the loop above. > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:489 > + continue; I'm not sure this line will ever be hit. CT may not ever return these period-prefixed font names. It's worth checking (even on older operating systems)
Devin Rousso
Comment 5 2015-08-07 21:06:40 PDT
Joseph Pecoraro
Comment 6 2015-08-10 11:30:34 PDT
Comment on attachment 258558 [details] Patch r=me
WebKit Commit Bot
Comment 7 2015-08-10 13:51:51 PDT
Comment on attachment 258558 [details] Patch Clearing flags on attachment: 258558 Committed r188227: <http://trac.webkit.org/changeset/188227>
WebKit Commit Bot
Comment 8 2015-08-10 13:51:57 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.