Title: [213532] trunk/Source/WebCore
Revision
213532
Author
[email protected]
Date
2017-03-07 12:36:29 -0800 (Tue, 07 Mar 2017)

Log Message

[FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
https://bugs.webkit.org/show_bug.cgi?id=164689

Reviewed by Carlos Garcia Campos.

>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.

* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::fallbacks):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213531 => 213532)


--- trunk/Source/WebCore/ChangeLog	2017-03-07 20:16:03 UTC (rev 213531)
+++ trunk/Source/WebCore/ChangeLog	2017-03-07 20:36:29 UTC (rev 213532)
@@ -1,3 +1,23 @@
+2017-03-07  Michael Catanzaro  <[email protected]>
+
+        [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
+        https://bugs.webkit.org/show_bug.cgi?id=164689
+
+        Reviewed by Carlos Garcia Campos.
+
+        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.
+
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::fallbacks):
+
 2017-03-07  Myles C. Maxfield  <[email protected]>
 
         Parsing font descriptors inside @font-face needs to accept ranges

Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (213531 => 213532)


--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2017-03-07 20:16:03 UTC (rev 213531)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2017-03-07 20:36:29 UTC (rev 213532)
@@ -270,7 +270,10 @@
 
     if (m_pattern) {
         FcResult fontConfigResult;
-        m_fallbacks.reset(FcFontSort(nullptr, m_pattern.get(), FcTrue, nullptr, &fontConfigResult));
+        FcUniquePtr<FcFontSet> unpreparedFallbacks(FcFontSort(nullptr, m_pattern.get(), FcTrue, nullptr, &fontConfigResult));
+        m_fallbacks.reset(FcFontSetCreate());
+        for (int i = 0; i < unpreparedFallbacks.get()->nfont; i++)
+            FcFontSetAdd(m_fallbacks.get(), FcFontRenderPrepare(nullptr, m_pattern.get(), unpreparedFallbacks.get()->fonts[i]));
     }
     return m_fallbacks.get();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to