RESOLVED FIXED Bug 164689
[FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
https://bugs.webkit.org/show_bug.cgi?id=164689
Summary [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
Michael Catanzaro
Reported 2016-11-12 14:15:51 PST
Behdad warned me about this at the Web Engines Hackfest. From the documentation of FcFontSort(): """The returned FcFontSet references FcPattern structures which may be shared by the return value from multiple FcFontSort calls, applications must not modify these patterns. Instead, they should be passed, along with p to FcFontRenderPrepare which combines them into a complete pattern.""" That means each call to FcFontSort() must be followed up by a call to FcFontRenderPrepare(), else the patterns will lack information about how to draw the font properly.
Attachments
[FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns (2.40 KB, patch)
2016-11-12 16:59 PST, Michael Catanzaro
cgarcia: review+
Michael Catanzaro
Comment 1 2016-11-12 16:59:05 PST
Created attachment 294643 [details] [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
Michael Catanzaro
Comment 2 2016-11-12 17:00:15 PST
Same caveat here as in bug #82889: it's surely going to affect layout tests, so has to be landed once we've cleaned up our existing expectations.
Myles C. Maxfield
Comment 3 2016-11-14 11:34:23 PST
I would review this but I don't understand enough about FontConfig.
Michael Catanzaro
Comment 4 2017-03-06 21:21:42 PST
Comment on attachment 294643 [details] [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns Seems like a good time to try landing this. Carlos?
Carlos Garcia Campos
Comment 5 2017-03-06 23:24:25 PST
Comment on attachment 294643 [details] [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns View in context: https://bugs.webkit.org/attachment.cgi?id=294643&action=review > Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp:265 > + for (int i = 0; i < unpreparedFallbacks.get()->nfont; i++) { unsigned > Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp:267 > + FcPattern* pattern = FcFontRenderPrepare(nullptr, m_pattern.get(), unpreparedFallbacks.get()->fonts[i]); > + FcFontSetAdd(m_fallbacks.get(), pattern); This could probably be just one line
Michael Catanzaro
Comment 6 2017-03-07 12:35:57 PST
(In reply to comment #5) > > Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp:265 > > + for (int i = 0; i < unpreparedFallbacks.get()->nfont; i++) { > > unsigned Nope, because FcFontSet::nfont is an int. > > Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp:267 > > + FcPattern* pattern = FcFontRenderPrepare(nullptr, m_pattern.get(), unpreparedFallbacks.get()->fonts[i]); > > + FcFontSetAdd(m_fallbacks.get(), pattern); > > This could probably be just one line OK.
Michael Catanzaro
Comment 7 2017-03-07 12:36:34 PST
Note You need to log in before you can comment on or make changes to this bug.