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.
<rdar://problem/21863018>
I think we'll need to use FcFontList: """ FcFontSet * FcFontList(FcConfig *config, FcPattern *p, FcObjectSet *os); Selects fonts matching p, creates patterns from those fonts containing only the objects in os and returns the set of unique such patterns. If config is NULL, the default configuration is checked to be up to date, and used. """ Maybe someone with more endurance for fontconfig could translate that to English....
Forgot the link: http://www.freedesktop.org/software/fontconfig/fontconfig-devel/fcfontlist.html
Created attachment 257724 [details] Patch
Created attachment 257725 [details] Patch
Comment on attachment 257725 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257725&action=review > Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp:105 > +static Vector<String> patternToFamilies(const FcPattern& pattern) > +{ > + char* patternChars = reinterpret_cast<char*>(FcPatternFormat( > + const_cast<FcPattern*>(&pattern), > + reinterpret_cast<const FcChar8*>("%{family}"))); I think it's more convenient to pass the pointer here, since it's what you need and you don't need more ugly casts. This is a private static function after all.
(In reply to comment #6) > I think it's more convenient to pass the pointer here, since it's what you > need and you don't need more ugly casts. This is a private static function > after all. Yeah... I will just remove the const though, then no cast is needed.
Created attachment 257748 [details] Patch
Comment on attachment 257748 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257748&action=review The LayoutTests changes look good to me, with a small suggestion. > LayoutTests/inspector/css/get-system-fonts.html:6 > +// Testing that we can get the fonts on the system... Please move the test description to inside <body>. You might want to improve the wording, i.e., "Tests that the Web Inspector can enumerate system fonts, and checks for the existence of common fonts." > LayoutTests/inspector/css/get-system-fonts.html:16 > InspectorTest.log("Has at least 5 fonts: " + (fontFamilyNames.length >= 5)); This should really be an assertion: InspectorTest.assert(cond, message). But you'd have to rebaseline the text for other platforms.
(In reply to comment #9) > > LayoutTests/inspector/css/get-system-fonts.html:6 > > +// Testing that we can get the fonts on the system... > > Please move the test description to inside <body>. You might want to improve > the wording, i.e., "Tests that the Web Inspector can enumerate system fonts, > and checks for the existence of common fonts." OK > > LayoutTests/inspector/css/get-system-fonts.html:16 > > InspectorTest.log("Has at least 5 fonts: " + (fontFamilyNames.length >= 5)); > > This should really be an assertion: InspectorTest.assert(cond, message). But > you'd have to rebaseline the text for other platforms. OK
Created attachment 257798 [details] Patch
Comment on attachment 257798 [details] Patch Ok.
Comment on attachment 257798 [details] Patch Clearing flags on attachment: 257798 Committed r187583: <http://trac.webkit.org/changeset/187583>
All reviewed patches have been landed. Closing bug.