Bug 164689 - [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
Summary: [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-12 14:15 PST by Michael Catanzaro
Modified: 2017-03-07 12:36 PST (History)
4 users (show)

See Also:


Attachments
[FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns (2.40 KB, patch)
2016-11-12 16:59 PST, Michael Catanzaro
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 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.
Comment 1 Michael Catanzaro 2016-11-12 16:59:05 PST
Created attachment 294643 [details]
[FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
Comment 2 Michael Catanzaro 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.
Comment 3 Myles C. Maxfield 2016-11-14 11:34:23 PST
I would review this but I don't understand enough about FontConfig.
Comment 4 Michael Catanzaro 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?
Comment 5 Carlos Garcia Campos 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
Comment 6 Michael Catanzaro 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.
Comment 7 Michael Catanzaro 2017-03-07 12:36:34 PST
Committed r213532: <http://trac.webkit.org/changeset/213532>