Source/WebCore: Composite Font References is a new established standard (ISO/IEC...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Apr 2012 18:21:10 +0000 (18:21 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Apr 2012 18:21:10 +0000 (18:21 +0000)
commit407e2a9e0175c26125bf69a9b675b14eee70c2b2
tree01fa15c7b8b9894a23ce3e753a680a3cf742cef8
parent5c642e6db564c38e8c0127e914398d3dd8b2fd26
Source/WebCore: Composite Font References is a new established standard (ISO/IEC 14496-28:2012) for specifying
composite fonts from existing physical fonts.
<rdar://problem/10717370>
https://bugs.webkit.org/show_bug.cgi?id=82810

CoreText have already the features enabled, here we added this to WebKit text layout and rendering.
A member function getCompositeFontReferenceFontData is added to the SimpleFontData class for the component font
correspond to the platformData, in this case, a NSFont. This is used when CoreText layout had resulted
a component of the Composite Font Reference and its corresponding SimpleFontData object is then cached
in the SimpleFontData object of the posting font (Composite Font Reference).

When glyphs are encoded to form the GlyphPage for rendering, the Composite Font Reference is handled throught
the CoreText layout path (using CTLine), here the resulting glyph is associated with a font which could
be not the original font request. In this case, these are the component fonts of the Composite Font
Reference. This is then identified and then added to the GlyphPage appropriately.

To support this feature, a member function isCompositeFontReference is added to FontPlatformData to
indicate a font is a Composite Font Reference. Also in order to pass the component font correctly a boolean
isPrinterFont is added to one the FontPlatformData constructors to describe the NSFont.

Patch by Tony Tseung <tseung@apple.com> on 2012-04-01
Reviewed by Dan Bernstein.

Added test LayoutTests/fast/text/international/text-spliced-font.html

* WebCore.exp.in:
Replaced obsolete FontPlatformData constructor entry.

* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::FontPlatformData):
Copy of the additional m_isCompositeFontReference and m_isPrinterFont data members.

(WebCore::FontPlatformData::operator=):
Assignment of the additional m_isCompositeFontReference and m_isPrinterFont data members.

* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::FontPlatformData):
(FontPlatformData):
Default value of m_isCompositeFontReference and m_isPrinterFont data members are set to false in various constructors.

(WebCore::FontPlatformData::isCompositeFontReference):
Newly added for Composite Font Reference type font.

(WebCore::FontPlatformData::isPrinterFont):
Newly added for describing the NSFont parameter if is applicable.

(WebCore::FontPlatformData::operator==):
Comparison of the additional m_isCompositeFontReference and m_isPrinterFont data members.

* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::DerivedFontData::~DerivedFontData):
Clean up the cache for component fonts of the Composite Font References.

* platform/graphics/SimpleFontData.h:
(SimpleFontData):
Added member function const SimpleFontData* getCompositeFontReferenceFontData(NSFont *key) const.

(DerivedFontData):
Added CFDictionary for caching the component font of Composite Font Reference.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
Data members m_isCompositeFontReference and m_isPrinterFont are initialised and their values are determined in the body of the contructor.

(WebCore::FontPlatformData::setFont):
Data members m_isCompositeFontReference and m_isPrinterFont are determined and set.

* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::createFontPlatformData):
Boolean value isUsingPrinterFont is passed in the new FontPlatformData constructor.

* platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
(WebCore::shouldUseCoreText):
Added the condition for Composite Font Reference type font.

(WebCore::GlyphPage::fill):
In the case of Composite Font Reference, when iterate the runs, component font of Composite Font
Reference is used to fill the glyph index in the GlyphPage.

* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::getCompositeFontReferenceFontData):
Newly added method for the component fonts correspond to the platformData, in this case, a NSFont.
This SimpleFontData is created and cached in this object and will only be deleted when the destructor
if this is called.

Tools: Composite Font References is a new established standard (ISO/IEC 14496-28:2012) for specifying
composite fonts from existing physical fonts.
<rdar://problem/10717370>
https://bugs.webkit.org/show_bug.cgi?id=82810

A new test font of this kind as been added to the test tools for running the webkit-tests

Patch by Tony Tseung <tseung@apple.com> on 2012-04-01
Reviewed by Dan Bernstein.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Added new dependency SampleFont.sfont

* DumpRenderTree/fonts/SampleFont.sfont: Added.

* DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig:
* DumpRenderTree/mac/DumpRenderTree.mm:
(allowedFontFamilySet):
Added the Composite Font Referene sample font "Hiragino Maru Gothic Monospaced" entry to the fonts white-list

(activateTestingFonts):
Added the registration of the Composite Font Referene sample font

* WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm:
(WTR::allowedFontFamilySet):
Added the Composite Font Referene sample font "Hiragino Maru Gothic Monospaced" entry to the fonts white-list

(WTR::activateFonts):
Added the registration of the Composite Font Referene sample font

* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
Added new dependency SampleFont.sfont

* WebKitTestRunner/fonts/SampleFont.sfont: Added.

LayoutTests: Composite Font References is a new established standard (ISO/IEC 14496-28:2012) for specifying
composite fonts from existing physical fonts.
<rdar://problem/10717370>
https://bugs.webkit.org/show_bug.cgi?id=82810

Added new LayoutTests/fast/text/international/text-spliced-font.html

Patch by Tony Tseung <tseung@apple.com> on 2012-04-01
Reviewed by Dan Bernstein.

* fast/text/international/text-spliced-font.html: Added.
* platform/mac/fast/text/international/text-spliced-font-expected.png: Added.
* platform/mac/fast/text/international/text-spliced-font-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/international/text-spliced-font.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/international/text-spliced-font-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/international/text-spliced-font-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/graphics/FontPlatformData.cpp
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/SimpleFontData.cpp
Source/WebCore/platform/graphics/SimpleFontData.h
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
Tools/DumpRenderTree/fonts/SampleFont.sfont [new file with mode: 0644]
Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/fonts/SampleFont.sfont [new file with mode: 0644]