[iOS] Arabic ligatures are broken in Google Maps
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2015 07:14:23 +0000 (07:14 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2015 07:14:23 +0000 (07:14 +0000)
commit4c10ebe12e4b1e276709882125ade74f07f1b56a
tree4b22be65a7f0f9bc61831aefe8e7cb4cbf28f36c
parent4c8bfc437b668db4270e4d101cca8d77902fa21c
[iOS] Arabic ligatures are broken in Google Maps
https://bugs.webkit.org/show_bug.cgi?id=145336
<rdar://problem/20689607>

Reviewed by Darin Adler.

Source/WebCore:

When we fall off the end of the font fallback list, we ask the platform for which particular font we should use
to display a particular codepoint. When we do this, we supply the font which is first in the fallback list so
that the platform can try to match it as best it can. However, web fonts' FontPlatformData have a null m_font
property, which means that we were passing nullptr to this platform fallback function.

The solution is something I've wanted to do for a while, which is migrate webfonts from using
CGDataProviderCreateWithCFData() to using CTFontManagerCreateFontDescriptorFromData(). This call creates a
CoreText font for an in-memory buffer (the old call was creating a CoreGraphics front from the same thing).
This means that we can use the FontPlatformData constructor which accepts a CoreText font, thereby making web
fonts not have a null m_font property. Note that not all platforms can use this call, which means that this
new codepath is gated to only certain OSes (which is okay because only certain OSes use the
CTFontCreatePhysicalFontDescriptorForCharactersWithLanguage() call inside FontCache). Because web fonts are the
only user of the constructor which just takes a CG font, we can make the constructor private to the
FontPlatformData class (as soon as all platforms can use this new codepath).

Test: platform/ios-simulator/fast/text/arabic-with-no-supporting-webfont.html

* platform/graphics/FontPlatformData.h: Make the FontPlatformData constructor which takes a CGFontRef private.
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Use the CoreText type instead of the CoreGraphics type.
(WebCore::createFontCustomPlatformData): Migrate to CTFontManagerCreateFontDescriptorFromData().
* platform/graphics/mac/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData): Store a CTFontDescriptorRef instead of a CGFontRef.

LayoutTests:

This patch adds a DRT test to make sure that text gets drawn with the correct font.

It also updates expected results for 4 tests, which I have verified are still correct. However,
because the behavior of Mavericks differs from Yosemite, I copied the old expected results to
platform/mac-mavericks before updating the results in platform/mac.

This patch also moves fast/ruby/ruby-expansion-cjk*.html to platform/mac because they rely on
platform-specific screen-space quantization. This patch also skips these tests on Mavericks
because I can't add platform-specific expected results for reftests.

* platform/ios-simulator/fast/text/arabic-with-no-supporting-webfont-expected.txt:
* platform/ios-simulator/fast/text/arabic-with-no-supporting-webfont.html:

* platform/mac-mavericks/fast/css/font-face-opentype-expected.txt: Copied from platform/mac.
* platform/mac-mavericks/svg/batik/text/xmlSpace-expected.txt: Ditto.
* platform/mac-mavericks/svg/custom/svg-fonts-fallback-expected.txt: Ditto.
* platform/mac-mavericks/svg/custom/svg-fonts-without-missing-glyph-expected.txt: Ditto.
* platform/mac-mavericks/TestExpectations: Skip fast/ruyb/ruby-expansion-cjk*.html
* platform/mac/fast/css/font-face-opentype-expected.txt: Updated.
* platform/mac/svg/batik/text/xmlSpace-expected.txt: Ditto.
* platform/mac/svg/custom/svg-fonts-fallback-expected.txt: Ditto.
* platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.txt: Ditto.
* LayoutTests/platform/mac/fast/ruby/resources/green.png: Moved from fast/ruby/resources/green.png
* LayoutTests/platform/mac/fast/ruby/resources/ruby-expansion.svg: Moved from fast/ruby/resources/ruby-expansion.svg
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-2-expected.html: Moved from fast/ruby/ruby-expansion-cjk-2-expected.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-2.html: Moved from fast/ruby/ruby-expansion-cjk-2.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-3-expected.html: Moved from fast/ruby/ruby-expansion-cjk-3-expected.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-3.html: Moved from fast/ruby/ruby-expansion-cjk-3.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-4-expected.html: Moved from fast/ruby/ruby-expansion-cjk-4-expected.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-4.html: Moved from fast/ruby/ruby-expansion-cjk-4.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-5-expected.html: Moved from fast/ruby/ruby-expansion-cjk-5-expected.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-5.html: Moved from fast/ruby/ruby-expansion-cjk-5.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-expected.html: Moved from fast/ruby/ruby-expansion-cjk-expected.html
* LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk.html: Moved from fast/ruby/ruby-expansion-cjk.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/ios-simulator/fast/text/arabic-with-no-supporting-webfont-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios-simulator/fast/text/arabic-with-no-supporting-webfont.html [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/TestExpectations
LayoutTests/platform/mac-mavericks/fast/css/font-face-opentype-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/svg/batik/text/xmlSpace-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/svg/custom/svg-fonts-fallback-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/svg/custom/svg-fonts-without-missing-glyph-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/font-face-opentype-expected.txt
LayoutTests/platform/mac/fast/ruby/resources/green.png [moved from LayoutTests/fast/ruby/resources/green.png with 100% similarity]
LayoutTests/platform/mac/fast/ruby/resources/ruby-expansion.svg [moved from LayoutTests/fast/ruby/resources/ruby-expansion.svg with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-2-expected.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-2-expected.html with 83% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-2.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-2.html with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-3-expected.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-3-expected.html with 90% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-3.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-3.html with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-4-expected.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-4-expected.html with 95% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-4.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-4.html with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-5-expected.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-5-expected.html with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-5.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-5.html with 100% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk-expected.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk-expected.html with 95% similarity]
LayoutTests/platform/mac/fast/ruby/ruby-expansion-cjk.html [moved from LayoutTests/fast/ruby/ruby-expansion-cjk.html with 100% similarity]
LayoutTests/platform/mac/svg/batik/text/xmlSpace-expected.txt
LayoutTests/platform/mac/svg/custom/svg-fonts-fallback-expected.txt
LayoutTests/platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h