Rename SimpleFontData to Font
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jan 2015 21:57:04 +0000 (21:57 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jan 2015 21:57:04 +0000 (21:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140496

Reviewed by Zalan Bujtas.

The fallback supporting Font type was renamed FontCascade.
We can now rename SimpleFontData to Font matching the usual definition.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

120 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontFace.h
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSFontFaceSource.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSFontSelector.h
Source/WebCore/css/CSSSegmentedFontFace.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/loader/cache/CachedFont.cpp
Source/WebCore/loader/cache/CachedFont.h
Source/WebCore/loader/cache/CachedSVGFont.cpp
Source/WebCore/loader/cache/CachedSVGFont.h
Source/WebCore/platform/graphics/Font.cpp [moved from Source/WebCore/platform/graphics/SimpleFontData.cpp with 78% similarity]
Source/WebCore/platform/graphics/Font.h [moved from Source/WebCore/platform/graphics/SimpleFontData.h with 74% similarity]
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/FontGlyphs.cpp
Source/WebCore/platform/graphics/FontGlyphs.h
Source/WebCore/platform/graphics/FontMetrics.h
Source/WebCore/platform/graphics/FontRanges.cpp
Source/WebCore/platform/graphics/FontRanges.h
Source/WebCore/platform/graphics/FontSelector.h
Source/WebCore/platform/graphics/GlyphBuffer.h
Source/WebCore/platform/graphics/GlyphPage.h
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/TextRun.h
Source/WebCore/platform/graphics/WidthIterator.cpp
Source/WebCore/platform/graphics/WidthIterator.h
Source/WebCore/platform/graphics/cairo/FontCairo.cpp
Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
Source/WebCore/platform/graphics/mac/ComplexTextController.h
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h
Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp
Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h
Source/WebCore/platform/graphics/win/FontCGWin.cpp
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/graphics/win/FontWin.cpp
Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp
Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
Source/WebCore/platform/graphics/win/UniscribeController.cpp
Source/WebCore/platform/graphics/win/UniscribeController.h
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderCombineText.cpp
Source/WebCore/rendering/RenderCombineText.h
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/line/BreakingContextInlineHeaders.h
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp
Source/WebCore/rendering/svg/SVGTextMetrics.cpp
Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h
Source/WebCore/svg/SVGFontData.cpp
Source/WebCore/svg/SVGFontData.h
Source/WebCore/svg/SVGFontElement.h
Source/WebKit/ios/Misc/EmojiFallbackFontSelector.cpp
Source/WebKit/ios/Misc/EmojiFallbackFontSelector.h
Source/WebKit/mac/Misc/WebCoreStatistics.mm
Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/win/DOMCoreClasses.cpp
Source/WebKit/win/WebCoreStatistics.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit2/WebProcess/WebProcess.cpp

index ef64afb..4638609 100644 (file)
@@ -2054,6 +2054,7 @@ set(WebCore_SOURCES
     platform/graphics/FloatRect.cpp
     platform/graphics/FloatRoundedRect.cpp
     platform/graphics/FloatSize.cpp
+    platform/graphics/Font.cpp
     platform/graphics/FontCache.cpp
     platform/graphics/FontCascade.cpp
     platform/graphics/FontDescription.cpp
@@ -2089,7 +2090,6 @@ set(WebCore_SOURCES
     platform/graphics/RoundedRect.cpp
     platform/graphics/SVGGlyph.cpp
     platform/graphics/ShadowBlur.cpp
-    platform/graphics/SimpleFontData.cpp
     platform/graphics/StringTruncator.cpp
     platform/graphics/SurrogatePairAwareTextIterator.cpp
     platform/graphics/TextRun.cpp
index 1d40f04..bbefdcd 100644 (file)
@@ -1,3 +1,13 @@
+2015-01-21  Antti Koivisto  <antti@apple.com>
+
+        Rename SimpleFontData to Font
+        https://bugs.webkit.org/show_bug.cgi?id=140496
+
+        Reviewed by Zalan Bujtas.
+
+        The fallback supporting Font type was renamed FontCascade.
+        We can now rename SimpleFontData to Font matching the usual definition.
+
 2015-01-22  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Make trailing whitespace handling more explicit.
index 0aa6ff4..ae2c4a2 100644 (file)
@@ -469,7 +469,6 @@ __ZN7WebCore14SecurityPolicy22generateReferrerHeaderENS_14ReferrerPolicyERKNS_3U
 __ZN7WebCore14SecurityPolicy27resetOriginAccessWhitelistsEv
 __ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
 __ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
-__ZN7WebCore14SimpleFontDataD1Ev
 __ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE
 __ZN7WebCore14TileController14setTilesOpaqueEb
 __ZN7WebCore14TileController15containerLayersEv
@@ -1179,6 +1178,7 @@ __ZN7WebCore40defaultTextEncodingNameForSystemLanguageEv
 __ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf
 __ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURL18CFURLComponentType
 __ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
+__ZN7WebCore4FontD1Ev
 __ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
 __ZN7WebCore4IconD1Ev
 __ZN7WebCore4Node10renderRectEPb
@@ -1492,11 +1492,11 @@ __ZN7WebCore9FloatRectC1ERKNS_7IntRectE
 __ZN7WebCore9FloatSizeC1ERK6CGSize
 __ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE
 __ZN7WebCore9FontCache10invalidateEv
-__ZN7WebCore9FontCache13fontDataCountEv
 __ZN7WebCore9FontCache13fontForFamilyERKNS_15FontDescriptionERKN3WTF12AtomicStringEb
-__ZN7WebCore9FontCache21inactiveFontDataCountEv
+__ZN7WebCore9FontCache17inactiveFontCountEv
 __ZN7WebCore9FontCache21purgeInactiveFontDataEi
 __ZN7WebCore9FontCache29purgeInactiveFontDataIfNeededEv
+__ZN7WebCore9FontCache9fontCountEv
 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore9FrameTree7setNameERKN3WTF12AtomicStringE
 __ZN7WebCore9FrameTree9clearNameEv
@@ -1634,8 +1634,8 @@ __ZNK3WTF6String14createCFStringEv
 __ZNK7WebCore10Credential12nsCredentialEv
 __ZNK7WebCore10Credential7isEmptyEv
 __ZNK7WebCore10FloatPointcv7CGPointEv
-__ZNK7WebCore10FontRanges20fontDataForCharacterEi
-__ZNK7WebCore10FontRanges21fontDataForFirstRangeEv
+__ZNK7WebCore10FontRanges16fontForCharacterEi
+__ZNK7WebCore10FontRanges17fontForFirstRangeEv
 __ZNK7WebCore10LayoutRect8containsERKS0_
 __ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringENS0_18AllowedPluginTypesE
 __ZNK7WebCore10RenderText16firstRunLocationEv
@@ -1665,7 +1665,7 @@ __ZNK7WebCore10TimeRanges3endEjRi
 __ZNK7WebCore10TimeRanges4copyEv
 __ZNK7WebCore10TimeRanges5startEjRi
 __ZNK7WebCore10TimeRanges6lengthEv
-__ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
+__ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_4FontENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
 __ZNK7WebCore11FontCascade8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEiiNS0_24CustomFontNotReadyActionE
 __ZNK7WebCore11FontCascadeeqERKS0_
 __ZNK7WebCore11FrameLoader10isCompleteEv
index dab07db..30c1eae 100644 (file)
     <ClCompile Include="..\platform\graphics\FloatRect.cpp" />
     <ClCompile Include="..\platform\graphics\FloatRoundedRect.cpp" />
     <ClCompile Include="..\platform\graphics\FloatSize.cpp" />
+    <ClCompile Include="..\platform\graphics\Font.cpp" />
     <ClCompile Include="..\platform\graphics\FontCache.cpp" />
     <ClCompile Include="..\platform\graphics\FontCascade.cpp" />
     <ClCompile Include="..\platform\graphics\FontDescription.cpp" />
     <ClCompile Include="..\platform\graphics\Region.cpp" />
     <ClCompile Include="..\platform\graphics\RoundedRect.cpp" />
     <ClCompile Include="..\platform\graphics\ShadowBlur.cpp" />
-    <ClCompile Include="..\platform\graphics\SimpleFontData.cpp" />
     <ClCompile Include="..\platform\graphics\TextRun.cpp" />
     <ClCompile Include="..\platform\graphics\TextTrackRepresentation.cpp" />
     <ClCompile Include="..\platform\graphics\WOFFFileFormat.cpp" />
     <ClInclude Include="..\platform\graphics\FloatRoundedRect.h" />
     <ClInclude Include="..\platform\graphics\FloatSize.h" />
     <ClInclude Include="..\platform\graphics\FloatSizeHash.h" />
+    <ClInclude Include="..\platform\graphics\Font.h" />
     <ClInclude Include="..\platform\graphics\FontCache.h" />
     <ClInclude Include="..\platform\graphics\FontCascade.h" />
     <ClInclude Include="..\platform\graphics\FontDescription.h" />
     <ClInclude Include="..\platform\graphics\Region.h" />
     <ClInclude Include="..\platform\graphics\RoundedRect.h" />
     <ClInclude Include="..\platform\graphics\ShadowBlur.h" />
-    <ClInclude Include="..\platform\graphics\SimpleFontData.h" />
     <ClInclude Include="..\platform\graphics\TextRun.h" />
     <ClInclude Include="..\platform\graphics\TextTrackRepresentation.h" />
     <ClInclude Include="..\platform\graphics\UnitBezier.h" />
index 52b188b..5db486a 100644 (file)
                B2C3DA610D006CD600EF6F26 /* FontCascade.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA500D006CD600EF6F26 /* FontCascade.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA510D006CD600EF6F26 /* FontCache.cpp */; };
                B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA520D006CD600EF6F26 /* FontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };
-               B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* Font.cpp */; };
+               B2C3DA650D006CD600EF6F26 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* Font.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */; };
                B2C3DA680D006CD600EF6F26 /* FontGlyphs.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA570D006CD600EF6F26 /* FontGlyphs.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA500D006CD600EF6F26 /* FontCascade.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCascade.h; sourceTree = "<group>"; };
                B2C3DA510D006CD600EF6F26 /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; };
                B2C3DA520D006CD600EF6F26 /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCache.h; sourceTree = "<group>"; };
-               B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };
-               B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SimpleFontData.h; sourceTree = "<group>"; };
+               B2C3DA530D006CD600EF6F26 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = "<group>"; };
+               B2C3DA540D006CD600EF6F26 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; };
                B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; };
                B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontGlyphs.cpp; sourceTree = "<group>"; };
                B2C3DA570D006CD600EF6F26 /* FontGlyphs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontGlyphs.h; sourceTree = "<group>"; };
                                371F4FFA0D25E7F300ECE0D5 /* FontRanges.h */,
                                0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */,
                                0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
-                               B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
-                               B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
+                               B2C3DA530D006CD600EF6F26 /* Font.cpp */,
+                               B2C3DA540D006CD600EF6F26 /* Font.h */,
                                CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */,
                                CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */,
                                B23540F00D00782E002382FA /* StringTruncator.cpp */,
                                1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
                                97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */,
                                93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
-                               B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
+                               B2C3DA650D006CD600EF6F26 /* Font.h in Headers */,
                                E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */,
                                E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */,
                                E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */,
                                1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
                                E45390460EAFD637003695C8 /* SharedTimerIOS.mm in Sources */,
                                93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */,
-                               B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,
+                               B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */,
                                163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
                                37E65950163B10C200EB4574 /* SimpleFontDataIOS.mm in Sources */,
                                B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */,
index ec7bfe5..0b53800 100644 (file)
@@ -1758,7 +1758,7 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren
     RenderStyle& style = renderer->style();
     
     // set basic font info
-    AXAttributeStringSetFont(attrString, style.fontCascade().primaryFontData().getCTFont(), range);
+    AXAttributeStringSetFont(attrString, style.fontCascade().primaryFont().getCTFont(), range);
                 
     int decor = style.textDecorationsInEffect();
     if ((decor & (TextDecorationUnderline | TextDecorationLineThrough)) != 0) {
index 2b8db35..5ddfc3a 100644 (file)
@@ -46,6 +46,7 @@
 #import "ChromeClient.h"
 #import "ColorMac.h"
 #import "ContextMenuController.h"
+#import "Font.h"
 #import "FontCascade.h"
 #import "Frame.h"
 #import "FrameLoaderClient.h"
@@ -63,7 +64,6 @@
 #import "RenderView.h"
 #import "RenderWidget.h"
 #import "ScrollView.h"
-#import "SimpleFontData.h"
 #import "TextCheckerClient.h"
 #import "TextCheckingHelper.h"
 #import "VisibleUnits.h"
index cebb8c4..be1023e 100644 (file)
@@ -47,6 +47,7 @@
 #import "ColorMac.h"
 #import "ContextMenuController.h"
 #import "Editor.h"
+#import "Font.h"
 #import "FontCascade.h"
 #import "FrameLoaderClient.h"
 #import "FrameSelection.h"
@@ -64,7 +65,6 @@
 #import "RenderView.h"
 #import "RenderWidget.h"
 #import "ScrollView.h"
-#import "SimpleFontData.h"
 #import "TextCheckerClient.h"
 #import "TextCheckingHelper.h"
 #import "TextIterator.h"
@@ -848,7 +848,7 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren
     const RenderStyle& style = renderer->style();
     
     // set basic font info
-    AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFontData().getNSFont(), range);
+    AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont().getNSFont(), range);
     
     // set basic colors
     AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style.visitedDependentColor(CSSPropertyColor)), range);
index fa0d9ba..33b6deb 100644 (file)
@@ -669,7 +669,7 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
     auto renderer = core(self)->renderer();
     if (!renderer)
         return nil;
-    return renderer->style().fontCascade().primaryFontData().getNSFont();
+    return renderer->style().fontCascade().primaryFont().getNSFont();
 }
 #else
 - (CTFontRef)_font
@@ -677,7 +677,7 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
     RenderObject* renderer = core(self)->renderer();
     if (!renderer)
         return nil;
-    return renderer->style().fontCascade().primaryFontData().getCTFont();
+    return renderer->style().fontCascade().primaryFont().getCTFont();
 }
 #endif
 
index d237446..f62a5fb 100644 (file)
 #include "CSSFontSelector.h"
 #include "CSSSegmentedFontFace.h"
 #include "Document.h"
+#include "Font.h"
 #include "FontDescription.h"
 #include "FontLoader.h"
 #include "RuntimeEnabledFeatures.h"
-#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -108,7 +108,7 @@ void CSSFontFace::fontLoaded(CSSFontFaceSource* source)
 #endif
 }
 
-PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
+RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
 {
     m_activeSource = 0;
     if (!isValid())
@@ -124,7 +124,7 @@ PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD
 
     size_t size = m_sources.size();
     for (size_t i = 0; i < size; ++i) {
-        if (RefPtr<SimpleFontData> result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector)) {
+        if (RefPtr<Font> result = m_sources[i]->font(fontDescription, syntheticBold, syntheticItalic, fontSelector)) {
             m_activeSource = m_sources[i].get();
 #if ENABLE(FONT_LOAD_EVENTS)
             if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading && m_sources[i]->isLoaded()) {
index 2a4f2fa..3f1fc3b 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 
 class CSSSegmentedFontFace;
 class FontDescription;
-class SimpleFontData;
+class Font;
 
 class CSSFontFace : public RefCounted<CSSFontFace> {
 public:
@@ -65,7 +65,7 @@ public:
 
     void fontLoaded(CSSFontFaceSource*);
 
-    PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
+    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic);
 
     struct UnicodeRange {
         UnicodeRange(UChar32 from, UChar32 to)
index b3a8baf..43f059d 100644 (file)
@@ -32,9 +32,9 @@
 #include "CachedResourceLoader.h"
 #include "Document.h"
 #include "ElementIterator.h"
+#include "Font.h"
 #include "FontCache.h"
 #include "FontDescription.h"
-#include "SimpleFontData.h"
 
 #if ENABLE(SVG_OTF_CONVERTER)
 #include "FontCustomPlatformData.h"
@@ -74,10 +74,10 @@ CSSFontFaceSource::~CSSFontFaceSource()
 
 void CSSFontFaceSource::pruneTable()
 {
-    if (m_fontDataTable.isEmpty())
+    if (m_fontTable.isEmpty())
         return;
 
-    m_fontDataTable.clear();
+    m_fontTable.clear();
 }
 
 bool CSSFontFaceSource::isLoaded() const
@@ -101,7 +101,7 @@ void CSSFontFaceSource::fontLoaded(CachedFont*)
         m_face->fontLoaded(this);
 }
 
-PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
+RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
 {
     // If the font hasn't loaded or an error occurred, then we've got nothing.
     if (!isValid())
@@ -112,18 +112,17 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
             && !m_svgFontFaceElement
 #endif
     ) {
-        // We're local. Just return a SimpleFontData from the normal cache.
+        // We're local. Just return a Font from the normal cache.
         // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
         return fontCache().fontForFamily(fontDescription, m_string, true);
     }
 
-    // See if we have a mapping in our FontData cache.
     unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3
                        | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
 
-    RefPtr<SimpleFontData> fontData = m_fontDataTable.add(hashKey, nullptr).iterator->value;
-    if (fontData)
-        return fontData.release();
+    RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value;
+    if (font)
+        return font.release();
 
     // If we are still loading, then we let the system pick a font.
     if (isLoaded()) {
@@ -136,7 +135,7 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
             if (!m_font->ensureCustomFontData(hasExternalSVGFont, m_string))
                 return nullptr;
 
-            fontData = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);
+            font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);
         } else {
 #if ENABLE(SVG_FONTS)
             // In-Document SVG Fonts
@@ -152,9 +151,9 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
                 if (!m_generatedOTFBuffer)
                     return nullptr;
                 std::unique_ptr<FontCustomPlatformData> customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
-                fontData = SimpleFontData::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
+                font = Font::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
 #else
-                fontData = SimpleFontData::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
+                font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
 #endif
             }
 #endif
@@ -164,12 +163,12 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
         // and the loader may invoke arbitrary delegate or event handler code.
         fontSelector->beginLoadingFontSoon(m_font.get());
 
-        Ref<SimpleFontData> placeholderFont = fontCache().lastResortFallbackFont(fontDescription);
-        Ref<SimpleFontData> placeholderFontCopyInLoadingState = SimpleFontData::create(placeholderFont->platformData(), true, true);
+        Ref<Font> placeholderFont = fontCache().lastResortFallbackFont(fontDescription);
+        Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true);
         return WTF::move(placeholderFontCopyInLoadingState);
     }
 
-    return fontData.release();
+    return font.release();
 }
 
 #if ENABLE(FONT_LOAD_EVENTS)
index 7508bb3..00e730b 100644 (file)
@@ -42,8 +42,8 @@ namespace WebCore {
 class CachedFont;
 class CSSFontFace;
 class CSSFontSelector;
+class Font;
 class FontDescription;
-class SimpleFontData;
 
 class CSSFontFaceSource final : public CachedFontClient {
 public:
@@ -59,7 +59,7 @@ public:
 
     virtual void fontLoaded(CachedFont*) override;
 
-    PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
+    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
 
     void pruneTable();
 
@@ -81,7 +81,7 @@ private:
     AtomicString m_string; // URI for remote, built-in font name for local.
     CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
     CSSFontFace* m_face; // Our owning font face.
-    HashMap<unsigned, RefPtr<SimpleFontData>> m_fontDataTable; // The hash key is composed of size synthetic styles.
+    HashMap<unsigned, RefPtr<Font>> m_fontTable; // The hash key is composed of size synthetic styles.
 
 #if ENABLE(SVG_OTF_CONVERTER)
     RefPtr<SharedBuffer> m_generatedOTFBuffer;
index 3cb7cf2..7bd4dad 100644 (file)
 #include "CSSValueList.h"
 #include "CachedResourceLoader.h"
 #include "Document.h"
+#include "Font.h"
 #include "FontCache.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "SVGFontFaceElement.h"
 #include "SVGNames.h"
 #include "Settings.h"
-#include "SimpleFontData.h"
 #include "StyleProperties.h"
 #include "StyleResolver.h"
 #include "StyleRule.h"
@@ -612,7 +612,7 @@ bool CSSFontSelector::resolvesFamilyFor(const FontDescription& description) cons
     return false;
 }
 
-size_t CSSFontSelector::fallbackFontDataCount()
+size_t CSSFontSelector::fallbackFontCount()
 {
     if (!m_document)
         return 0;
@@ -623,7 +623,7 @@ size_t CSSFontSelector::fallbackFontDataCount()
     return 0;
 }
 
-PassRefPtr<SimpleFontData> CSSFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t index)
+PassRefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t index)
 {
     ASSERT_UNUSED(index, !index);
 
index 93383f4..d84d112 100644 (file)
@@ -27,8 +27,8 @@
 #define CSSFontSelector_h
 
 #include "CachedResourceHandle.h"
+#include "Font.h"
 #include "FontSelector.h"
-#include "SimpleFontData.h"
 #include "Timer.h"
 #include <memory>
 #include <wtf/Forward.h>
@@ -59,8 +59,8 @@ public:
     virtual unsigned uniqueId() const override { return m_uniqueId; }
 
     virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) override;
-    virtual size_t fallbackFontDataCount() override;
-    virtual PassRefPtr<SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) override;
+    virtual size_t fallbackFontCount() override;
+    virtual PassRefPtr<Font> fallbackFontAt(const FontDescription&, size_t) override;
     CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family);
 
     virtual bool resolvesFamilyFor(const FontDescription&) const override;
index 3725692..f8c4f3f 100644 (file)
@@ -30,9 +30,9 @@
 #include "CSSFontFaceSource.h"
 #include "CSSFontSelector.h"
 #include "Document.h"
+#include "Font.h"
 #include "FontDescription.h"
 #include "RuntimeEnabledFeatures.h"
-#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -90,21 +90,21 @@ void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace)
     m_fontFaces.append(fontFace);
 }
 
-static void appendFontDataWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<SimpleFontData>&& fontData, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)
+static void appendFontWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<Font>&& font, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)
 {
-    if (fontData->isLoading()) {
-        ranges.appendRange(FontRanges::Range(0, 0, WTF::move(fontData)));
+    if (font->isLoading()) {
+        ranges.appendRange(FontRanges::Range(0, 0, WTF::move(font)));
         return;
     }
 
     unsigned numRanges = unicodeRanges.size();
     if (!numRanges) {
-        ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(fontData)));
+        ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(font)));
         return;
     }
 
     for (unsigned j = 0; j < numRanges; ++j)
-        ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), fontData.copyRef()));
+        ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), font.copyRef()));
 }
 
 FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
@@ -128,8 +128,8 @@ FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescripti
             FontTraitsMask traitsMask = face->traitsMask();
             bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
             bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
-            if (RefPtr<SimpleFontData> faceFontData = face->getFontData(fontDescription, syntheticBold, syntheticItalic))
-                appendFontDataWithInvalidUnicodeRangeIfLoading(fontRanges, faceFontData.releaseNonNull(), face->ranges());
+            if (RefPtr<Font> faceFont = face->font(fontDescription, syntheticBold, syntheticItalic))
+                appendFontWithInvalidUnicodeRangeIfLoading(fontRanges, faceFont.releaseNonNull(), face->ranges());
         }
     }
     return fontRanges;
index 5b83ae9..274fbf8 100644 (file)
@@ -64,7 +64,7 @@ class HitTestResult;
 class KillRing;
 class Pasteboard;
 class SharedBuffer;
-class SimpleFontData;
+class Font;
 class SpellCheckRequest;
 class SpellChecker;
 class StyleProperties;
@@ -422,7 +422,7 @@ public:
 #if PLATFORM(COCOA)
     WEBCORE_EXPORT static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove);
     WEBCORE_EXPORT bool insertParagraphSeparatorInQuotedContent();
-    WEBCORE_EXPORT const SimpleFontData* fontForSelection(bool&) const;
+    WEBCORE_EXPORT const Font* fontForSelection(bool&) const;
     WEBCORE_EXPORT NSDictionary *fontAttributesForSelectionStart() const;
     WEBCORE_EXPORT String stringSelectionForPasteboard();
     String stringSelectionForPasteboardWithImageAltText();
index 5356784..01fe906 100644 (file)
@@ -1114,7 +1114,7 @@ static PlatformFont *_font(Element& element)
     auto renderer = element.renderer();
     if (!renderer)
         return nil;
-    return renderer->style().fontCascade().primaryFontData().getNSFont();
+    return renderer->style().fontCascade().primaryFont().getNSFont();
 }
 #else
 static PlatformFont *_font(Element& element)
@@ -1122,7 +1122,7 @@ static PlatformFont *_font(Element& element)
     auto renderer = element.renderer();
     if (!renderer)
         return nil;
-    return (PlatformFont *)renderer->style().fontCascade().primaryFontData().getCTFont();
+    return (PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont();
 }
 #endif
 
@@ -2594,10 +2594,10 @@ NSAttributedString *editingAttributedStringFromRange(Range& range, IncludeImages
             [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
         if (style.textDecorationsInEffect() & TextDecorationLineThrough)
             [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
-        if (NSFont *font = style.fontCascade().primaryFontData().getNSFont())
+        if (NSFont *font = style.fontCascade().primaryFont().getNSFont())
             [attrs.get() setObject:font forKey:NSFontAttributeName];
         else
-            [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFontData().platformData().size()] forKey:NSFontAttributeName];
+            [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont().platformData().size()] forKey:NSFontAttributeName];
         if (style.visitedDependentColor(CSSPropertyColor).alpha())
             [attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
         else
index 158e1eb..f1ee299 100644 (file)
@@ -203,7 +203,7 @@ bool Editor::insertParagraphSeparatorInQuotedContent()
     return true;
 }
 
-const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
+const Font* Editor::fontForSelection(bool& hasMultipleFonts) const
 {
     hasMultipleFonts = false;
 
@@ -211,9 +211,9 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         Node* nodeToRemove;
         RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
 
-        const SimpleFontData* result = nullptr;
+        const Font* result = nullptr;
         if (style)
-            result = &style->fontCascade().primaryFontData();
+            result = &style->fontCascade().primaryFont();
 
         if (nodeToRemove) {
             ExceptionCode ec;
@@ -224,7 +224,7 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         return result;
     }
 
-    const SimpleFontData* font = 0;
+    const Font* font = 0;
     RefPtr<Range> range = m_frame.selection().toNormalizedRange();
     if (Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode()) {
         Node* pastEnd = range->pastLastNode();
@@ -235,7 +235,7 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
             if (!renderer)
                 continue;
             // FIXME: Are there any node types that have renderers, but that we should be skipping?
-            const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();
+            const Font& primaryFont = renderer->style().fontCascade().primaryFont();
             if (!font)
                 font = &primaryFont;
             else if (font != &primaryFont) {
@@ -257,7 +257,7 @@ NSDictionary* Editor::fontAttributesForSelectionStart() const
 
     NSMutableDictionary* result = [NSMutableDictionary dictionary];
     
-    CTFontRef font = style->fontCascade().primaryFontData().getCTFont();
+    CTFontRef font = style->fontCascade().primaryFont().getCTFont();
     if (font)
         [result setObject:(id)font forKey:NSFontAttributeName];
 
index 907df5c..d3ecf3a 100644 (file)
@@ -105,7 +105,7 @@ bool Editor::insertParagraphSeparatorInQuotedContent()
     return true;
 }
 
-const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
+const Font* Editor::fontForSelection(bool& hasMultipleFonts) const
 {
     hasMultipleFonts = false;
 
@@ -113,9 +113,9 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         Node* nodeToRemove;
         RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
 
-        const SimpleFontData* result = nullptr;
+        const Font* result = nullptr;
         if (style)
-            result = &style->fontCascade().primaryFontData();
+            result = &style->fontCascade().primaryFont();
 
         if (nodeToRemove)
             nodeToRemove->remove(ASSERT_NO_EXCEPTION);
@@ -123,7 +123,7 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         return result;
     }
 
-    const SimpleFontData* font = 0;
+    const Font* font = 0;
     RefPtr<Range> range = m_frame.selection().toNormalizedRange();
     Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode();
     if (range && startNode) {
@@ -135,7 +135,7 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
             if (!renderer)
                 continue;
             // FIXME: Are there any node types that have renderers, but that we should be skipping?
-            const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();
+            const Font& primaryFont = renderer->style().fontCascade().primaryFont();
             if (!font)
                 font = &primaryFont;
             else if (font != &primaryFont) {
@@ -160,8 +160,8 @@ NSDictionary* Editor::fontAttributesForSelectionStart() const
     if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0)
         [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
 
-    if (style->fontCascade().primaryFontData().getNSFont())
-        [result setObject:style->fontCascade().primaryFontData().getNSFont() forKey:NSFontAttributeName];
+    if (style->fontCascade().primaryFont().getNSFont())
+        [result setObject:style->fontCascade().primaryFont().getNSFont() forKey:NSFontAttributeName];
 
     if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
         [result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
index 2be4ecd..c48807f 100644 (file)
@@ -99,7 +99,7 @@ bool CachedFont::ensureCustomFontData(bool, const AtomicString&)
 
 bool CachedFont::ensureCustomFontData(SharedBuffer* data)
 {
-    if (!m_fontData && !errorOccurred() && !isLoading() && data) {
+    if (!m_fontCustomPlatformData && !errorOccurred() && !isLoading() && data) {
         RefPtr<SharedBuffer> buffer(data);
 
 #if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090) && (!PLATFORM(IOS) || __IPHONE_OS_VERSION_MIN_REQUIRED < 80000)
@@ -112,30 +112,30 @@ bool CachedFont::ensureCustomFontData(SharedBuffer* data)
         }
 #endif
 
-        m_fontData = buffer ? createFontCustomPlatformData(*buffer) : nullptr;
-        m_hasCreatedFontDataWrappingResource = m_fontData && (buffer == m_data);
-        if (!m_fontData)
+        m_fontCustomPlatformData = buffer ? createFontCustomPlatformData(*buffer) : nullptr;
+        m_hasCreatedFontDataWrappingResource = m_fontCustomPlatformData && (buffer == m_data);
+        if (!m_fontCustomPlatformData)
             setStatus(DecodeError);
     }
 
-    return m_fontData.get();
+    return m_fontCustomPlatformData.get();
 }
 
-PassRefPtr<SimpleFontData> CachedFont::getFontData(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
+RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
 {
-    return SimpleFontData::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
+    return Font::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
         fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
 }
 
 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
 {
-    ASSERT(m_fontData);
-    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
+    ASSERT(m_fontCustomPlatformData);
+    return m_fontCustomPlatformData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
 }
 
 void CachedFont::allClientsRemoved()
 {
-    m_fontData = nullptr;
+    m_fontCustomPlatformData = nullptr;
 }
 
 void CachedFont::checkNotify()
index 5b6f418..a93a651 100644 (file)
 
 #include "CachedResource.h"
 #include "CachedResourceClient.h"
+#include "Font.h"
 #include "FontOrientation.h"
 #include "FontRenderingMode.h"
 #include "FontWidthVariant.h"
-#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -52,7 +52,7 @@ public:
 
     virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI);
 
-    virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);
+    virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);
 
 protected:
     FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
@@ -70,7 +70,7 @@ private:
 
     virtual void allClientsRemoved() override;
 
-    std::unique_ptr<FontCustomPlatformData> m_fontData;
+    std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData;
     bool m_loadInitiated;
     bool m_hasCreatedFontDataWrappingResource;
 
index 91248e6..51e7808 100644 (file)
@@ -51,17 +51,17 @@ CachedSVGFont::CachedSVGFont(const ResourceRequest& resourceRequest, SessionID s
 {
 }
 
-PassRefPtr<SimpleFontData> CachedSVGFont::getFontData(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
+RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
 {
 #if ENABLE(SVG_OTF_CONVERTER)
     if (!externalSVG || firstFontFace(remoteURI))
-        return CachedFont::getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
+        return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
 #else
     if (!externalSVG)
-        return CachedFont::getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
+        return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
 
     if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI))
-        return SimpleFontData::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
+        return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
 #endif
     return nullptr;
 }
index 7bc3aa2..0a4b651 100644 (file)
@@ -40,7 +40,7 @@ public:
 
     virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override;
     
-    virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;
+    virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;
 
 private:
     FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
@@ -28,7 +28,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
 #include "CoreTextSPI.h"
@@ -50,7 +50,7 @@ unsigned GlyphPage::s_count = 0;
 const float smallCapsFontSizeMultiplier = 0.7f;
 const float emphasisMarkFontSizeMultiplier = 0.5f;
 
-SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback)
+Font::Font(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback)
     : m_maxCharWidth(-1)
     , m_avgCharWidth(-1)
     , m_platformData(platformData)
@@ -76,7 +76,7 @@ SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCust
 #endif
 }
 
-SimpleFontData::SimpleFontData(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
+Font::Font(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
     : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic))
     , m_svgData(WTF::move(svgData))
     , m_treatAsFixedPitch(false)
@@ -93,11 +93,11 @@ SimpleFontData::SimpleFontData(std::unique_ptr<SVGData> svgData, float fontSize,
     , m_shouldNotBeUsedForArabic(false)
 #endif
 {
-    m_svgData->initializeFontData(this, fontSize);
+    m_svgData->initializeFont(this, fontSize);
 }
 
 // Estimates of avgCharWidth and maxCharWidth for platforms that don't support accessing these values from the font.
-void SimpleFontData::initCharWidths()
+void Font::initCharWidths()
 {
     auto* glyphPageZero = glyphPage(0);
 
@@ -117,7 +117,7 @@ void SimpleFontData::initCharWidths()
         m_maxCharWidth = std::max(m_avgCharWidth, m_fontMetrics.floatAscent());
 }
 
-void SimpleFontData::platformGlyphInit()
+void Font::platformGlyphInit()
 {
     auto* glyphPageZero = glyphPage(0);
     if (!glyphPageZero) {
@@ -136,7 +136,7 @@ void SimpleFontData::platformGlyphInit()
 
     // Nasty hack to determine if we should round or ceil space widths.
     // If the font is monospace or fake monospace we ceil to ensure that 
-    // every character and the space are the same width.  Otherwise we round.
+    // every character and the space are the same width. Otherwise we round.
     m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
     float width = widthForGlyph(m_spaceGlyph);
     m_spaceWidth = width;
@@ -147,37 +147,37 @@ void SimpleFontData::platformGlyphInit()
 
     // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE.
     // Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph.
-    // See <http://bugs.webkit.org/show_bug.cgi?id=13178> and SimpleFontData::isZeroWidthSpaceGlyph()
+    // See <http://bugs.webkit.org/show_bug.cgi?id=13178> and Font::isZeroWidthSpaceGlyph()
     if (m_zeroWidthSpaceGlyph == m_spaceGlyph)
         m_zeroWidthSpaceGlyph = 0;
 }
 
-SimpleFontData::~SimpleFontData()
+Font::~Font()
 {
     removeFromSystemFallbackCache();
 }
 
-static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* font)
 {
 #if ENABLE(SVG_FONTS)
-    if (auto* svgData = fontData->svgData())
-        return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, fontData);
+    if (auto* svgData = font->svgData())
+        return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, font);
 #endif
-    bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, fontData);
+    bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, font);
 #if ENABLE(OPENTYPE_VERTICAL)
-    if (hasGlyphs && fontData->verticalData())
-        fontData->verticalData()->substituteWithVerticalGlyphs(fontData, &pageToFill, offset, length);
+    if (hasGlyphs && font->verticalData())
+        font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill, offset, length);
 #endif
     return hasGlyphs;
 }
 
-static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const SimpleFontData* fontData)
+static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font* font)
 {
 #if PLATFORM(IOS)
     // FIXME: Times New Roman contains Arabic glyphs, but Core Text doesn't know how to shape them. See <rdar://problem/9823975>.
-    // Once we have the fix for <rdar://problem/9823975> then remove this code together with SimpleFontData::shouldNotBeUsedForArabic()
+    // Once we have the fix for <rdar://problem/9823975> then remove this code together with Font::shouldNotBeUsedForArabic()
     // in <rdar://problem/12096835>.
-    if (pageNumber == 6 && fontData->shouldNotBeUsedForArabic())
+    if (pageNumber == 6 && font->shouldNotBeUsedForArabic())
         return nullptr;
 #endif
 
@@ -190,7 +190,7 @@ static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Simpl
         for (unsigned i = 0; i < GlyphPage::size; i++)
             buffer[i] = start + i;
 
-        if (start == 0) {
+        if (!start) {
             // Control characters must not render at all.
             for (unsigned i = 0; i < 0x20; ++i)
                 buffer[i] = zeroWidthSpace;
@@ -235,12 +235,12 @@ static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Simpl
     // Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data
     // for only 128 out of 256 characters.
     RefPtr<GlyphPage> glyphPage;
-    if (GlyphPage::mayUseMixedFontDataWhenFilling(buffer, bufferLength, fontData))
-        glyphPage = GlyphPage::createForMixedFontData();
+    if (GlyphPage::mayUseMixedFontsWhenFilling(buffer, bufferLength, font))
+        glyphPage = GlyphPage::createForMixedFonts();
     else
-        glyphPage = GlyphPage::createForSingleFontData(fontData);
+        glyphPage = GlyphPage::createForSingleFont(font);
 
-    bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, fontData);
+    bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, font);
     if (!haveGlyphs)
         return nullptr;
 
@@ -248,9 +248,9 @@ static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Simpl
     return glyphPage;
 }
 
-const GlyphPage* SimpleFontData::glyphPage(unsigned pageNumber) const
+const GlyphPage* Font::glyphPage(unsigned pageNumber) const
 {
-    if (pageNumber == 0) {
+    if (!pageNumber) {
         if (!m_glyphPageZero)
             m_glyphPageZero = createAndFillGlyphPage(0, this);
         return m_glyphPageZero.get();
@@ -262,7 +262,7 @@ const GlyphPage* SimpleFontData::glyphPage(unsigned pageNumber) const
     return addResult.iterator->value.get();
 }
 
-Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
+Glyph Font::glyphForCharacter(UChar32 character) const
 {
     auto* page = glyphPage(character / GlyphPage::size);
     if (!page)
@@ -270,7 +270,7 @@ Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
     return page->glyphAt(character % GlyphPage::size);
 }
 
-GlyphData SimpleFontData::glyphDataForCharacter(UChar32 character) const
+GlyphData Font::glyphDataForCharacter(UChar32 character) const
 {
     auto* page = glyphPage(character / GlyphPage::size);
     if (!page)
@@ -278,7 +278,7 @@ GlyphData SimpleFontData::glyphDataForCharacter(UChar32 character) const
     return page->glyphDataForCharacter(character);
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() const
+PassRefPtr<Font> Font::verticalRightOrientationFont() const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -290,7 +290,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() co
     return m_derivedFontData->verticalRightOrientation;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::uprightOrientationFontData() const
+PassRefPtr<Font> Font::uprightOrientationFont() const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -299,27 +299,27 @@ PassRefPtr<SimpleFontData> SimpleFontData::uprightOrientationFontData() const
     return m_derivedFontData->uprightOrientation;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
+PassRefPtr<Font> Font::smallCapsFont(const FontDescription& fontDescription) const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
     if (!m_derivedFontData->smallCaps)
-        m_derivedFontData->smallCaps = createScaledFontData(fontDescription, smallCapsFontSizeMultiplier);
+        m_derivedFontData->smallCaps = createScaledFont(fontDescription, smallCapsFontSizeMultiplier);
 
     return m_derivedFontData->smallCaps;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const
+PassRefPtr<Font> Font::emphasisMarkFont(const FontDescription& fontDescription) const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
     if (!m_derivedFontData->emphasisMark)
-        m_derivedFontData->emphasisMark = createScaledFontData(fontDescription, emphasisMarkFontSizeMultiplier);
+        m_derivedFontData->emphasisMark = createScaledFont(fontDescription, emphasisMarkFontSizeMultiplier);
 
     return m_derivedFontData->emphasisMark;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::brokenIdeographFontData() const
+PassRefPtr<Font> Font::brokenIdeographFont() const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -330,7 +330,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::brokenIdeographFontData() const
     return m_derivedFontData->brokenIdeograph;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const
+PassRefPtr<Font> Font::nonSyntheticItalicFont() const
 {
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -345,7 +345,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const
 }
 
 #ifndef NDEBUG
-String SimpleFontData::description() const
+String Font::description() const
 {
     if (isSVGFont())
         return "[SVG font]";
@@ -356,7 +356,7 @@ String SimpleFontData::description() const
 }
 #endif
 
-const OpenTypeMathData* SimpleFontData::mathData() const
+const OpenTypeMathData* Font::mathData() const
 {
     if (m_isLoading)
         return nullptr;
@@ -368,19 +368,19 @@ const OpenTypeMathData* SimpleFontData::mathData() const
     return m_mathData.get();
 }
 
-SimpleFontData::DerivedFontData::~DerivedFontData()
+Font::DerivedFontData::~DerivedFontData()
 {
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
+PassRefPtr<Font> Font::createScaledFont(const FontDescription& fontDescription, float scaleFactor) const
 {
     if (isSVGFont())
         return nullptr;
 
-    return platformCreateScaledFontData(fontDescription, scaleFactor);
+    return platformCreateScaledFont(fontDescription, scaleFactor);
 }
 
-bool SimpleFontData::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
+bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
 {
     // We need to handle transforms on SVG fonts internally, since they are rendered internally.
     ASSERT(!isSVGFont());
@@ -396,9 +396,9 @@ bool SimpleFontData::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvanc
 #endif
 }
 
-// FontDatas are not refcounted to avoid cycles.
-typedef HashMap<std::pair<UChar32, unsigned>, SimpleFontData*> CharacterFallbackMap;
-typedef HashMap<const SimpleFontData*, CharacterFallbackMap> SystemFallbackCache;
+// Fonts are not ref'd to avoid cycles.
+typedef HashMap<std::pair<UChar32, unsigned>, Font*> CharacterFallbackMap;
+typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache;
 
 static SystemFallbackCache& systemFallbackCache()
 {
@@ -406,16 +406,16 @@ static SystemFallbackCache& systemFallbackCache()
     return map.get();
 }
 
-RefPtr<SimpleFontData> SimpleFontData::systemFallbackFontDataForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const
+RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const
 {
     auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap());
 
     auto key = std::make_pair(character, isForPlatformFont);
     auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr);
 
-    SimpleFontData*& fallbackFontData = characterAddResult.iterator->value;
+    Font*& fallbackFont = characterAddResult.iterator->value;
 
-    if (!fallbackFontData) {
+    if (!fallbackFont) {
         UChar codeUnits[2];
         int codeUnitsLength;
         if (U_IS_BMP(character)) {
@@ -427,15 +427,15 @@ RefPtr<SimpleFontData> SimpleFontData::systemFallbackFontDataForCharacter(UChar3
             codeUnitsLength = 2;
         }
 
-        fallbackFontData = fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
-        if (fallbackFontData)
-            fallbackFontData->m_isUsedInSystemFallbackCache = true;
+        fallbackFont = fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
+        if (fallbackFont)
+            fallbackFont->m_isUsedInSystemFallbackCache = true;
     }
 
-    return fallbackFontData;
+    return fallbackFont;
 }
 
-void SimpleFontData::removeFromSystemFallbackCache()
+void Font::removeFromSystemFallbackCache()
 {
     systemFallbackCache().remove(this);
 
similarity index 74%
rename from Source/WebCore/platform/graphics/SimpleFontData.h
rename to Source/WebCore/platform/graphics/Font.h
index 479cd1a..fc52a60 100644 (file)
  *
  */
 
-#ifndef SimpleFontData_h
-#define SimpleFontData_h
+#ifndef Font_h
+#define Font_h
 
+#include "FloatRect.h"
 #include "FontBaseline.h"
 #include "FontMetrics.h"
 #include "FontPlatformData.h"
-#include "FloatRect.h"
 #include "GlyphBuffer.h"
 #include "GlyphMetricsMap.h"
 #include "GlyphPage.h"
@@ -64,36 +64,36 @@ class SharedBuffer;
 struct GlyphData;
 struct WidthIterator;
 
-enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
+enum FontVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
 
-class SimpleFontData : public RefCounted<SimpleFontData> {
+class Font : public RefCounted<Font> {
 public:
     class SVGData {
         WTF_MAKE_FAST_ALLOCATED;
     public:
         virtual ~SVGData() { }
 
-        virtual void initializeFontData(SimpleFontData*, float fontSize) = 0;
+        virtual void initializeFont(Font*, float fontSize) = 0;
         virtual float widthForSVGGlyph(Glyph, float fontSize) const = 0;
-        virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const = 0;
+        virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font*) const = 0;
     };
 
     // Used to create platform fonts.
-    static Ref<SimpleFontData> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false)
+    static Ref<Font> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false)
     {
-        return adoptRef(*new SimpleFontData(platformData, isCustomFont, isLoading, isTextOrientationFallback));
+        return adoptRef(*new Font(platformData, isCustomFont, isLoading, isTextOrientationFallback));
     }
 
     // Used to create SVG Fonts.
-    static Ref<SimpleFontData> create(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
+    static Ref<Font> create(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
     {
-        return adoptRef(*new SimpleFontData(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic));
+        return adoptRef(*new Font(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic));
     }
 
-    ~SimpleFontData();
+    ~Font();
 
-    static const SimpleFontData* systemFallback() { return reinterpret_cast<const SimpleFontData*>(-1); }
+    static const Font* systemFallback() { return reinterpret_cast<const Font*>(-1); }
 
     const FontPlatformData& platformData() const { return m_platformData; }
     const OpenTypeMathData* mathData() const;
@@ -101,30 +101,30 @@ public:
     const OpenTypeVerticalData* verticalData() const { return m_verticalData.get(); }
 #endif
 
-    PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const;
-    PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) const;
-    PassRefPtr<SimpleFontData> brokenIdeographFontData() const;
-    PassRefPtr<SimpleFontData> nonSyntheticItalicFontData() const;
+    PassRefPtr<Font> smallCapsFont(const FontDescription&) const;
+    PassRefPtr<Font> emphasisMarkFont(const FontDescription&) const;
+    PassRefPtr<Font> brokenIdeographFont() const;
+    PassRefPtr<Font> nonSyntheticItalicFont() const;
 
-    PassRefPtr<SimpleFontData> variantFontData(const FontDescription& description, FontDataVariant variant) const
+    PassRefPtr<Font> variantFont(const FontDescription& description, FontVariant variant) const
     {
         switch (variant) {
         case SmallCapsVariant:
-            return smallCapsFontData(description);
+            return smallCapsFont(description);
         case EmphasisMarkVariant:
-            return emphasisMarkFontData(description);
+            return emphasisMarkFont(description);
         case BrokenIdeographVariant:
-            return brokenIdeographFontData();
+            return brokenIdeographFont();
         case AutoVariant:
         case NormalVariant:
             break;
         }
         ASSERT_NOT_REACHED();
-        return const_cast<SimpleFontData*>(this);
+        return const_cast<Font*>(this);
     }
 
-    PassRefPtr<SimpleFontData> verticalRightOrientationFontData() const;
-    PassRefPtr<SimpleFontData> uprightOrientationFontData() const;
+    PassRefPtr<Font> verticalRightOrientationFont() const;
+    PassRefPtr<Font> uprightOrientationFont() const;
 
     bool hasVerticalGlyphs() const { return m_hasVerticalGlyphs; }
     bool isTextOrientationFallback() const { return m_isTextOrientationFallback; }
@@ -140,7 +140,7 @@ public:
     void setAvgCharWidth(float avgCharWidth) { m_avgCharWidth = avgCharWidth; }
 
     FloatRect boundsForGlyph(Glyph) const;
-    float widthForGlyph(Glyph glyph) const;
+    float widthForGlyph(Glyph) const;
     FloatRect platformBoundsForGlyph(Glyph) const;
     float platformWidthForGlyph(Glyph) const;
 
@@ -167,7 +167,7 @@ public:
     GlyphData glyphDataForCharacter(UChar32) const;
     Glyph glyphForCharacter(UChar32) const;
 
-    RefPtr<SimpleFontData> systemFallbackFontDataForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;
+    RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;
 
     const GlyphPage* glyphPage(unsigned pageNumber) const;
 
@@ -185,7 +185,7 @@ public:
 #endif
 
 #if USE(APPKIT)
-    const SimpleFontData* compositeFontReferenceFontData(NSFont *key) const;
+    const Font* compositeFontReferenceFont(NSFont *key) const;
     NSFont* getNSFont() const { return m_platformData.nsFont(); }
 #endif
 
@@ -213,9 +213,9 @@ public:
 #endif
 
 private:
-    SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false);
+    Font(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false);
 
-    SimpleFontData(std::unique_ptr<SVGData>, float fontSize, bool syntheticBold, bool syntheticItalic);
+    Font(std::unique_ptr<SVGData>, float fontSize, bool syntheticBold, bool syntheticItalic);
 
     void platformInit();
     void platformGlyphInit();
@@ -224,20 +224,20 @@ private:
 
     void initCharWidths();
 
-    PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, float scaleFactor) const;
-    PassRefPtr<SimpleFontData> platformCreateScaledFontData(const FontDescription&, float scaleFactor) const;
+    PassRefPtr<Font> createScaledFont(const FontDescription&, float scaleFactor) const;
+    PassRefPtr<Font> platformCreateScaledFont(const FontDescription&, float scaleFactor) const;
 
     void removeFromSystemFallbackCache();
 
 #if PLATFORM(WIN)
     void initGDIFont();
     void platformCommonDestroy();
-    FloatRect boundsForGDIGlyph(Glyph glyph) const;
-    float widthForGDIGlyph(Glyph glyph) const;
+    FloatRect boundsForGDIGlyph(Glyph) const;
+    float widthForGDIGlyph(Glyph) const;
 #endif
 
 #if USE(CG)
-    bool canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const;
+    bool canUseFastGlyphAdvanceGetter(Glyph, CGSize& advance, bool& populatedAdvance) const;
     CGFontRenderingStyle renderingStyle() const;
     bool advanceForColorBitmapFont(Glyph, CGSize& result) const; // Returns true if the font is a color bitmap font
 #endif
@@ -255,7 +255,7 @@ private:
     mutable GlyphMetricsMap<float> m_glyphToWidthMap;
 
     bool m_treatAsFixedPitch;
-    bool m_isCustomFont;  // Whether or not we are custom font loaded via @font-face
+    bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face
     bool m_isLoading; // Whether or not this custom font is still in the act of loading.
 
     bool m_isTextOrientationFallback;
@@ -284,14 +284,14 @@ private:
         ~DerivedFontData();
 
         bool forCustomFont;
-        RefPtr<SimpleFontData> smallCaps;
-        RefPtr<SimpleFontData> emphasisMark;
-        RefPtr<SimpleFontData> brokenIdeograph;
-        RefPtr<SimpleFontData> verticalRightOrientation;
-        RefPtr<SimpleFontData> uprightOrientation;
-        RefPtr<SimpleFontData> nonSyntheticItalic;
+        RefPtr<Font> smallCaps;
+        RefPtr<Font> emphasisMark;
+        RefPtr<Font> brokenIdeograph;
+        RefPtr<Font> verticalRightOrientation;
+        RefPtr<Font> uprightOrientation;
+        RefPtr<Font> nonSyntheticItalic;
 #if USE(APPKIT)
-        HashMap<NSFont*, RefPtr<SimpleFontData>> compositeFontReferences;
+        HashMap<NSFont*, RefPtr<Font>> compositeFontReferences;
 #endif
     };
 
@@ -319,7 +319,7 @@ private:
 #endif
 };
 
-ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const
+ALWAYS_INLINE FloatRect Font::boundsForGlyph(Glyph glyph) const
 {
     if (isZeroWidthSpaceGlyph(glyph))
         return FloatRect();
@@ -338,7 +338,7 @@ ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const
     return bounds;
 }
 
-ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const
+ALWAYS_INLINE float Font::widthForGlyph(Glyph glyph) const
 {
     if (isZeroWidthSpaceGlyph(glyph))
         return 0;
@@ -366,4 +366,4 @@ ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const
 
 } // namespace WebCore
 
-#endif // SimpleFontData_h
+#endif // Font_h
index 1463bba..a1de300 100644 (file)
 #include <wtf/Noncopyable.h>
 
 // FIXME: We may be able to simplify this code using C++11 threading primitives, including std::call_once().
-static pthread_mutex_t fontDataLock;
+static pthread_mutex_t fontLock;
 
 static void initFontCacheLockOnce()
 {
     pthread_mutexattr_t mutexAttribute;
     pthread_mutexattr_init(&mutexAttribute);
     pthread_mutexattr_settype(&mutexAttribute, PTHREAD_MUTEX_RECURSIVE);
-    pthread_mutex_init(&fontDataLock, &mutexAttribute);
+    pthread_mutex_init(&fontLock, &mutexAttribute);
     pthread_mutexattr_destroy(&mutexAttribute);
 }
 
@@ -71,13 +71,13 @@ public:
     FontLocker()
     {
         pthread_once(&initFontLockControl, initFontCacheLockOnce);
-        int lockcode = pthread_mutex_lock(&fontDataLock);
-        ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontDataLock lock failed with code:%d", lockcode);    
+        int lockcode = pthread_mutex_lock(&fontLock);
+        ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock lock failed with code:%d", lockcode);    
     }
     ~FontLocker()
     {
-        int lockcode = pthread_mutex_unlock(&fontDataLock);
-        ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontDataLock unlock failed with code:%d", lockcode);
+        int lockcode = pthread_mutex_unlock(&fontLock);
+        ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock unlock failed with code:%d", lockcode);
     }
 };
 #endif // PLATFORM(IOS)
@@ -359,7 +359,7 @@ struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> {
     }
 };
 
-typedef HashMap<FontPlatformData, RefPtr<SimpleFontData>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
+typedef HashMap<FontPlatformData, RefPtr<Font>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
 
 static FontDataCache& cachedFonts()
 {
@@ -379,7 +379,7 @@ const int cTargetInactiveFontData = 200;
 const int cMaxUnderMemoryPressureInactiveFontData = 50;
 const int cTargetUnderMemoryPressureInactiveFontData = 30;
 
-RefPtr<SimpleFontData> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
+RefPtr<Font> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
 {
     if (!m_purgeTimer.isActive())
         m_purgeTimer.startOneShot(std::chrono::milliseconds::zero());
@@ -391,7 +391,7 @@ RefPtr<SimpleFontData> FontCache::fontForFamily(const FontDescription& fontDescr
     return fontForPlatformData(*platformData);
 }
 
-Ref<SimpleFontData> FontCache::fontForPlatformData(const FontPlatformData& platformData)
+Ref<Font> FontCache::fontForPlatformData(const FontPlatformData& platformData)
 {
 #if PLATFORM(IOS)
     FontLocker fontLocker;
@@ -399,7 +399,7 @@ Ref<SimpleFontData> FontCache::fontForPlatformData(const FontPlatformData& platf
     
     auto addResult = cachedFonts().add(platformData, nullptr);
     if (addResult.isNewEntry)
-        addResult.iterator->value = SimpleFontData::create(platformData);
+        addResult.iterator->value = Font::create(platformData);
 
     return *addResult.iterator->value;
 }
@@ -416,7 +416,7 @@ void FontCache::purgeInactiveFontDataIfNeeded()
 
     if (cachedFonts().size() < inactiveFontDataLimit)
         return;
-    int inactiveCount = inactiveFontDataCount();
+    int inactiveCount = inactiveFontCount();
     if (inactiveCount <= inactiveFontDataLimit)
         return;
 
@@ -434,7 +434,7 @@ void FontCache::purgeInactiveFontData(int purgeCount)
 #endif
 
     while (purgeCount) {
-        Vector<RefPtr<SimpleFontData>, 20> fontsToDelete;
+        Vector<RefPtr<Font>, 20> fontsToDelete;
         for (auto& font : cachedFonts().values()) {
             if (!font->hasOneRef())
                 continue;
@@ -466,8 +466,8 @@ void FontCache::purgeInactiveFontData(int purgeCount)
             if (verticalData)
                 verticalData->m_inFontCache = false;
         }
-        for (auto& fontData : cachedFonts().values()) {
-            auto* verticalData = const_cast<OpenTypeVerticalData*>(fontData->verticalData());
+        for (auto& font : cachedFonts().values()) {
+            auto* verticalData = const_cast<OpenTypeVerticalData*>(font->verticalData());
             if (verticalData)
                 verticalData->m_inFontCache = true;
         }
@@ -483,12 +483,12 @@ void FontCache::purgeInactiveFontData(int purgeCount)
 #endif
 }
 
-size_t FontCache::fontDataCount()
+size_t FontCache::fontCount()
 {
     return cachedFonts().size();
 }
 
-size_t FontCache::inactiveFontDataCount()
+size_t FontCache::inactiveFontCount()
 {
 #if PLATFORM(IOS)
     FontLocker fontLocker;
@@ -551,7 +551,7 @@ void FontCache::invalidate()
 }
 
 #if !PLATFORM(COCOA)
-RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&)
+RefPtr<Font> FontCache::similarFont(const FontDescription&)
 {
     return nullptr;
 }
index 8e5100d..d88454e 100644 (file)
@@ -55,7 +55,7 @@ class FontCascade;
 class FontPlatformData;
 class FontSelector;
 class OpenTypeVerticalData;
-class SimpleFontData;
+class Font;
 
 #if PLATFORM(WIN)
 #if USE(IMLANG_FONT_LINK2)
@@ -111,7 +111,7 @@ public:
     friend FontCache& fontCache();
 
     // This method is implemented by the platform.
-    RefPtr<SimpleFontData> systemFallbackForCharacters(const FontDescription&, const SimpleFontData* originalFontData, bool isPlatformFont, const UChar* characters, int length);
+    RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length);
 
     // Also implemented by the platform.
     void platformInit();
@@ -128,10 +128,10 @@ public:
 
     void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
 
-    WEBCORE_EXPORT RefPtr<SimpleFontData> fontForFamily(const FontDescription&, const AtomicString&, bool checkingAlternateName = false);
-    WEBCORE_EXPORT Ref<SimpleFontData> lastResortFallbackFont(const FontDescription&);
-    WEBCORE_EXPORT Ref<SimpleFontData> fontForPlatformData(const FontPlatformData&);
-    RefPtr<SimpleFontData> similarFontPlatformData(const FontDescription&);
+    WEBCORE_EXPORT RefPtr<Font> fontForFamily(const FontDescription&, const AtomicString&, bool checkingAlternateName = false);
+    WEBCORE_EXPORT Ref<Font> lastResortFallbackFont(const FontDescription&);
+    WEBCORE_EXPORT Ref<Font> fontForPlatformData(const FontPlatformData&);
+    RefPtr<Font> similarFont(const FontDescription&);
 
     void addClient(FontSelector*);
     void removeClient(FontSelector*);
@@ -139,12 +139,12 @@ public:
     unsigned short generation();
     WEBCORE_EXPORT void invalidate();
 
-    WEBCORE_EXPORT size_t fontDataCount();
-    WEBCORE_EXPORT size_t inactiveFontDataCount();
+    WEBCORE_EXPORT size_t fontCount();
+    WEBCORE_EXPORT size_t inactiveFontCount();
     WEBCORE_EXPORT void purgeInactiveFontData(int count = INT_MAX);
 
 #if PLATFORM(WIN)
-    RefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
+    RefPtr<Font> fontFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
 #endif
 
 #if ENABLE(OPENTYPE_VERTICAL)
@@ -173,7 +173,7 @@ private:
     // These methods are implemented by each platform.
 #if PLATFORM(IOS)
     FontPlatformData* getCustomFallbackFont(const UInt32, const FontDescription&);
-    PassRefPtr<SimpleFontData> getSystemFontFallbackForCharacters(const FontDescription&, const SimpleFontData*, const UChar* characters, int length);
+    PassRefPtr<Font> getSystemFontFallbackForCharacters(const FontDescription&, const Font*, const UChar* characters, int length);
 #endif
     std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family);
 
@@ -182,7 +182,7 @@ private:
 #if PLATFORM(COCOA)
     friend class ComplexTextController;
 #endif
-    friend class SimpleFontData;
+    friend class Font;
 };
 
 // Get the global fontCache.
index d68bf1b..355b36e 100644 (file)
@@ -124,8 +124,8 @@ FontCascade::FontCascade(const FontDescription& fd, float letterSpacing, float w
 }
 
 // FIXME: We should make this constructor platform-independent.
-FontCascade::FontCascade(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
-    : m_glyphs(FontGlyphs::createForPlatformFont(fontData))
+FontCascade::FontCascade(const FontPlatformData& font, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
+    : m_glyphs(FontGlyphs::createForPlatformFont(font))
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_useBackslashAsYenSymbol(false)
@@ -134,27 +134,27 @@ FontCascade::FontCascade(const FontPlatformData& fontData, bool isPrinterFont, F
     m_fontDescription.setUsePrinterFont(isPrinterFont);
     m_fontDescription.setFontSmoothing(fontSmoothingMode);
 #if PLATFORM(IOS)
-    m_fontDescription.setSpecifiedSize(CTFontGetSize(fontData.font()));
-    m_fontDescription.setComputedSize(CTFontGetSize(fontData.font()));
-    m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitItalic);
-    m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
+    m_fontDescription.setSpecifiedSize(CTFontGetSize(font.font()));
+    m_fontDescription.setComputedSize(CTFontGetSize(font.font()));
+    m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(font.font()) & kCTFontTraitItalic);
+    m_fontDescription.setWeight((CTFontGetSymbolicTraits(font.font()) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
 #endif
 }
 
 // FIXME: We should make this constructor platform-independent.
 #if PLATFORM(IOS)
-FontCascade::FontCascade(const FontPlatformData& fontData, PassRefPtr<FontSelector> fontSelector)
-    : m_glyphs(FontGlyphs::createForPlatformFont(fontData))
+FontCascade::FontCascade(const FontPlatformData& font, PassRefPtr<FontSelector> fontSelector)
+    : m_glyphs(FontGlyphs::createForPlatformFont(font))
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_typesettingFeatures(computeTypesettingFeatures())
 {
-    CTFontRef primaryFont = fontData.font();
+    CTFontRef primaryFont = font.font();
     m_fontDescription.setSpecifiedSize(CTFontGetSize(primaryFont));
     m_fontDescription.setComputedSize(CTFontGetSize(primaryFont));
     m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitItalic);
     m_fontDescription.setWeight((CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
-    m_fontDescription.setUsePrinterFont(fontData.isPrinterFont());
+    m_fontDescription.setUsePrinterFont(font.isPrinterFont());
     m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get());
 }
 #endif
@@ -371,7 +371,7 @@ void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run
         drawEmphasisMarksForComplexText(context, run, mark, point, from, to);
 }
 
-float FontCascade::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::width(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     CodePath codePathToUse = codePath(run);
     if (codePathToUse != Complex) {
@@ -389,7 +389,7 @@ float FontCascade::width(const TextRun& run, HashSet<const SimpleFontData*>* fal
     if (cacheEntry && !std::isnan(*cacheEntry))
         return *cacheEntry;
 
-    HashSet<const SimpleFontData*> localFallbackFonts;
+    HashSet<const Font*> localFallbackFonts;
     if (!fallbackFonts)
         fallbackFonts = &localFallbackFonts;
 
@@ -416,10 +416,10 @@ float FontCascade::width(const TextRun& run, int& charsConsumed, String& glyphNa
     return width(run);
 }
 
-GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant) const
+GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontVariant variant) const
 {
     if (variant == AutoVariant) {
-        if (m_fontDescription.smallCaps() && !primaryFontData().isSVGFont()) {
+        if (m_fontDescription.smallCaps() && !primaryFont().isSVGFont()) {
             UChar32 upperC = u_toupper(c);
             if (upperC != c) {
                 c = upperC;
@@ -446,7 +446,7 @@ void FontCascade::deleteLayout(TextLayout*)
 {
 }
 
-float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const SimpleFontData*>*)
+float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*)
 {
     ASSERT_NOT_REACHED();
     return 0;
@@ -505,7 +505,7 @@ bool FontCascade::hasValidAverageCharWidth() const
 
 #if PLATFORM(MAC) || PLATFORM(IOS)
     // Internal fonts on OS X and iOS also have an invalid entry in the table for avgCharWidth.
-    if (primaryFontDataIsSystemFont())
+    if (primaryFontIsSystemFont())
         return false;
 #endif
 
@@ -525,7 +525,7 @@ bool FontCascade::fastAverageCharWidthIfAvailable(float& width) const
 {
     bool success = hasValidAverageCharWidth();
     if (success)
-        width = roundf(primaryFontData().avgCharWidth()); // FIXME: primaryFontData() might not correspond to firstFamily().
+        width = roundf(primaryFont().avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily().
     return success;
 }
 
@@ -1173,7 +1173,7 @@ int FontCascade::emphasisMarkAscent(const AtomicString& mark) const
     if (!getEmphasisMarkGlyphData(mark, markGlyphData))
         return 0;
 
-    const SimpleFontData* markFontData = markGlyphData.fontData;
+    const Font* markFontData = markGlyphData.font;
     ASSERT(markFontData);
     if (!markFontData)
         return 0;
@@ -1187,7 +1187,7 @@ int FontCascade::emphasisMarkDescent(const AtomicString& mark) const
     if (!getEmphasisMarkGlyphData(mark, markGlyphData))
         return 0;
 
-    const SimpleFontData* markFontData = markGlyphData.fontData;
+    const Font* markFontData = markGlyphData.font;
     ASSERT(markFontData);
     if (!markFontData)
         return 0;
@@ -1201,7 +1201,7 @@ int FontCascade::emphasisMarkHeight(const AtomicString& mark) const
     if (!getEmphasisMarkGlyphData(mark, markGlyphData))
         return 0;
 
-    const SimpleFontData* markFontData = markGlyphData.fontData;
+    const Font* markFontData = markGlyphData.font;
     ASSERT(markFontData);
     if (!markFontData)
         return 0;
@@ -1273,7 +1273,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun& run,
 #endif
 
     // Draw each contiguous run of glyphs that use the same font data.
-    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
+    const Font* fontData = glyphBuffer.fontAt(0);
     FloatSize offset = glyphBuffer.offsetAt(0);
     FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
     float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
@@ -1284,7 +1284,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun& run,
     TextRun::RenderingContext* renderingContext = run.renderingContext();
 #endif
     while (nextGlyph < glyphBuffer.size()) {
-        const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
+        const Font* nextFontData = glyphBuffer.fontAt(nextGlyph);
         FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
 
         if (nextFontData != fontData || nextOffset != offset) {
@@ -1317,7 +1317,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun& run,
     }
 }
 
-inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)
+inline static float offsetToMiddleOfGlyph(const Font* fontData, Glyph glyph)
 {
     if (fontData->platformData().orientation() == Horizontal) {
         FloatRect bounds = fontData->boundsForGlyph(glyph);
@@ -1329,7 +1329,7 @@ inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph
 
 inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
 {
-    return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
+    return offsetToMiddleOfGlyph(glyphBuffer.fontAt(i), glyphBuffer.glyphAt(i));
 }
 
 void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
@@ -1338,7 +1338,7 @@ void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run
     if (!getEmphasisMarkGlyphData(mark, markGlyphData))
         return;
 
-    const SimpleFontData* markFontData = markGlyphData.fontData;
+    const Font* markFontData = markGlyphData.font;
     ASSERT(markFontData);
     if (!markFontData)
         return;
@@ -1361,7 +1361,7 @@ void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run
     drawGlyphBuffer(context, run, markBuffer, startPoint);
 }
 
-float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     WidthIterator it(this, run, fallbackFonts, glyphOverflow);
     GlyphBuffer glyphBuffer;
index 8825500..8c33abe 100644 (file)
 #define FontCascade_h
 
 #include "DashArray.h"
+#include "Font.h"
 #include "FontDescription.h"
 #include "FontGlyphs.h"
 #include "Path.h"
-#include "SimpleFontData.h"
 #include "TextDirection.h"
 #include "TypesettingFeatures.h"
 #include <wtf/HashMap.h>
@@ -134,17 +134,17 @@ public:
 
     enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
     WEBCORE_EXPORT float drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
-    void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const;
+    void drawGlyphs(GraphicsContext*, const Font*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const;
     void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1) const;
 
     DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const;
 
-    WEBCORE_EXPORT float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+    WEBCORE_EXPORT float width(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     float width(const TextRun&, int& charsConsumed, String& glyphName) const;
 
     PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWhiteSpace) const;
     static void deleteLayout(TextLayout*);
-    static float width(TextLayout&, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts = 0);
+    static float width(TextLayout&, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts = 0);
 
     int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const;
     void adjustSelectionRectForText(const TextRun&, LayoutRect& selectionRect, int from = 0, int to = -1) const;
@@ -172,10 +172,10 @@ public:
 
     bool isPlatformFont() const { return m_glyphs->isForPlatformFont(); }
 
-    const FontMetrics& fontMetrics() const { return primaryFontData().fontMetrics(); }
-    float spaceWidth() const { return primaryFontData().spaceWidth() + m_letterSpacing; }
-    float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const;
-    float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFontData(), tabSize, position); }
+    const FontMetrics& fontMetrics() const { return primaryFont().fontMetrics(); }
+    float spaceWidth() const { return primaryFont().spaceWidth() + m_letterSpacing; }
+    float tabWidth(const Font&, unsigned tabSize, float position) const;
+    float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFont(), tabSize, position); }
     bool hasValidAverageCharWidth() const;
     bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success
 
@@ -183,12 +183,12 @@ public:
     int emphasisMarkDescent(const AtomicString&) const;
     int emphasisMarkHeight(const AtomicString&) const;
 
-    const SimpleFontData& primaryFontData() const;
+    const Font& primaryFont() const;
     const FontRanges& fallbackRangesAt(unsigned) const;
-    GlyphData glyphDataForCharacter(UChar32, bool mirror, FontDataVariant = AutoVariant) const;
+    GlyphData glyphDataForCharacter(UChar32, bool mirror, FontVariant = AutoVariant) const;
     
 #if PLATFORM(COCOA)
-    const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, size_t length, FontDataVariant) const;
+    const Font* fontForCombiningCharacterSequence(const UChar*, size_t length, FontVariant) const;
 #endif
 
     static bool isCJKIdeograph(UChar32);
@@ -207,7 +207,7 @@ public:
     static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simple; }
     static CodePath characterRangeCodePath(const UChar*, unsigned len);
 
-    bool primaryFontDataIsSystemFont() const;
+    bool primaryFontIsSystemFont() const;
 
 private:
     enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
@@ -218,7 +218,7 @@ private:
     void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
     void drawGlyphBuffer(GraphicsContext*, const TextRun&, const GlyphBuffer&, FloatPoint&) const;
     void drawEmphasisMarks(GraphicsContext*, const TextRun&, const GlyphBuffer&, const AtomicString&, const FloatPoint&) const;
-    float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+    float floatWidthForSimpleText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const;
     void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, int from, int to) const;
 
@@ -231,7 +231,7 @@ private:
     float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
     float drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
     void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
-    float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+    float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
     void adjustSelectionRectForComplexText(const TextRun&, LayoutRect& selectionRect, int from, int to) const;
 
@@ -352,10 +352,10 @@ inline FontCascade::~FontCascade()
 {
 }
 
-inline const SimpleFontData& FontCascade::primaryFontData() const
+inline const Font& FontCascade::primaryFont() const
 {
     ASSERT(m_glyphs);
-    return m_glyphs->primarySimpleFontData(m_fontDescription);
+    return m_glyphs->primaryFont(m_fontDescription);
 }
 
 inline const FontRanges& FontCascade::fallbackRangesAt(unsigned index) const
@@ -375,13 +375,13 @@ inline FontSelector* FontCascade::fontSelector() const
     return m_glyphs ? m_glyphs->fontSelector() : 0;
 }
 
-inline float FontCascade::tabWidth(const SimpleFontData& fontData, unsigned tabSize, float position) const
+inline float FontCascade::tabWidth(const Font& font, unsigned tabSize, float position) const
 {
     if (!tabSize)
         return letterSpacing();
-    float tabWidth = tabSize * fontData.spaceWidth() + letterSpacing();
+    float tabWidth = tabSize * font.spaceWidth() + letterSpacing();
     float tabDeltaWidth = tabWidth - fmodf(position, tabWidth);
-    return (tabDeltaWidth < fontData.spaceWidth() / 2) ? tabWidth : tabDeltaWidth;
+    return (tabDeltaWidth < font.spaceWidth() / 2) ? tabWidth : tabDeltaWidth;
 }
 
 }
index f6d3709..839cac5 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
 
 
 FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector)
-    : m_cachedPrimarySimpleFontData(0)
+    : m_cachedPrimaryFont(0)
     , m_fontSelector(fontSelector)
     , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)
     , m_generation(fontCache().generation())
@@ -45,7 +45,7 @@ FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector)
 }
 
 FontGlyphs::FontGlyphs(const FontPlatformData& platformData)
-    : m_cachedPrimarySimpleFontData(0)
+    : m_cachedPrimaryFont(0)
     , m_fontSelector(0)
     , m_fontSelectorVersion(0)
     , m_generation(fontCache().generation())
@@ -63,7 +63,7 @@ void FontGlyphs::determinePitch(const FontDescription& description)
     auto& primaryRanges = realizeFallbackRangesAt(description, 0);
     unsigned numRanges = primaryRanges.size();
     if (numRanges == 1)
-        m_pitch = primaryRanges.rangeAt(0).fontData().pitch();
+        m_pitch = primaryRanges.rangeAt(0).font().pitch();
     else
         m_pitch = VariablePitch;
 }
@@ -96,7 +96,7 @@ static FontRanges realizeNextFallback(const FontDescription& description, unsign
     // We didn't find a font. Try to find a similar font using our own specific knowledge about our platform.
     // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the
     // Geeza Pro font.
-    return FontRanges(fontCache().similarFontPlatformData(description));
+    return FontRanges(fontCache().similarFont(description));
 }
 
 const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& description, unsigned index)
@@ -126,10 +126,10 @@ const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& des
         ASSERT(m_lastRealizedFallbackIndex >= description.familyCount());
 
         unsigned fontSelectorFallbackIndex = m_lastRealizedFallbackIndex - description.familyCount();
-        if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontDataCount())
+        if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontCount())
             return fontRanges;
         ++m_lastRealizedFallbackIndex;
-        fontRanges = FontRanges(m_fontSelector->fallbackFontDataAt(description, fontSelectorFallbackIndex));
+        fontRanges = FontRanges(m_fontSelector->fallbackFontAt(description, fontSelectorFallbackIndex));
     }
 
     return fontRanges;
@@ -221,8 +221,8 @@ static bool shouldIgnoreRotation(UChar32 character)
 #if PLATFORM(COCOA)
 static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 character, GlyphData& data)
 {
-    GlyphData nonItalicData = data.fontData->nonSyntheticItalicFontData()->glyphDataForCharacter(character);
-    if (nonItalicData.fontData)
+    GlyphData nonItalicData = data.font->nonSyntheticItalicFont()->glyphDataForCharacter(character);
+    if (nonItalicData.font)
         return nonItalicData;
     return data;
 }
@@ -231,76 +231,76 @@ static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 characte
 static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, const GlyphData& data)
 {
     if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) {
-        GlyphData uprightData = data.fontData->uprightOrientationFontData()->glyphDataForCharacter(character);
+        GlyphData uprightData = data.font->uprightOrientationFont()->glyphDataForCharacter(character);
         // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
         if (data.glyph == uprightData.glyph)
             return data;
         // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that
         // glyph, so we fall back to the upright data and use the horizontal glyph.
-        if (uprightData.fontData)
+        if (uprightData.font)
             return uprightData;
     } else if (orientation == NonCJKGlyphOrientationVerticalRight) {
-        GlyphData verticalRightData = data.fontData->verticalRightOrientationFontData()->glyphDataForCharacter(character);
+        GlyphData verticalRightData = data.font->verticalRightOrientationFont()->glyphDataForCharacter(character);
         // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked
         // into it.
         if (data.glyph != verticalRightData.glyph)
             return data;
         // The glyphs are identical, meaning that we should just use the horizontal glyph.
-        if (verticalRightData.fontData)
+        if (verticalRightData.font)
             return verticalRightData;
     }
     return data;
 }
 
-GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontDataVariant variant)
+GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontVariant variant)
 {
     // System fallback is character-dependent.
     auto& primaryRanges = realizeFallbackRangesAt(description, 0);
-    auto* originalFontData = primaryRanges.fontDataForCharacter(c);
-    if (!originalFontData)
-        originalFontData = &primaryRanges.fontDataForFirstRange();
+    auto* originalFont = primaryRanges.fontForCharacter(c);
+    if (!originalFont)
+        originalFont = &primaryRanges.fontForFirstRange();
 
-    RefPtr<SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont);
-    if (!systemFallbackFontData)
+    RefPtr<Font> systemFallbackFont = originalFont->systemFallbackFontForCharacter(c, description, m_isForPlatformFont);
+    if (!systemFallbackFont)
         return GlyphData();
 
-    if (systemFallbackFontData->platformData().orientation() == Vertical && !systemFallbackFontData->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))
+    if (systemFallbackFont->platformData().orientation() == Vertical && !systemFallbackFont->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))
         variant = BrokenIdeographVariant;
 
     GlyphData fallbackGlyphData;
     if (variant == NormalVariant)
-        fallbackGlyphData = systemFallbackFontData->glyphDataForCharacter(c);
+        fallbackGlyphData = systemFallbackFont->glyphDataForCharacter(c);
     else
-        fallbackGlyphData = systemFallbackFontData->variantFontData(description, variant)->glyphDataForCharacter(c);
+        fallbackGlyphData = systemFallbackFont->variantFont(description, variant)->glyphDataForCharacter(c);
 
-    if (variant == NormalVariant && fallbackGlyphData.fontData) {
-        if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.fontData->platformData().orientation() == Vertical && !fallbackGlyphData.fontData->isTextOrientationFallback())
+    if (variant == NormalVariant && fallbackGlyphData.font) {
+        if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.font->platformData().orientation() == Vertical && !fallbackGlyphData.font->isTextOrientationFallback())
             fallbackGlyphData = glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), fallbackGlyphData);
     }
 
     // Keep the system fallback fonts we use alive.
     if (fallbackGlyphData.glyph)
-        m_systemFallbackFontDataSet.add(systemFallbackFontData.release());
+        m_systemFallbackFontSet.add(systemFallbackFont.release());
 
     return fallbackGlyphData;
 }
 
-GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontDataVariant variant, unsigned fallbackIndex)
+GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontVariant variant, unsigned fallbackIndex)
 {
     while (true) {
         auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex++);
         if (fontRanges.isNull())
             break;
-        auto* fontData = fontRanges.fontDataForCharacter(c);
-        GlyphData data = fontData ? fontData->glyphDataForCharacter(c) : GlyphData();
-        if (data.fontData) {
-            // The variantFontData function should not normally return 0.
+        auto* font = fontRanges.fontForCharacter(c);
+        GlyphData data = font ? font->glyphDataForCharacter(c) : GlyphData();
+        if (data.font) {
+            // The variantFont function should not normally return 0.
             // But if it does, we will just render the capital letter big.
-            RefPtr<SimpleFontData> variantFontData = data.fontData->variantFontData(description, variant);
-            if (!variantFontData)
+            RefPtr<Font> variantFont = data.font->variantFont(description, variant);
+            if (!variantFont)
                 return data;
 
-            return variantFontData->glyphDataForCharacter(c);
+            return variantFont->glyphDataForCharacter(c);
         }
     }
 
@@ -315,23 +315,23 @@ GlyphData FontGlyphs::glyphDataForNormalVariant(UChar32 c, const FontDescription
         auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex);
         if (fontRanges.isNull())
             break;
-        auto* simpleFontData = fontRanges.fontDataForCharacter(c);
-        auto* page = simpleFontData ? simpleFontData->glyphPage(pageNumber) : nullptr;
+        auto* font = fontRanges.fontForCharacter(c);
+        auto* page = font ? font->glyphPage(pageNumber) : nullptr;
         if (!page)
             continue;
         GlyphData data = page->glyphDataForCharacter(c);
-        if (data.fontData) {
-            if (data.fontData->platformData().orientation() == Vertical && !data.fontData->isTextOrientationFallback()) {
+        if (data.font) {
+            if (data.font->platformData().orientation() == Vertical && !data.font->isTextOrientationFallback()) {
                 if (!FontCascade::isCJKIdeographOrSymbol(c))
                     return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data);
 
-                if (!data.fontData->hasVerticalGlyphs()) {
+                if (!data.font->hasVerticalGlyphs()) {
                     // Use the broken ideograph font data. The broken ideograph font will use the horizontal width of glyphs
                     // to make sure you get a square (even for broken glyphs like symbols used for punctuation).
                     return glyphDataForVariant(c, description, BrokenIdeographVariant, fallbackIndex);
                 }
 #if PLATFORM(COCOA)
-                if (data.fontData->platformData().syntheticOblique())
+                if (data.font->platformData().syntheticOblique())
                     return glyphDataForCJKCharacterWithoutSyntheticItalic(c, data);
 #endif
             }
@@ -345,27 +345,27 @@ GlyphData FontGlyphs::glyphDataForNormalVariant(UChar32 c, const FontDescription
 
 static RefPtr<GlyphPage> glyphPageFromFontRanges(unsigned pageNumber, const FontRanges& fontRanges)
 {
-    const SimpleFontData* simpleFontData = nullptr;
+    const Font* font = nullptr;
     UChar32 pageRangeFrom = pageNumber * GlyphPage::size;
     UChar32 pageRangeTo = pageRangeFrom + GlyphPage::size - 1;
     for (unsigned i = 0; i < fontRanges.size(); ++i) {
         auto& range = fontRanges.rangeAt(i);
         if (range.to()) {
             if (range.from() <= pageRangeFrom && pageRangeTo <= range.to())
-                simpleFontData = &range.fontData();
+                font = &range.font();
             break;
         }
     }
-    if (!simpleFontData)
+    if (!font)
         return nullptr;
 
-    if (simpleFontData->platformData().orientation() == Vertical)
+    if (font->platformData().orientation() == Vertical)
         return nullptr;
 
-    return const_cast<GlyphPage*>(simpleFontData->glyphPage(pageNumber));
+    return const_cast<GlyphPage*>(font->glyphPage(pageNumber));
 }
 
-GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontDataVariant variant)
+GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontVariant variant)
 {
     ASSERT(isMainThread());
     ASSERT(variant != AutoVariant);
@@ -382,19 +382,19 @@ GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& de
     GlyphData glyphData = cachedPage ? cachedPage->glyphDataForCharacter(c) : GlyphData();
     if (!glyphData.glyph) {
         if (!cachedPage)
-            cachedPage = GlyphPage::createForMixedFontData();
+            cachedPage = GlyphPage::createForMixedFonts();
         else if (cachedPage->isImmutable())
-            cachedPage = GlyphPage::createCopyForMixedFontData(*cachedPage);
+            cachedPage = GlyphPage::createCopyForMixedFonts(*cachedPage);
 
         glyphData = glyphDataForNormalVariant(c, description);
-        cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.fontData);
+        cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font);
     }
     return glyphData;
 }
 
 void FontGlyphs::pruneSystemFallbacks()
 {
-    if (m_systemFallbackFontDataSet.isEmpty())
+    if (m_systemFallbackFontSet.isEmpty())
         return;
     // Mutable glyph pages may reference fallback fonts.
     if (m_cachedPageZero && !m_cachedPageZero->isImmutable())
@@ -402,7 +402,7 @@ void FontGlyphs::pruneSystemFallbacks()
     m_cachedPages.removeIf([](decltype(m_cachedPages)::KeyValuePairType& keyAndValue) {
         return !keyAndValue.value->isImmutable();
     });
-    m_systemFallbackFontDataSet.clear();
+    m_systemFallbackFontSet.clear();
 }
 
 }
index af539c3..06f9781 100644 (file)
 #ifndef FontGlyphs_h
 #define FontGlyphs_h
 
+#include "Font.h"
 #include "FontRanges.h"
 #include "FontSelector.h"
 #include "GlyphPage.h"
-#include "SimpleFontData.h"
 #include "WidthCache.h"
 #include <wtf/Forward.h>
 #include <wtf/MainThread.h>
@@ -51,7 +51,7 @@ public:
 
     bool isForPlatformFont() const { return m_isForPlatformFont; }
 
-    GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontDataVariant);
+    GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontVariant);
 
     bool isFixedPitch(const FontDescription&);
     void determinePitch(const FontDescription&);
@@ -66,7 +66,7 @@ public:
     WidthCache& widthCache() { return m_widthCache; }
     const WidthCache& widthCache() const { return m_widthCache; }
 
-    const SimpleFontData& primarySimpleFontData(const FontDescription&);
+    const Font& primaryFont(const FontDescription&);
     WEBCORE_EXPORT const FontRanges& realizeFallbackRangesAt(const FontDescription&, unsigned fallbackIndex);
 
     void pruneSystemFallbacks();
@@ -75,9 +75,9 @@ private:
     FontGlyphs(PassRefPtr<FontSelector>);
     FontGlyphs(const FontPlatformData&);
 
-    GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontDataVariant);
+    GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontVariant);
     GlyphData glyphDataForNormalVariant(UChar32, const FontDescription&);
-    GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontDataVariant, unsigned fallbackIndex);
+    GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontVariant, unsigned fallbackIndex);
 
     Vector<FontRanges, 1> m_realizedFallbackRanges;
     unsigned m_lastRealizedFallbackIndex { 0 };
@@ -85,9 +85,9 @@ private:
     RefPtr<GlyphPage> m_cachedPageZero;
     HashMap<int, RefPtr<GlyphPage>> m_cachedPages;
 
-    HashSet<RefPtr<SimpleFontData>> m_systemFallbackFontDataSet;
+    HashSet<RefPtr<Font>> m_systemFallbackFontSet;
 
-    const SimpleFontData* m_cachedPrimarySimpleFontData;
+    const Font* m_cachedPrimaryFont;
     RefPtr<FontSelector> m_fontSelector;
 
     WidthCache m_widthCache;
@@ -105,16 +105,16 @@ inline bool FontGlyphs::isFixedPitch(const FontDescription& description)
     return m_pitch == FixedPitch;
 };
 
-inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescription& description)
+inline const Font& FontGlyphs::primaryFont(const FontDescription& description)
 {
     ASSERT(isMainThread());
-    if (!m_cachedPrimarySimpleFontData) {
+    if (!m_cachedPrimaryFont) {
         auto& primaryRanges = realizeFallbackRangesAt(description, 0);
-        m_cachedPrimarySimpleFontData = primaryRanges.fontDataForCharacter(' ');
-        if (!m_cachedPrimarySimpleFontData)
-            m_cachedPrimarySimpleFontData = &primaryRanges.fontDataForFirstRange();
+        m_cachedPrimaryFont = primaryRanges.fontForCharacter(' ');
+        if (!m_cachedPrimaryFont)
+            m_cachedPrimaryFont = &primaryRanges.fontForFirstRange();
     }
-    return *m_cachedPrimarySimpleFontData;
+    return *m_cachedPrimaryFont;
 }
 
 }
index a1eac37..4053760 100644 (file)
@@ -133,7 +133,7 @@ public:
     void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; }
 
 private:
-    friend class SimpleFontData;
+    friend class Font;
 
     void reset()
     {
index aa135a5..dfbdec0 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "FontRanges.h"
 
-#include "SimpleFontData.h"
+#include "Font.h"
 #include <wtf/Assertions.h>
 #include <wtf/text/WTFString.h>
 
@@ -36,34 +36,34 @@ FontRanges::FontRanges()
 {
 }
 
-FontRanges::FontRanges(RefPtr<SimpleFontData>&& fontData)
+FontRanges::FontRanges(RefPtr<Font>&& font)
 {
-    if (fontData)
-        m_ranges.append(Range { 0, 0x7FFFFFFF, fontData.releaseNonNull() });
+    if (font)
+        m_ranges.append(Range { 0, 0x7FFFFFFF, font.releaseNonNull() });
 }
 
 FontRanges::~FontRanges()
 {
 }
 
-const SimpleFontData* FontRanges::fontDataForCharacter(UChar32 c) const
+const Font* FontRanges::fontForCharacter(UChar32 c) const
 {
     for (auto& range : m_ranges) {
         if (range.from() <= c && c <= range.to())
-            return &range.fontData();
+            return &range.font();
     }
     return nullptr;
 }
 
-const SimpleFontData& FontRanges::fontDataForFirstRange() const
+const Font& FontRanges::fontForFirstRange() const
 {
-    return m_ranges[0].fontData();
+    return m_ranges[0].font();
 }
 
 bool FontRanges::isLoading() const
 {
     for (auto& range : m_ranges) {
-        if (range.fontData().isLoading())
+        if (range.font().isLoading())
             return true;
     }
     return false;
index b49f98a..f1b6350 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef FontRanges_h
 #define FontRanges_h
 
-#include "SimpleFontData.h"
+#include "Font.h"
 #include <wtf/TypeCasts.h>
 #include <wtf/Vector.h>
 
@@ -35,25 +35,25 @@ namespace WebCore {
 class FontRanges {
 public:
     struct Range {
-        Range(UChar32 from, UChar32 to, Ref<SimpleFontData>&& fontData)
+        Range(UChar32 from, UChar32 to, Ref<Font>&& font)
             : m_from(from)
             , m_to(to)
-            , m_fontData(WTF::move(fontData))
+            , m_font(WTF::move(font))
         {
         }
 
         UChar32 from() const { return m_from; }
         UChar32 to() const { return m_to; }
-        const SimpleFontData& fontData() const { return *m_fontData; }
+        const Font& font() const { return *m_font; }
 
     private:
         UChar32 m_from;
         UChar32 m_to;
-        RefPtr<SimpleFontData> m_fontData;
+        RefPtr<Font> m_font;
     };
 
     FontRanges();
-    explicit FontRanges(RefPtr<SimpleFontData>&&);
+    explicit FontRanges(RefPtr<Font>&&);
     ~FontRanges();
 
     bool isNull() const { return m_ranges.isEmpty(); }
@@ -62,8 +62,8 @@ public:
     unsigned size() const { return m_ranges.size(); }
     const Range& rangeAt(unsigned i) const { return m_ranges[i]; }
 
-    const SimpleFontData* fontDataForCharacter(UChar32) const;
-    const SimpleFontData& fontDataForFirstRange() const;
+    const Font* fontForCharacter(UChar32) const;
+    const Font& fontForFirstRange() const;
     bool isLoading() const;
 
 private:
index d0e200f..ebcbfd3 100644 (file)
@@ -41,9 +41,9 @@ public:
     virtual ~FontSelector() { }
 
     virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) = 0;
-    virtual PassRefPtr<SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) = 0;
+    virtual PassRefPtr<Font> fallbackFontAt(const FontDescription&, size_t) = 0;
 
-    virtual size_t fallbackFontDataCount() = 0;
+    virtual size_t fallbackFontCount() = 0;
     virtual bool resolvesFamilyFor(const FontDescription&) const = 0;
 
     virtual void fontCacheInvalidated() { }
index bb70966..946e245 100644 (file)
@@ -45,7 +45,7 @@
 
 namespace WebCore {
 
-class SimpleFontData;
+class Font;
 
 #if USE(CAIRO)
 // FIXME: Why does Cairo use such a huge struct instead of just an offset into an array?
@@ -76,12 +76,12 @@ typedef FloatSize GlyphBufferAdvance;
 
 class GlyphBuffer {
 public:
-    bool isEmpty() const { return m_fontData.isEmpty(); }
-    int size() const { return m_fontData.size(); }
+    bool isEmpty() const { return m_font.isEmpty(); }
+    int size() const { return m_font.size(); }
     
     void clear()
     {
-        m_fontData.clear();
+        m_font.clear();
         m_glyphs.clear();
         m_advances.clear();
         if (m_offsetsInString)
@@ -96,7 +96,7 @@ public:
     const GlyphBufferGlyph* glyphs(int from) const { return m_glyphs.data() + from; }
     const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
 
-    const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }
+    const Font* fontAt(int index) const { return m_font[index]; }
 
     void setInitialAdvance(GlyphBufferAdvance initialAdvance) { m_initialAdvance = initialAdvance; }
     const GlyphBufferAdvance& initialAdvance() const { return m_initialAdvance; }
@@ -126,9 +126,9 @@ public:
     }
     
     static const unsigned noOffset = UINT_MAX;
-    void add(Glyph glyph, const SimpleFontData* font, float width, unsigned offsetInString = noOffset, const FloatSize* offset = 0)
+    void add(Glyph glyph, const Font* font, float width, unsigned offsetInString = noOffset, const FloatSize* offset = 0)
     {
-        m_fontData.append(font);
+        m_font.append(font);
 
 #if USE(CAIRO)
         cairo_glyph_t cairoGlyph;
@@ -159,9 +159,9 @@ public:
     }
     
 #if !USE(WINGDI)
-    void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset)
+    void add(Glyph glyph, const Font* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset)
     {
-        m_fontData.append(font);
+        m_font.append(font);
 #if USE(CAIRO)
         cairo_glyph_t cairoGlyph;
         cairoGlyph.index = glyph;
@@ -205,9 +205,9 @@ public:
 private:
     void swap(int index1, int index2)
     {
-        const SimpleFontData* f = m_fontData[index1];
-        m_fontData[index1] = m_fontData[index2];
-        m_fontData[index2] = f;
+        const Font* f = m_font[index1];
+        m_font[index1] = m_font[index2];
+        m_font[index2] = f;
 
         GlyphBufferGlyph g = m_glyphs[index1];
         m_glyphs[index1] = m_glyphs[index2];
@@ -224,7 +224,7 @@ private:
 #endif
     }
 
-    Vector<const SimpleFontData*, 2048> m_fontData;
+    Vector<const Font*, 2048> m_font;
     Vector<GlyphBufferGlyph, 2048> m_glyphs;
     Vector<GlyphBufferAdvance, 2048> m_advances;
     GlyphBufferAdvance m_initialAdvance;
index 384f936..1843eec 100644 (file)
 
 namespace WebCore {
 
-class SimpleFontData;
+class Font;
 
-// Holds the glyph index and the corresponding SimpleFontData information for a given
+// Holds the glyph index and the corresponding Font information for a given
 // character.
 struct GlyphData {
-    GlyphData(Glyph g = 0, const SimpleFontData* f = 0)
+    GlyphData(Glyph g = 0, const Font* f = 0)
         : glyph(g)
-        , fontData(f)
+        , font(f)
     {
     }
     Glyph glyph;
-    const SimpleFontData* fontData;
+    const Font* font;
 };
 
 #if COMPILER(MSVC)
@@ -66,24 +66,24 @@ struct GlyphData {
 // missing in the primary font.
 class GlyphPage : public RefCounted<GlyphPage> {
 public:
-    static PassRefPtr<GlyphPage> createForMixedFontData()
+    static PassRefPtr<GlyphPage> createForMixedFonts()
     {
-        void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(SimpleFontData*) * GlyphPage::size);
+        void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(Font*) * GlyphPage::size);
         return adoptRef(new (NotNull, slot) GlyphPage(nullptr));
     }
 
-    static PassRefPtr<GlyphPage> createCopyForMixedFontData(const GlyphPage& original)
+    static PassRefPtr<GlyphPage> createCopyForMixedFonts(const GlyphPage& original)
     {
-        RefPtr<GlyphPage> page = createForMixedFontData();
+        RefPtr<GlyphPage> page = createForMixedFonts();
         for (unsigned i = 0; i < GlyphPage::size; ++i)
             page->setGlyphDataForIndex(i, original.glyphDataForIndex(i));
         return page.release();
     }
 
-    static PassRefPtr<GlyphPage> createForSingleFontData(const SimpleFontData* fontData)
+    static PassRefPtr<GlyphPage> createForSingleFont(const Font* font)
     {
-        ASSERT(fontData);
-        return adoptRef(new GlyphPage(fontData));
+        ASSERT(font);
+        return adoptRef(new GlyphPage(font));
     }
 
     ~GlyphPage()
@@ -111,7 +111,7 @@ public:
         Glyph glyph = m_glyphs[index];
         if (hasPerGlyphFontData())
             return GlyphData(glyph, m_perGlyphFontData[index]);
-        return GlyphData(glyph, glyph ? m_fontDataForAllGlyphs : 0);
+        return GlyphData(glyph, glyph ? m_fontForAllGlyphs : 0);
     }
 
     ALWAYS_INLINE Glyph glyphAt(unsigned index) const
@@ -120,67 +120,67 @@ public:
         return m_glyphs[index];
     }
 
-    ALWAYS_INLINE const SimpleFontData* fontDataForCharacter(UChar32 c) const
+    ALWAYS_INLINE const Font* fontForCharacter(UChar32 c) const
     {
         unsigned index = indexForCharacter(c);
         if (hasPerGlyphFontData())
             return m_perGlyphFontData[index];
-        return m_glyphs[index] ? m_fontDataForAllGlyphs : 0;
+        return m_glyphs[index] ? m_fontForAllGlyphs : 0;
     }
 
-    void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)
+    void setGlyphDataForCharacter(UChar32 c, Glyph g, const Font* f)
     {
         setGlyphDataForIndex(indexForCharacter(c), g, f);
     }
 
-    void setGlyphDataForIndex(unsigned index, Glyph glyph, const SimpleFontData* fontData)
+    void setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font)
     {
         ASSERT_WITH_SECURITY_IMPLICATION(index < size);
         ASSERT(!m_isImmutable);
         
         m_glyphs[index] = glyph;
 
-        // GlyphPage getters will always return a null SimpleFontData* for glyph #0 if there's no per-glyph font array.
+        // GlyphPage getters will always return a null Font* for glyph #0 if there's no per-glyph font array.
         if (hasPerGlyphFontData()) {
-            m_perGlyphFontData[index] = glyph ? fontData : 0;
+            m_perGlyphFontData[index] = glyph ? font : 0;
             return;
         }
 
-        // A single-font GlyphPage already assigned m_fontDataForAllGlyphs in the constructor.
-        ASSERT(!glyph || fontData == m_fontDataForAllGlyphs);
+        // A single-font GlyphPage already assigned m_fontForAllGlyphs in the constructor.
+        ASSERT(!glyph || font == m_fontForAllGlyphs);
     }
 
     void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData)
     {
-        setGlyphDataForIndex(index, glyphData.glyph, glyphData.fontData);
+        setGlyphDataForIndex(index, glyphData.glyph, glyphData.font);
     }
 
     // Implemented by the platform.
-    bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
+    bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const Font*);
 #if PLATFORM(COCOA)
-    static bool mayUseMixedFontDataWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
+    static bool mayUseMixedFontsWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const Font*);
 #else
-    static bool mayUseMixedFontDataWhenFilling(const UChar*, unsigned, const SimpleFontData*) { return false; }
+    static bool mayUseMixedFontsWhenFilling(const UChar*, unsigned, const Font*) { return false; }
 #endif
 
 private:
-    explicit GlyphPage(const SimpleFontData* fontDataForAllGlyphs)
-        : m_fontDataForAllGlyphs(fontDataForAllGlyphs)
+    explicit GlyphPage(const Font* fontForAllGlyphs)
+        : m_fontForAllGlyphs(fontForAllGlyphs)
     {
         memset(m_glyphs, 0, sizeof(m_glyphs));
         if (hasPerGlyphFontData())
-            memset(m_perGlyphFontData, 0, sizeof(SimpleFontData*) * GlyphPage::size);
+            memset(m_perGlyphFontData, 0, sizeof(Font*) * GlyphPage::size);
         ++s_count;
     }
 
-    bool hasPerGlyphFontData() const { return !m_fontDataForAllGlyphs; }
+    bool hasPerGlyphFontData() const { return !m_fontForAllGlyphs; }
 
-    const SimpleFontData* m_fontDataForAllGlyphs;
+    const Font* m_fontForAllGlyphs;
     Glyph m_glyphs[size];
 
     bool m_isImmutable { false };
-    // NOTE: This array has (GlyphPage::size) elements if m_fontDataForAllGlyphs is null.
-    const SimpleFontData* m_perGlyphFontData[0];
+    // NOTE: This array has (GlyphPage::size) elements if m_fontForAllGlyphs is null.
+    const Font* m_perGlyphFontData[0];
 
     static unsigned s_count;
 };
index 3169b2c..a371066 100644 (file)
@@ -448,12 +448,12 @@ float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, con
 }
 #endif // !PLATFORM(IOS)
 
-void GraphicsContext::drawGlyphs(const FontCascade& font, const SimpleFontData& fontData, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point)
+void GraphicsContext::drawGlyphs(const FontCascade& fontCascade, const Font& font, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point)
 {
     if (paintingDisabled())
         return;
 
-    font.drawGlyphs(this, &fontData, buffer, from, numGlyphs, point);
+    fontCascade.drawGlyphs(this, &font, buffer, from, numGlyphs, point);
 }
 
 void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to)
index 7385822..b1ae6b9 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
 
 #if USE(WINGDI)
     class SharedBitmap;
-    class SimpleFontData;
+    class Font;
     class GlyphBuffer;
 #endif
 
@@ -360,7 +360,7 @@ namespace WebCore {
 #else
         float drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
 #endif
-        void drawGlyphs(const FontCascade&, const SimpleFontData&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
+        void drawGlyphs(const FontCascade&, const Font&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
         void drawEmphasisMarks(const FontCascade&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
 #if !PLATFORM(IOS)
         void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
@@ -479,7 +479,7 @@ namespace WebCore {
         AffineTransform& affineTransform();
         void resetAffineTransform();
         void fillRect(const FloatRect&, const Gradient*);
-        void drawText(const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point);
+        void drawText(const Font*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
         void drawFrameControl(const IntRect& rect, unsigned type, unsigned state);
         void drawFocusRect(const IntRect& rect);
         void paintTextField(const IntRect& rect, unsigned state);
index 4e00b56..2b0a343 100644 (file)
@@ -36,7 +36,7 @@ class FontCascade;
 class GraphicsContext;
 class GlyphBuffer;
 class GlyphToPathTranslator;
-class SimpleFontData;
+class Font;
 
 struct GlyphData;
 struct WidthIterator;
@@ -198,10 +198,10 @@ public:
 
 #if ENABLE(SVG_FONTS)
         virtual GlyphData glyphDataForCharacter(const FontCascade&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) = 0;
-        virtual void drawSVGGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0;
+        virtual void drawSVGGlyphs(GraphicsContext*, const Font*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0;
         virtual float floatWidthUsingSVGFont(const FontCascade&, const TextRun&, int& charsConsumed, String& glyphName) const = 0;
-        virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const = 0;
-        virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const SimpleFontData&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const = 0;
+        virtual bool applySVGKerning(const Font*, WidthIterator&, GlyphBuffer*, int from) const = 0;
+        virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const Font&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const = 0;
 #endif
     };
 
index 0ed673e..fcf634d 100644 (file)
 #include "config.h"
 #include "WidthIterator.h"
 
+#include "Font.h"
 #include "FontCascade.h"
 #include "GlyphBuffer.h"
 #include "Latin1TextIterator.h"
-#include "SimpleFontData.h"
 #include "SurrogatePairAwareTextIterator.h"
 #include <wtf/MathExtras.h>
 
@@ -34,7 +34,7 @@ using namespace Unicode;
 
 namespace WebCore {
 
-WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
+WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
     : m_font(font)
     , m_run(run)
     , m_currentCharacter(0)
@@ -100,7 +100,7 @@ public:
 
 typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
 
-static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)
+static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)
 {
     ASSERT(typesettingFeatures & (Kerning | Ligatures));
 
@@ -123,16 +123,16 @@ static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int&
     UNUSED_PARAM(iterator);
 #else
     // We need to handle transforms on SVG fonts internally, since they are rendered internally.
-    if (fontData->isSVGFont()) {
+    if (font->isSVGFont()) {
         // SVG font ligatures are handled during glyph selection, only kerning remaining.
         if (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {
             // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point.
             // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely.
-            iterator.run().renderingContext()->applySVGKerning(fontData, iterator, glyphBuffer, lastGlyphCount);
+            iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount);
         }
     } else
 #endif
-        fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
+        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
 
     if (!ltr)
         glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
@@ -166,8 +166,8 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
     float lastRoundingWidth = m_finalRoundingWidth;
     FloatRect bounds;
 
-    const SimpleFontData& primaryFontData = m_font->primaryFontData();
-    const SimpleFontData* lastFontData = &primaryFontData;
+    const Font& primaryFont = m_font->primaryFont();
+    const Font* lastFontData = &primaryFont;
     int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0;
 
     UChar32 character = 0;
@@ -183,15 +183,15 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
             textIterator.advance(advanceLength);
             continue;
         }
-        const SimpleFontData* fontData = glyphData.fontData;
-        ASSERT(fontData);
+        const Font* font = glyphData.font;
+        ASSERT(font);
 
         // Now that we have a glyph and font data, get its width.
         float width;
         if (character == '\t' && m_run.allowTabs())
-            width = m_font->tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
+            width = m_font->tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
         else {
-            width = fontData->widthForGlyph(glyph);
+            width = font->widthForGlyph(glyph);
 
             // SVG uses horizontalGlyphStretch(), when textLength is used to stretch/squeeze text.
             width *= m_run.horizontalGlyphStretch();
@@ -200,26 +200,26 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
             // First, we round spaces to an adjusted width in all fonts.
             // Second, in fixed-pitch fonts we ensure that all characters that
             // match the width of the space character have the same width as the space character.
-            if (m_run.applyWordRounding() && width == fontData->spaceWidth() && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph()))
-                width = fontData->adjustedSpaceWidth();
+            if (m_run.applyWordRounding() && width == font->spaceWidth() && (font->pitch() == FixedPitch || glyph == font->spaceGlyph()))
+                width = font->adjustedSpaceWidth();
         }
 
-        if (fontData != lastFontData && width) {
+        if (font != lastFontData && width) {
             if (shouldApplyFontTransforms()) {
                 m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, charactersTreatedAsSpace);
                 lastGlyphCount = glyphBuffer->size(); // applyFontTransforms doesn't update when there had been only one glyph.
             }
 
-            lastFontData = fontData;
-            if (m_fallbackFonts && fontData != &primaryFontData) {
+            lastFontData = font;
+            if (m_fallbackFonts && font != &primaryFont) {
                 // FIXME: This does a little extra work that could be avoided if
                 // glyphDataForCharacter() returned whether it chose to use a small caps font.
                 if (!m_font->isSmallCaps() || character == u_toupper(character))
-                    m_fallbackFonts->add(fontData);
+                    m_fallbackFonts->add(font);
                 else {
                     const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(u_toupper(character), rtl);
-                    if (uppercaseGlyphData.fontData != &primaryFontData)
-                        m_fallbackFonts->add(uppercaseGlyphData.fontData);
+                    if (uppercaseGlyphData.font != &primaryFont)
+                        m_fallbackFonts->add(uppercaseGlyphData.font);
                 }
             }
         }
@@ -243,9 +243,9 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
                         if (glyphBuffer) {
                             if (glyphBuffer->isEmpty()) {
                                 if (m_forTextEmphasis)
-                                    glyphBuffer->add(fontData->zeroWidthSpaceGlyph(), fontData, m_expansionPerOpportunity, currentCharacter);
+                                    glyphBuffer->add(font->zeroWidthSpaceGlyph(), font, m_expansionPerOpportunity, currentCharacter);
                                 else
-                                    glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity, currentCharacter);
+                                    glyphBuffer->add(font->spaceGlyph(), font, expansionAtThisOpportunity, currentCharacter);
                             } else
                                 glyphBuffer->expandLastAdvance(expansionAtThisOpportunity);
                         }
@@ -274,7 +274,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
         }
 
         if (m_accountForGlyphBounds) {
-            bounds = fontData->boundsForGlyph(glyph);
+            bounds = font->boundsForGlyph(glyph);
             if (!currentCharacter)
                 m_firstGlyphOverflow = std::max<float>(0, -bounds.x());
         }
@@ -314,7 +314,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
         }
 
         if (glyphBuffer)
-            glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter);
+            glyphBuffer->add(glyph, font, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter);
 
         lastRoundingWidth = width - oldWidth;
 
index 89a2b43..9148c40 100644 (file)
@@ -32,14 +32,14 @@ namespace WebCore {
 
 class FontCascade;
 class GlyphBuffer;
-class SimpleFontData;
+class Font;
 class TextRun;
 struct GlyphData;
 
 struct WidthIterator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WidthIterator(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
+    WidthIterator(const FontCascade*, const TextRun&, HashSet<const Font*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
 
     unsigned advance(int to, GlyphBuffer*);
     bool advanceOneCharacter(float& width, GlyphBuffer&);
@@ -94,7 +94,7 @@ private:
     bool shouldApplyFontTransforms() const { return m_run.length() > 1 && (m_typesettingFeatures & (Kerning | Ligatures)); }
 
     TypesettingFeatures m_typesettingFeatures;
-    HashSet<const SimpleFontData*>* m_fallbackFonts;
+    HashSet<const Font*>* m_fallbackFonts;
     bool m_accountForGlyphBounds;
     float m_maxGlyphBoundingBoxY;
     float m_minGlyphBoundingBoxY;
index b40c89e..bfa40f6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "AffineTransform.h"
 #include "CairoUtilities.h"
+#include "Font.h"
 #include "GlyphBuffer.h"
 #include "Gradient.h"
 #include "GraphicsContext.h"
 #include "PlatformContextCairo.h"
 #include "PlatformPathCairo.h"
 #include "ShadowBlur.h"
-#include "SimpleFontData.h"
 
 namespace WebCore {
 
-static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
+static void drawGlyphsToContext(cairo_t* context, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs)
 {
     cairo_matrix_t originalTransform;
     float syntheticBoldOffset = font->syntheticBoldOffset();
@@ -64,7 +64,7 @@ static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, Gl
         cairo_set_matrix(context, &originalTransform);
 }
 
-static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
+static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs)
 {
     ShadowBlur& shadow = graphicsContext->platformContext()->shadowBlur();
 
@@ -95,7 +95,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint&
     }
 }
 
-void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
+void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer,
     int from, int numGlyphs, const FloatPoint& point) const
 {
     if (!font->platformData().size())
@@ -216,7 +216,7 @@ public:
         : m_index(0)
         , m_textRun(textRun)
         , m_glyphBuffer(glyphBuffer)
-        , m_fontData(glyphBuffer.fontDataAt(m_index))
+        , m_fontData(glyphBuffer.fontAt(m_index))
         , m_translation(AffineTransform().translate(textOrigin.x(), textOrigin.y()))
     {
         moveToNextValidGlyph();
@@ -235,7 +235,7 @@ private:
     int m_index;
     const TextRun& m_textRun;
     const GlyphBuffer& m_glyphBuffer;
-    const SimpleFontData* m_fontData;
+    const Font* m_fontData;
     AffineTransform m_translation;
 };
 
@@ -286,7 +286,7 @@ void CairoGlyphToPathTranslator::advance()
         ++m_index;
         if (m_index >= m_glyphBuffer.size())
             break;
-        m_fontData = m_glyphBuffer.fontDataAt(m_index);
+        m_fontData = m_glyphBuffer.fontAt(m_index);
     } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
 }
 
@@ -307,7 +307,7 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const
         return DashArray();
 
     // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778
-    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
+    const Font* fontData = glyphBuffer.fontAt(0);
     std::unique_ptr<GlyphToPathTranslator> translator;
     bool isSVG = false;
     FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y());
@@ -326,7 +326,7 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const
     for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) {
         float centerOfLine = lineExtents.y() + (lineExtents.height() / 2);
         GlyphIterationState info = GlyphIterationState(FloatPoint(), FloatPoint(), centerOfLine, lineExtents.x() + lineExtents.width(), lineExtents.x());
-        const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);
+        const Font* localFontData = glyphBuffer.fontAt(index);
         if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) {
             // The advances will get all messed up if we do anything other than bail here.
             result.clear();
index 158b977..cbe820f 100644 (file)
 #include "config.h"
 #include "FontCascade.h"
 
+#include "Font.h"
 #include "GraphicsContext.h"
 #include "HarfBuzzShaper.h"
 #include "LayoutRect.h"
 #include "Logging.h"
 #include "NotImplemented.h"
 #include "PlatformContextCairo.h"
-#include "SimpleFontData.h"
 #include <cairo.h>
 
 namespace WebCore {
@@ -83,7 +83,7 @@ bool FontCascade::canExpandAroundIdeographsInComplexText()
     return false;
 }
 
-float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>*, GlyphOverflow*) const
 {
     HarfBuzzShaper shaper(this, run);
     if (shaper.shape())
index 6c91ce3..7878364 100644 (file)
@@ -41,6 +41,7 @@
 #include "FloatConversion.h"
 #include "FloatRect.h"
 #include "FloatRoundedRect.h"
+#include "Font.h"
 #include "GraphicsContextPlatformPrivateCairo.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
@@ -51,7 +52,6 @@
 #include "PlatformPathCairo.h"
 #include "RefPtrCairo.h"
 #include "ShadowBlur.h"
-#include "SimpleFontData.h"
 #include "TransformationMatrix.h"
 #include <cairo.h>
 #include <math.h>
index 84869ab..54fec8c 100644 (file)
 #import "CoreGraphicsSPI.h"
 #import "CoreTextSPI.h"
 #import "DashArray.h"
+#import "Font.h"
 #import "GlyphBuffer.h"
 #import "GraphicsContext.h"
 #import "LayoutRect.h"
 #import "Logging.h"
-#import "SimpleFontData.h"
 #import "WebCoreSystemInterface.h"
 #if USE(APPKIT)
 #import <AppKit/AppKit.h>
@@ -91,7 +91,7 @@ static inline bool shouldUseLetterpressEffect(const GraphicsContext& context)
 #endif
 }
 
-static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
+static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
 {
 #if ENABLE(LETTERPRESS)
     if (!count)
@@ -131,7 +131,7 @@ static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const S
 #endif
 }
 
-static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
+static void showGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
 {
     if (!count)
         return;
@@ -197,7 +197,7 @@ static void setCGFontRenderingMode(CGContextRef cgContext, NSFontRenderingMode r
 }
 #endif
 
-void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
+void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
 {
     const FontPlatformData& platformData = font->platformData();
     if (!platformData.size())
@@ -468,7 +468,7 @@ public:
         : m_index(0)
         , m_textRun(textRun)
         , m_glyphBuffer(glyphBuffer)
-        , m_fontData(glyphBuffer.fontDataAt(m_index))
+        , m_fontData(glyphBuffer.fontAt(m_index))
         , m_translation(CGAffineTransformScale(CGAffineTransformMakeTranslation(textOrigin.x(), textOrigin.y()), 1, -1))
     {
         moveToNextValidGlyph();
@@ -487,7 +487,7 @@ private:
     int m_index;
     const TextRun& m_textRun;
     const GlyphBuffer& m_glyphBuffer;
-    const SimpleFontData* m_fontData;
+    const Font* m_fontData;
     CGAffineTransform m_translation;
 };
 
@@ -524,7 +524,7 @@ void MacGlyphToPathTranslator::advance()
         ++m_index;
         if (m_index >= m_glyphBuffer.size())
             break;
-        m_fontData = m_glyphBuffer.fontDataAt(m_index);
+        m_fontData = m_glyphBuffer.fontAt(m_index);
     } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
 }
 
@@ -545,7 +545,7 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const
         return DashArray();
     
     // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778
-    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
+    const Font* fontData = glyphBuffer.fontAt(0);
     std::unique_ptr<GlyphToPathTranslator> translator;
     bool isSVG = false;
     FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y());
@@ -561,8 +561,8 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const
     DashArray result;
     for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) {
         GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
-        const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);
-        if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) {
+        const Font* localFont = glyphBuffer.fontAt(index);
+        if (!localFont || (!isSVG && localFont->isSVGFont()) || (isSVG && localFont != fontData)) {
             // The advances will get all messed up if we do anything other than bail here.
             result.clear();
             break;
@@ -592,10 +592,10 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const
 }
 #endif
 
-bool FontCascade::primaryFontDataIsSystemFont() const
+bool FontCascade::primaryFontIsSystemFont() const
 {
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090
-    const auto& fontData = primaryFontData();
+    const auto& fontData = primaryFont();
     return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
 #else
     // System fonts are hidden by having a name that begins with a period, so simply search
@@ -671,7 +671,7 @@ void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, cons
     drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
 }
 
-float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     ComplexTextController controller(this, run, true, fallbackFonts);
     if (glyphOverflow) {
@@ -689,7 +689,7 @@ int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bo
     return controller.offsetForPosition(x, includePartialGlyphs);
 }
 
-const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
+const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length, FontVariant variant) const
 {
     UChar32 baseCharacter;
     size_t baseCharacterLength = 0;
@@ -701,51 +701,51 @@ const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const U
         return 0;
 
     if (length == baseCharacterLength)
-        return baseCharacterGlyphData.fontData;
+        return baseCharacterGlyphData.font;
 
-    bool triedBaseCharacterFontData = false;
+    bool triedBaseCharacterFont = false;
 
     for (unsigned i = 0; !fallbackRangesAt(i).isNull(); ++i) {
-        const SimpleFontData* simpleFontData = fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
-        if (!simpleFontData)
+        const Font* font = fallbackRangesAt(i).fontForCharacter(baseCharacter);
+        if (!font)
             continue;
 #if PLATFORM(IOS)
-        if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && simpleFontData->shouldNotBeUsedForArabic())
+        if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && font->shouldNotBeUsedForArabic())
             continue;
 #endif
         if (variant == NormalVariant) {
-            if (simpleFontData->platformData().orientation() == Vertical) {
-                if (isCJKIdeographOrSymbol(baseCharacter) && !simpleFontData->hasVerticalGlyphs()) {
+            if (font->platformData().orientation() == Vertical) {
+                if (isCJKIdeographOrSymbol(baseCharacter) && !font->hasVerticalGlyphs()) {
                     variant = BrokenIdeographVariant;
-                    simpleFontData = simpleFontData->brokenIdeographFontData().get();
+                    font = font->brokenIdeographFont().get();
                 } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
-                    SimpleFontData* verticalRightFontData = simpleFontData->verticalRightOrientationFontData().get();
-                    Glyph verticalRightGlyph = verticalRightFontData->glyphForCharacter(baseCharacter);
+                    Font* verticalRightFont = font->verticalRightOrientationFont().get();
+                    Glyph verticalRightGlyph = verticalRightFont->glyphForCharacter(baseCharacter);
                     if (verticalRightGlyph == baseCharacterGlyphData.glyph)
-                        simpleFontData = verticalRightFontData;
+                        font = verticalRightFont;
                 } else {
-                    SimpleFontData* uprightFontData = simpleFontData->uprightOrientationFontData().get();
-                    Glyph uprightGlyph = uprightFontData->glyphForCharacter(baseCharacter);
+                    Font* uprightFont = font->uprightOrientationFont().get();
+                    Glyph uprightGlyph = uprightFont->glyphForCharacter(baseCharacter);
                     if (uprightGlyph != baseCharacterGlyphData.glyph)
-                        simpleFontData = uprightFontData;
+                        font = uprightFont;
                 }
             }
         } else {
-            if (const SimpleFontData* variantFontData = simpleFontData->variantFontData(m_fontDescription, variant).get())
-                simpleFontData = variantFontData;
+            if (const Font* variantFont = font->variantFont(m_fontDescription, variant).get())
+                font = variantFont;
         }
 
-        if (simpleFontData == baseCharacterGlyphData.fontData)
-            triedBaseCharacterFontData = true;
+        if (font == baseCharacterGlyphData.font)
+            triedBaseCharacterFont = true;
 
-        if (simpleFontData->canRenderCombiningCharacterSequence(characters, length))
-            return simpleFontData;
+        if (font->canRenderCombiningCharacterSequence(characters, length))
+            return font;
     }
 
-    if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCharacterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, length))
-        return baseCharacterGlyphData.fontData;
+    if (!triedBaseCharacterFont && baseCharacterGlyphData.font && baseCharacterGlyphData.font->canRenderCombiningCharacterSequence(characters, length))
+        return baseCharacterGlyphData.font;
 
-    return SimpleFontData::systemFallback();
+    return Font::systemFallback();
 }
 
 }
index 22d4de8..1848a36 100644 (file)
@@ -22,9 +22,9 @@
 #include "config.h"
 #include "FontCache.h"
 
+#include "Font.h"
 #include "OwnPtrCairo.h"
 #include "RefPtrCairo.h"
-#include "SimpleFontData.h"
 #include "UTF16UChar32Iterator.h"
 #include <cairo-ft.h>
 #include <cairo.h>
@@ -80,7 +80,7 @@ FcPattern* findBestFontGivenFallbacks(const FontPlatformData& fontData, FcPatter
     return FcFontSetMatch(0, sets, 1, pattern, &fontConfigResult);
 }
 
-RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
 {
     RefPtr<FcPattern> pattern = adoptRef(createFontConfigPatternForCharacters(characters, length));
     const FontPlatformData& fontData = originalFontData->platformData();
@@ -99,7 +99,7 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
     return fontForPlatformData(alternateFontData);
 }
 
-Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
+Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
 {
     // We want to return a fallback font here, otherwise the logic preventing FontConfig
     // matches for non-fallback fonts might return 0. See isFallbackFontAllowed.
index fe5180a..d0d3021 100644 (file)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "GlyphPage.h"
 
-#include "SimpleFontData.h"
+#include "Font.h"
 #include "UTF16UChar32Iterator.h"
 #include <cairo-ft.h>
 #include <cairo.h>
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
     cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont();
     ASSERT(scaledFont);
index d67461e..fc43c61 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #include "FloatConversion.h"
 #include "FloatRect.h"
@@ -51,7 +51,7 @@
 
 namespace WebCore {
 
-void SimpleFontData::platformInit()
+void Font::platformInit()
 {
     if (!m_platformData.m_size)
         return;
@@ -93,17 +93,17 @@ void SimpleFontData::platformInit()
     m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
 }
 
-void SimpleFontData::platformCharWidthInit()
+void Font::platformCharWidthInit()
 {
     m_avgCharWidth = 0.f;
     m_maxCharWidth = 0.f;
     initCharWidths();
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
+PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
 {
     ASSERT(m_platformData.scaledFont());
-    return SimpleFontData::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()),
+    return Font::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()),
         scaleFactor * fontDescription.computedSize(),
         m_platformData.syntheticBold(),
         m_platformData.syntheticOblique(),
@@ -111,12 +111,12 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
         isCustomFont(), false);
 }
 
-void SimpleFontData::determinePitch()
+void Font::determinePitch()
 {
     m_treatAsFixedPitch = m_platformData.isFixedPitch();
 }
 
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
+FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
 {
     if (!m_platformData.size())
         return FloatRect();
@@ -131,7 +131,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     return FloatRect();
 }
 
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
+float Font::platformWidthForGlyph(Glyph glyph) const
 {
     if (!m_platformData.size())
         return 0;
@@ -147,7 +147,7 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 }
 
 #if USE(HARFBUZZ)
-bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
+bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
 {
     if (!m_combiningCharacterSequenceSupport)
         m_combiningCharacterSequenceSupport = std::make_unique<HashMap<String, bool>>();
index fe6157d..4dd7aee 100644 (file)
 #include "config.h"
 #include "HarfBuzzFace.h"
 
+#include "Font.h"
 #include "FontPlatformData.h"
 #include "GlyphBuffer.h"
 #include "HarfBuzzShaper.h"
-#include "SimpleFontData.h"
 #include "TextEncoding.h"
 #include <cairo-ft.h>
 #include <cairo.h>
index 7d8364d..210aa44 100644 (file)
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "HarfBuzzFace.h"
 
+#include "Font.h"
 #include "FontPlatformData.h"
 #include "HarfBuzzShaper.h"
-#include "SimpleFontData.h"
 #include <ApplicationServices/ApplicationServices.h>
 #include <hb.h>
 
index c9de338..ef18fce 100644 (file)
@@ -72,7 +72,7 @@ static inline float harfBuzzPositionToFloat(hb_position_t value)
     return static_cast<float>(value) / (1 << 16);
 }
 
-HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)
+HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const Font* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)
     : m_fontData(fontData)
     , m_startIndex(startIndex)
     , m_numCharacters(numCharacters)
@@ -401,7 +401,7 @@ bool HarfBuzzShaper::collectHarfBuzzRuns()
     if (!iterator.consume(character, clusterLength))
         return false;
 
-    const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
+    const Font* nextFontData = m_font->glyphDataForCharacter(character, false).font;
     UErrorCode errorCode = U_ZERO_ERROR;
     UScriptCode nextScript = uscript_getScript(character, &errorCode);
     if (U_FAILURE(errorCode))
@@ -409,9 +409,9 @@ bool HarfBuzzShaper::collectHarfBuzzRuns()
 
     do {
         const UChar* currentCharacterPosition = iterator.characters();
-        const SimpleFontData* currentFontData = nextFontData;
+        const Font* currentFontData = nextFontData;
         if (!currentFontData)
-            currentFontData = &m_font->primaryFontData();
+            currentFontData = &m_font->primaryFont();
         UScriptCode currentScript = nextScript;
 
         for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) {
@@ -435,9 +435,9 @@ bool HarfBuzzShaper::collectHarfBuzzRuns()
                     clusterLength = markLength;
                     continue;
                 }
-                nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
+                nextFontData = m_font->glyphDataForCharacter(character, false).font;
             } else
-                nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
+                nextFontData = m_font->glyphDataForCharacter(character, false).font;
 
             nextScript = uscript_getScript(character, &errorCode);
             if (U_FAILURE(errorCode))
@@ -467,7 +467,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns(bool shouldSetDirection)
     for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) {
         unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i;
         HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get();
-        const SimpleFontData* currentFontData = currentRun->fontData();
+        const Font* currentFontData = currentRun->fontData();
         if (currentFontData->isSVGFont())
             return false;
 
@@ -485,7 +485,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns(bool shouldSetDirection)
 
         if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) {
             String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()).upper();
-            currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
+            currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).font;
             const UChar* characters = StringView(upperText).upconvertedCharacters();
             hb_buffer_add_utf16(harfBuzzBuffer.get(), reinterpret_cast<const uint16_t*>(characters), currentRun->numCharacters(), 0, currentRun->numCharacters());
         } else
@@ -514,7 +514,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns(bool shouldSetDirection)
 
 void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb_buffer_t* harfBuzzBuffer)
 {
-    const SimpleFontData* currentFontData = currentRun->fontData();
+    const Font* currentFontData = currentRun->fontData();
     hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfBuzzBuffer, 0);
     hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfBuzzBuffer, 0);
 
index 1d45080..936652d 100644 (file)
@@ -44,8 +44,8 @@
 
 namespace WebCore {
 
+class Font;
 class FontCascade;
-class SimpleFontData;
 
 class HarfBuzzShaper {
 public:
@@ -66,7 +66,7 @@ public:
 private:
     class HarfBuzzRun {
     public:
-        HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t);
+        HarfBuzzRun(const Font*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t);
 
         void applyShapeResult(hb_buffer_t*);
         void setGlyphAndPositions(unsigned index, uint16_t glyphId, float advance, float offsetX, float offsetY);
@@ -75,7 +75,7 @@ private:
         int characterIndexForXPosition(float targetX);
         float xPositionForOffset(unsigned offset);
 
-        const SimpleFontData* fontData() { return m_fontData; }
+        const Font* fontData() { return m_fontData; }
         unsigned startIndex() const { return m_startIndex; }
         unsigned numCharacters() const { return m_numCharacters; }
         unsigned numGlyphs() const { return m_numGlyphs; }
@@ -88,7 +88,7 @@ private:
         hb_script_t script() { return m_script; }
 
     private:
-        const SimpleFontData* m_fontData;
+        const Font* m_fontData;
         unsigned m_startIndex;
         size_t m_numCharacters;
         unsigned m_numGlyphs;
index 2dadc67..3b13943 100644 (file)
@@ -73,7 +73,7 @@ static CFCharacterSetRef phoneFallbackCharacterSet()
     return characterSet;
 }
 
-PassRefPtr<SimpleFontData> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, const UChar* characters, int length)
+PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const Font* originalFontData, const UChar* characters, int length)
 {
     const FontPlatformData& platformData = originalFontData->platformData();
     CTFontRef ctFont = platformData.font();
@@ -194,7 +194,7 @@ static LanguageSpecificFont languageSpecificFallbackFont(UChar32 c)
     return LanguageSpecificFont::None;
 }
 
-RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
 {
     // Unlike OS X, our fallback font on iPhone is Arial Unicode, which doesn't have some apple-specific glyphs like F8FF.
     // Fall back to the Apple Fallback font in this case.
@@ -220,7 +220,7 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
     if (length > 0)
         languageSpecificFont = languageSpecificFallbackFont(c);
 
-    RefPtr<SimpleFontData> simpleFontData;
+    RefPtr<Font> font;
 
     switch (languageSpecificFont) {
     case LanguageSpecificFont::ChineseJapanese: {
@@ -298,43 +298,43 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
             }
         }
 
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false);
         bool useSecondaryFont = true;
-        if (simpleFontData) {
+        if (font) {
             CGGlyph glyphs[2];
             // CGFontGetGlyphsForUnichars takes UTF-16 buffer. Should only be 1 codepoint but since we may pass in two UTF-16 characters,
             // make room for 2 glyphs just to be safe.
-            CGFontGetGlyphsForUnichars(simpleFontData->platformData().cgFont(), characters, glyphs, length);
+            CGFontGetGlyphsForUnichars(font->platformData().cgFont(), characters, glyphs, length);
 
             useSecondaryFont = (glyphs[0] == 0);
         }
 
         if (useSecondaryFont)
-            simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[secondaryCJKFont] : *cjkPlain[secondaryCJKFont], false);
+            font = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[secondaryCJKFont] : *cjkPlain[secondaryCJKFont], false);
         break;
     }
     case LanguageSpecificFont::Korean: {
         static NeverDestroyed<AtomicString> koreanPlain("AppleSDGothicNeo-Medium", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> koreanBold("AppleSDGothicNeo-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? koreanBold : koreanPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? koreanBold : koreanPlain, false);
         break;
     }
     case LanguageSpecificFont::Cyrillic: {
         static NeverDestroyed<AtomicString> cyrillicPlain("HelveticaNeue", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> cyrillicBold("HelveticaNeue-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? cyrillicBold : cyrillicPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? cyrillicBold : cyrillicPlain, false);
         break;
     }
     case LanguageSpecificFont::Arabic: {
         static NeverDestroyed<AtomicString> arabicPlain("GeezaPro", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> arabicBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? arabicBold : arabicPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? arabicBold : arabicPlain, false);
         break;
     }
     case LanguageSpecificFont::Hebrew: {
         static NeverDestroyed<AtomicString> hebrewPlain("ArialHebrew", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> hebrewBold("ArialHebrew-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? hebrewBold : hebrewPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? hebrewBold : hebrewPlain, false);
         break;
     }
     case LanguageSpecificFont::Indic: {
@@ -390,36 +390,36 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
         if (indicPageOrderIndex < (sizeof(indicUnicodePageFonts) / sizeof(AtomicString*))) {
             AtomicString* indicFontString = isFontWeightBold(description.weight()) ? indicUnicodePageFontsBold[indicPageOrderIndex] : indicUnicodePageFonts[indicPageOrderIndex];
             if (indicFontString)
-                simpleFontData = fontForFamily(description, *indicFontString, false);
+                font = fontForFamily(description, *indicFontString, false);
         }
         break;
     }
     case LanguageSpecificFont::Thai: {
         static NeverDestroyed<AtomicString> thaiPlain("Thonburi", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> thaiBold("Thonburi-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? thaiBold : thaiPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? thaiBold : thaiPlain, false);
         break;
     }
     case LanguageSpecificFont::Tibetan: {
         static NeverDestroyed<AtomicString> tibetanPlain("Kailasa", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> tibetanBold("Kailasa-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? tibetanBold : tibetanPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? tibetanBold : tibetanPlain, false);
         break;
     }
     case LanguageSpecificFont::CanadianAboriginalSyllabic: {
         static NeverDestroyed<AtomicString> casPlain("EuphemiaUCAS", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> casBold("EuphemiaUCAS-Bold", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? casBold : casPlain, false);
+        font = fontForFamily(description, isFontWeightBold(description.weight()) ? casBold : casPlain, false);
         break;
     }
     case LanguageSpecificFont::Khmer: {
         static NeverDestroyed<AtomicString> khmer("KhmerSangamMN", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, khmer, false);
+        font = fontForFamily(description, khmer, false);
         break;
     }
     case LanguageSpecificFont::Lao: {
         static NeverDestroyed<AtomicString> lao("LaoSangamMN", AtomicString::ConstructFromLiteral);
-        simpleFontData = fontForFamily(description, lao, false);
+        font = fontForFamily(description, lao, false);
         break;
     }
     default: {
@@ -430,27 +430,27 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
                 useEmojiFont = CFCharacterSetIsLongCharacterMember(appleColorEmojiCharacterSet(), c);
         }
         if (useEmojiFont)
-            simpleFontData = fontForFamily(description, appleColorEmoji, false);
+            font = fontForFamily(description, appleColorEmoji, false);
         else {
             RetainPtr<CTFontRef> fallbackFont = adoptCF(CTFontCreateForCharacters(originalFontData->getCTFont(), characters, length, nullptr));
             if (RetainPtr<CFStringRef> foundFontName = adoptCF(CTFontCopyPostScriptName(fallbackFont.get())))
-                simpleFontData = fontForFamily(description, foundFontName.get(), false);
+                font = fontForFamily(description, foundFontName.get(), false);
         }
         break;
     }
     }
 
-    if (simpleFontData)
-        return simpleFontData.release();
+    if (font)
+        return font.release();
 
     return lastResortFallbackFont(description);
 }
 
-RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)
+RefPtr<Font> FontCache::similarFont(const FontDescription& description)
 {
     // Attempt to find an appropriate font using a match based on the presence of keywords in
     // the requested names. For example, we'll match any name that contains "Arabic" to Geeza Pro.
-    RefPtr<SimpleFontData> simpleFontData;
+    RefPtr<Font> font;
     for (unsigned i = 0; i < description.familyCount(); ++i) {
         const AtomicString& family = description.familyAt(i);
         if (family.isEmpty())
@@ -461,7 +461,7 @@ RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&
         static NeverDestroyed<AtomicString> menlo("menlo", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
         if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
-            simpleFontData = fontForFamily(description, courier);
+            font = fontForFamily(description, courier);
             continue;
         }
 
@@ -469,7 +469,7 @@ RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&
         static NeverDestroyed<AtomicString> lucidaGrande("lucida grande", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
         if (equalIgnoringCase(family, lucidaGrande)) {
-            simpleFontData = fontForFamily(description, verdana);
+            font = fontForFamily(description, verdana);
             continue;
         }
 
@@ -479,15 +479,16 @@ RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&
         static String* matchWords[3] = { &arabic.get(), &pashto.get(), &urdu.get() };
         static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral);
         static NeverDestroyed<AtomicString> geezaBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral);
-        for (int j = 0; j < 3 && !simpleFontData; ++j)
+        for (int j = 0; j < 3 && !font; ++j) {
             if (family.contains(*matchWords[j], false))
-                simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
+                font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
+        }
     }
 
-    return simpleFontData.release();
+    return font.release();
 }
 
-Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
+Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
 {
     static NeverDestroyed<AtomicString> fallbackFontFamily(".PhoneFallback", AtomicString::ConstructFromLiteral);
     return *fontForFamily(fontDescription, fallbackFontFamily, false);
index f7e1ffe..879691e 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #import "config.h"
-#import "SimpleFontData.h"
+#import "Font.h"
 
 #import "BlockExceptions.h"
 #import "CoreGraphicsSPI.h"
@@ -67,7 +67,7 @@ static bool fontHasVerticalGlyphs(CTFontRef ctFont)
     return false;
 }
 
-void SimpleFontData::platformInit()
+void Font::platformInit()
 {
     m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size()  / 24.0f) : 0.f;
     m_spaceGlyph = 0;
@@ -128,7 +128,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setLineSpacing(0);
 }
 
-void SimpleFontData::platformCharWidthInit()
+void Font::platformCharWidthInit()
 {
     m_avgCharWidth = 0;
     m_maxCharWidth = 0;
@@ -137,12 +137,12 @@ void SimpleFontData::platformCharWidthInit()
     initCharWidths();
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription&, float scaleFactor) const
+PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
 {
     if (isCustomFont()) {
         FontPlatformData scaledFontData(m_platformData);
         scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
-        return SimpleFontData::create(scaledFontData, true, false);
+        return Font::create(scaledFontData, true, false);
     }
 
     float size = m_platformData.size() * scaleFactor;
@@ -167,7 +167,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
     return nullptr;
 }
 
-void SimpleFontData::determinePitch()
+void Font::determinePitch()
 {
     CTFontRef ctFont = m_platformData.font();
     m_treatAsFixedPitch = false;
@@ -184,12 +184,12 @@ void SimpleFontData::determinePitch()
     }
 }
 
-CGFontRenderingStyle SimpleFontData::renderingStyle() const
+CGFontRenderingStyle Font::renderingStyle() const
 {
     return kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
 }
 
-bool SimpleFontData::advanceForColorBitmapFont(Glyph, CGSize&) const
+bool Font::advanceForColorBitmapFont(Glyph, CGSize&) const
 {
     return false;
 }
index c00861a..1ad7821 100644 (file)
@@ -56,7 +56,7 @@ public:
     {
     }
 
-    float width(unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
+    float width(unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
     {
         m_controller->advance(from, 0, ByWholeGlyphs, fallbackFonts);
         float beforeWidth = m_controller->runWidthSoFar();
@@ -96,7 +96,7 @@ void FontCascade::deleteLayout(TextLayout* layout)
     delete layout;
 }
 
-float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
+float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
 {
     return layout.width(from, len, fallbackFonts);
 }
@@ -115,7 +115,7 @@ static inline CGFloat ceilCGFloat(CGFloat f)
     return static_cast<CGFloat>(ceil(f));
 }
 
-ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const SimpleFontData*>* fallbackFonts, bool forTextEmphasis)
+ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
     : m_font(*font)
     , m_run(run)
     , m_isLTROnly(true)
@@ -291,7 +291,7 @@ void ComplexTextController::collectComplexTextRuns()
     if (!m_end)
         return;
 
-    // We break up glyph run generation for the string by FontData.
+    // We break up glyph run generation for the string by Font.
     const UChar* cp;
 
     if (m_run.is8Bit()) {
@@ -308,9 +308,9 @@ void ComplexTextController::collectComplexTextRuns()
     const UChar* curr = cp;
     const UChar* end = cp + m_end;
 
-    const SimpleFontData* fontData;
+    const Font* font;
     bool isMissingGlyph;
-    const SimpleFontData* nextFontData;
+    const Font* nextFont;
     bool nextIsMissingGlyph;
 
     unsigned markCount;
@@ -332,12 +332,12 @@ void ComplexTextController::collectComplexTextRuns()
     }
 
     nextIsMissingGlyph = false;
-    nextFontData = m_font.fontDataForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
-    if (!nextFontData)
+    nextFont = m_font.fontForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
+    if (!nextFont)
         nextIsMissingGlyph = true;
 
     while (curr < end) {
-        fontData = nextFontData;
+        font = nextFont;
         isMissingGlyph = nextIsMissingGlyph;
         isSmallCaps = nextIsSmallCaps;
         int index = curr - cp;
@@ -358,17 +358,17 @@ void ComplexTextController::collectComplexTextRuns()
 
         nextIsMissingGlyph = false;
         if (baseCharacter == zeroWidthJoiner)
-            nextFontData = fontData;
+            nextFont = font;
         else {
-            nextFontData = m_font.fontDataForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
-            if (!nextFontData)
+            nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
+            if (!nextFont)
                 nextIsMissingGlyph = true;
         }
 
-        if (nextFontData != fontData || nextIsMissingGlyph != isMissingGlyph) {
+        if (nextFont != font || nextIsMissingGlyph != isMissingGlyph) {
             int itemStart = static_cast<int>(indexOfFontTransition);
             int itemLength = index - indexOfFontTransition;
-            collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? fontData : 0);
+            collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? font : 0);
             indexOfFontTransition = index;
         }
     }
@@ -376,7 +376,7 @@ void ComplexTextController::collectComplexTextRuns()
     int itemLength = m_end - indexOfFontTransition;
     if (itemLength) {
         int itemStart = indexOfFontTransition;
-        collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFontData : 0);
+        collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFont : 0);
     }
 
     if (!m_run.ltr())
@@ -469,7 +469,7 @@ unsigned ComplexTextController::incrementCurrentRun(unsigned& leftmostGlyph)
     return indexOfCurrentRun(leftmostGlyph);
 }
 
-void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const SimpleFontData*>* fallbackFonts)
+void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const Font*>* fallbackFonts)
 {
     if (static_cast<int>(offset) > m_end)
         offset = m_end;
@@ -494,8 +494,8 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, G
         size_t glyphCount = complexTextRun.glyphCount();
         unsigned g = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun;
         unsigned k = leftmostGlyph + g;
-        if (fallbackFonts && &complexTextRun.fontData() != &m_font.primaryFontData())
-            fallbackFonts->add(&complexTextRun.fontData());
+        if (fallbackFonts && &complexTextRun.font() != &m_font.primaryFont())
+            fallbackFonts->add(&complexTextRun.font());
 
         // We must store the initial advance for the first glyph we are going to draw.
         // When leftmostGlyph is 0, it represents the first glyph to draw, taking into
@@ -520,7 +520,7 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, G
                 return;
 
             if (glyphBuffer && !m_characterInCurrentGlyph)
-                glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
+                glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
 
             unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
             m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset;
@@ -566,9 +566,9 @@ void ComplexTextController::adjustGlyphsAndAdvances()
     for (size_t r = 0; r < runCount; ++r) {
         ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
         unsigned glyphCount = complexTextRun.glyphCount();
-        const SimpleFontData& fontData = complexTextRun.fontData();
+        const Font& font = complexTextRun.font();
 #if PLATFORM(IOS)
-        bool isEmoji = fontData.platformData().m_isEmoji;
+        bool isEmoji = font.platformData().m_isEmoji;
 #endif
 
         // Represent the initial advance for a text run by adjusting the advance
@@ -588,8 +588,8 @@ void ComplexTextController::adjustGlyphsAndAdvances()
         const CGSize* advances = complexTextRun.advances();
 
         bool lastRun = r + 1 == runCount;
-        bool roundsAdvances = !m_font.isPrinterFont() && fontData.platformData().roundsGlyphAdvances();
-        float spaceWidth = fontData.spaceWidth() - fontData.syntheticBoldOffset();
+        bool roundsAdvances = !m_font.isPrinterFont() && font.platformData().roundsGlyphAdvances();
+        float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
         CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
         const UChar* cp = complexTextRun.characters();
         CGPoint glyphOrigin = CGPointZero;
@@ -616,33 +616,33 @@ void ComplexTextController::adjustGlyphsAndAdvances()
                 nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
 
             bool treatAsSpace = FontCascade::treatAsSpace(ch);
-            CGGlyph glyph = treatAsSpace ? fontData.spaceGlyph() : glyphs[i];
+            CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
             CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
 #if PLATFORM(IOS)
             if (isEmoji && advance.width)
-                advance.width = fontData.widthForGlyph(glyph);
+                advance.width = font.widthForGlyph(glyph);
 #endif
 
             if (ch == '\t' && m_run.allowTabs())
-                advance.width = m_font.tabWidth(fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
+                advance.width = m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
             else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
                 advance.width = 0;
-                glyph = fontData.spaceGlyph();
+                glyph = font.spaceGlyph();
             }
 
             float roundedAdvanceWidth = roundf(advance.width);
             if (roundsAdvances)
                 advance.width = roundedAdvanceWidth;
 
-            advance.width += fontData.syntheticBoldOffset();
+            advance.width += font.syntheticBoldOffset();
 
  
             // We special case spaces in two ways when applying word rounding. 
             // First, we round spaces to an adjusted width in all fonts. 
             // Second, in fixed-pitch fonts we ensure that all glyphs that 
             // match the width of the space glyph have the same width as the space glyph. 
-            if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData.pitch() == FixedPitch || glyph == fontData.spaceGlyph()))
-                advance.width = fontData.adjustedSpaceWidth();
+            if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (font.pitch() == FixedPitch || glyph == font.spaceGlyph()))
+                advance.width = font.adjustedSpaceWidth();
 
             if (hasExtraSpacing) {
                 // If we're a glyph with an advance, go ahead and add in letter-spacing.
@@ -717,7 +717,7 @@ void ComplexTextController::adjustGlyphsAndAdvances()
             m_adjustedAdvances.append(advance);
             m_adjustedGlyphs.append(glyph);
             
-            FloatRect glyphBounds = fontData.boundsForGlyph(glyph);
+            FloatRect glyphBounds = font.boundsForGlyph(glyph);
             glyphBounds.move(glyphOrigin.x, glyphOrigin.y);
             m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x());
             m_maxGlyphBoundingBoxX = std::max(m_maxGlyphBoundingBoxX, glyphBounds.maxX());
index 34d1eb3..5de9725 100644 (file)
@@ -41,7 +41,7 @@ typedef const struct __CTLine * CTLineRef;
 namespace WebCore {
 
 class FontCascade;
-class SimpleFontData;
+class Font;
 class TextRun;
 
 enum GlyphIterationStyle { IncludePartialGlyphs, ByWholeGlyphs };
@@ -50,10 +50,10 @@ enum GlyphIterationStyle { IncludePartialGlyphs, ByWholeGlyphs };
 // complex scripts on OS X.
 class ComplexTextController {
 public:
-    ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false);
+    ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const Font*>* fallbackFonts = 0, bool forTextEmphasis = false);
 
     // Advance and emit glyphs up to the specified character.
-    void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const SimpleFontData*>* fallbackFonts = 0);
+    void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const Font*>* fallbackFonts = 0);
 
     // Compute the character offset for a given x coordinate.
     int offsetForPosition(float x, bool includePartialGlyphs);
@@ -73,18 +73,18 @@ public:
 private:
     class ComplexTextRun : public RefCounted<ComplexTextRun> {
     public:
-        static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
+        static Ref<ComplexTextRun> create(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
         {
-            return adoptRef(*new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange));
+            return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, runRange));
         }
 
-        static Ref<ComplexTextRun> create(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
+        static Ref<ComplexTextRun> create(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
         {
-            return adoptRef(*new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr));
+            return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr));
         }
 
         unsigned glyphCount() const { return m_glyphCount; }
-        const SimpleFontData& fontData() const { return m_fontData; }
+        const Font& font() const { return m_font; }
         const UChar* characters() const { return m_characters; }
         unsigned stringLocation() const { return m_stringLocation; }
         size_t stringLength() const { return m_stringLength; }
@@ -100,11 +100,11 @@ private:
         void setIsNonMonotonic();
 
     private:
-        ComplexTextRun(CTRunRef, const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
-        ComplexTextRun(const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
+        ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
+        ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
 
         unsigned m_glyphCount;
-        const SimpleFontData& m_fontData;
+        const Font& m_font;
         const UChar* m_characters;
         unsigned m_stringLocation;
         size_t m_stringLength;
@@ -127,7 +127,7 @@ private:
 
     void collectComplexTextRuns();
 
-    void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
+    void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const Font*);
     void adjustGlyphsAndAdvances();
 
     unsigned indexOfCurrentRun(unsigned& leftmostGlyph);
@@ -169,7 +169,7 @@ private:
     float m_leadingExpansion;
     bool m_afterExpansion;
 
-    HashSet<const SimpleFontData*>* m_fallbackFonts;
+    HashSet<const Font*>* m_fallbackFonts;
 
     float m_minGlyphBoundingBoxX;
     float m_maxGlyphBoundingBoxX;
index bcac923..02ec73a 100644 (file)
@@ -61,7 +61,7 @@
     _character = character;
 
     // By the time a WebCascadeList is used, the FontCascade has already been asked to realize all of its
-    // FontData, so this loop does not hit the FontCache.
+    // Fonts, so this loop does not hit the FontCache.
     while (!_font->fallbackRangesAt(_count).isNull())
         _count++;
 
     } else
         _fontDescriptors.grow(index + 1);
 
-    const WebCore::SimpleFontData* simpleFontData = _font->fallbackRangesAt(index).fontDataForCharacter(_character);
-    if (!simpleFontData)
-        simpleFontData = &_font->fallbackRangesAt(index).fontDataForFirstRange();
-    fontDescriptor = CTFontCopyFontDescriptor(simpleFontData->platformData().ctFont());
+    const WebCore::Font* font = _font->fallbackRangesAt(index).fontForCharacter(_character);
+    if (!font)
+        font = &_font->fallbackRangesAt(index).fontForFirstRange();
+    fontDescriptor = CTFontCopyFontDescriptor(font->platformData().ctFont());
     _fontDescriptors[index] = adoptCF(fontDescriptor);
     return (id)fontDescriptor;
 }
@@ -94,8 +94,8 @@
 
 namespace WebCore {
 
-ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
-    : m_fontData(fontData)
+ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
+    : m_font(font)
     , m_characters(characters)
     , m_stringLocation(stringLocation)
     , m_stringLength(stringLength)
@@ -130,8 +130,8 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
 
 // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
 // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
-ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
-    : m_fontData(fontData)
+ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
+    : m_font(font)
     , m_characters(characters)
     , m_stringLocation(stringLocation)
     , m_stringLength(stringLength)
@@ -163,7 +163,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData& font
     // Synthesize a run of missing glyphs.
     m_glyphsVector.fill(0, m_glyphCount);
     m_glyphs = m_glyphsVector.data();
-    m_advancesVector.fill(CGSizeMake(m_fontData.widthForGlyph(0), 0), m_glyphCount);
+    m_advancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
     m_advances = m_advancesVector.data();
 }
 
@@ -184,11 +184,11 @@ static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* c
     return info->cp + stringIndex;
 }
 
-void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
+void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const Font* font)
 {
-    if (!fontData) {
+    if (!font) {
         // Create a run of missing glyphs from the primary font.
-        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation, length, m_run.ltr()));
+        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr()));
         return;
     }
 
@@ -196,26 +196,26 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
 
     UChar32 baseCharacter = 0;
     RetainPtr<CFDictionaryRef> stringAttributes;
-    if (fontData == SimpleFontData::systemFallback()) {
+    if (font == Font::systemFallback()) {
         // FIXME: This code path does not support small caps.
         isSystemFallback = true;
 
         U16_GET(cp, 0, 0, length, baseCharacter);
-        fontData = m_font.fallbackRangesAt(0).fontDataForCharacter(baseCharacter);
-        if (!fontData)
-            fontData = &m_font.fallbackRangesAt(0).fontDataForFirstRange();
+        font = m_font.fallbackRangesAt(0).fontForCharacter(baseCharacter);
+        if (!font)
+            font = &m_font.fallbackRangesAt(0).fontForFirstRange();
 
         RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
 
-        stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation())));
+        stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation())));
         static const void* attributeKeys[] = { kCTFontCascadeListAttribute };
         const void* values[] = { cascadeList.get() };
         RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
         RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
-        RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(fontData->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
+        RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(font->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
         CFDictionarySetValue(const_cast<CFMutableDictionaryRef>(stringAttributes.get()), kCTFontAttributeName, fontWithCascadeList.get());
     } else
-        stringAttributes = fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation());
+        stringAttributes = font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation());
 
     RetainPtr<CTLineRef> line;
 
@@ -248,55 +248,55 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
         CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, m_run.ltr() ? r : runCount - 1 - r));
         ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID());
         CFRange runRange = CTRunGetStringRange(ctRun);
-        const SimpleFontData* runFontData = fontData;
+        const Font* runFont = font;
         if (isSystemFallback) {
             CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun);
-            CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName));
-            ASSERT(CFGetTypeID(runFont) == CTFontGetTypeID());
-            RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(runFont);
-            if (!CFEqual(runFontEqualityObject.get(), fontData->platformData().objectForEqualityCheck().get())) {
+            CTFontRef runCTFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName));
+            ASSERT(CFGetTypeID(runCTFont) == CTFontGetTypeID());
+            RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(runCTFont);
+            if (!CFEqual(runFontEqualityObject.get(), font->platformData().objectForEqualityCheck().get())) {
                 // Begin trying to see if runFont matches any of the fonts in the fallback list.
 
                 for (unsigned i = 0; !m_font.fallbackRangesAt(i).isNull(); ++i) {
-                    runFontData = m_font.fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
-                    if (!runFontData)
+                    runFont = m_font.fallbackRangesAt(i).fontForCharacter(baseCharacter);
+                    if (!runFont)
                         continue;
-                    RetainPtr<CFTypeRef> runFontEqualityObject = runFontData->platformData().objectForEqualityCheck();
+                    RetainPtr<CFTypeRef> runFontEqualityObject = runFont->platformData().objectForEqualityCheck();
                     if (CFEqual(runFontEqualityObject.get(), runFontEqualityObject.get()))
                         break;
-                    runFontData = 0;
+                    runFont = nullptr;
                 }
                 // If there is no matching font, look up by name in the font cache.
-                if (!runFontData) {
+                if (!runFont) {
                     // Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through
                     // the font cache and ultimately through NSFontManager in order to get an NSFont with the right
                     // NSFontRenderingMode.
-                    RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runFont));
+                    RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runCTFont));
                     if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
-                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
+                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
                         continue;
                     }
-                    runFontData = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
+                    runFont = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
 #if !PLATFORM(IOS)
                     // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
                     // using the font as returned, even though it may not have the best NSFontRenderingMode.
-                    if (!runFontData) {
-                        FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont());
-                        runFontData = &fontCache().fontForPlatformData(runFontPlatformData).get();
+                    if (!runFont) {
+                        FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont), m_font.fontDescription().usePrinterFont());
+                        runFont = &fontCache().fontForPlatformData(runFontPlatformData).get();
                     }
 #else
                     // FIXME: Just assert for now, until we can devise a better fix that works with iOS.
-                    ASSERT(runFontData);
+                    ASSERT(runFont);
 #endif
                 }
-                if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
-                    m_fallbackFonts->add(runFontData);
+                if (m_fallbackFonts && runFont != &m_font.primaryFont())
+                    m_fallbackFonts->add(runFont);
             }
         }
-        if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
-            m_fallbackFonts->add(fontData);
+        if (m_fallbackFonts && runFont != &m_font.primaryFont())
+            m_fallbackFonts->add(font);
 
-        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFontData, cp, stringLocation, length, runRange));
+        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange));
     }
 }
 
index d64c87f..3eda5a8 100644 (file)
@@ -33,8 +33,8 @@
 #if !PLATFORM(IOS)
 
 #import "CoreGraphicsSPI.h"
+#import "Font.h"
 #import "FontCascade.h"
-#import "SimpleFontData.h"
 #import "FontPlatformData.h"
 #import "NSFontSPI.h"
 #import "WebCoreNSStringExtras.h"
@@ -337,7 +337,7 @@ static bool shouldAutoActivateFontIfNeeded(const AtomicString& family)
     return knownFamilies.get().add(family).isNewEntry;
 }
 
-RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool isPlatformFont, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length)
 {
     UChar32 character;
     U16_GET(characters, 0, 0, length, character);
@@ -405,34 +405,35 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
     return fontForPlatformData(alternateFont);
 }
 
-RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)
+RefPtr<Font> FontCache::similarFont(const FontDescription& description)
 {
     // Attempt to find an appropriate font using a match based on 
     // the presence of keywords in the the requested names.  For example, we'll
     // match any name that contains "Arabic" to Geeza Pro.
-    RefPtr<SimpleFontData> simpleFontData;
+    RefPtr<Font> font;
     for (unsigned i = 0; i < description.familyCount(); ++i) {
         const AtomicString& family = description.familyAt(i);
         if (family.isEmpty())
             continue;
         static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
         DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral));
-        for (int j = 0; j < 3 && !simpleFontData; ++j)
+        for (int j = 0; j < 3 && !font; ++j) {
             if (family.contains(*matchWords[j], false))
-                simpleFontData = fontForFamily(description, geezaStr);
+                font = fontForFamily(description, geezaStr);
+        }
     }
-    return simpleFontData.release();
+    return font.release();
 }
 
-Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
+Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
 {
     DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times", AtomicString::ConstructFromLiteral));
 
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
-    RefPtr<SimpleFontData> simpleFontData = fontForFamily(fontDescription, timesStr, false);
-    if (simpleFontData)
-        return *simpleFontData;
+    RefPtr<Font> font = fontForFamily(fontDescription, timesStr, false);
+    if (font)
+        return *font;
 
     // The Times fallback will almost always work, but in the highly unusual case where
     // the user doesn't have it, we fall back on Lucida Grande because that's
index e34aa0c..6036a12 100644 (file)
@@ -31,8 +31,8 @@
 
 #include "CoreGraphicsSPI.h"
 #include "CoreTextSPI.h"
+#include "Font.h"
 #include "FontCascade.h"
-#include "SimpleFontData.h"
 #include "WebCoreSystemInterface.h"
 #if !PLATFORM(IOS)
 #include <ApplicationServices/ApplicationServices.h>
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
     if (fontData->platformData().isCompositeFontReference())
         return true;
@@ -55,7 +55,7 @@ static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const
     return false;
 }
 
-bool GlyphPage::mayUseMixedFontDataWhenFilling(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+bool GlyphPage::mayUseMixedFontsWhenFilling(const UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
 #if USE(APPKIT)
     // FIXME: This is only really needed for composite font references.
@@ -68,7 +68,7 @@ bool GlyphPage::mayUseMixedFontDataWhenFilling(const UChar* buffer, unsigned buf
 #endif
 }
 
-bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
     bool haveGlyphs = false;
 
@@ -163,7 +163,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
                     }
 #if USE(APPKIT)
                 } else {
-                    const SimpleFontData* runSimple = fontData->compositeFontReferenceFontData((NSFont *)runFont);
+                    const Font* runSimple = fontData->compositeFontReferenceFont((NSFont *)runFont);
                     if (runSimple) {
                         for (CFIndex i = 0; i < glyphCount; ++i) {
                             if (stringIndices[i] >= static_cast<CFIndex>(bufferLength)) {
index 0828bd8..0f83017 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #if !PLATFORM(IOS)
 #include <ApplicationServices/ApplicationServices.h>
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
+CFDictionaryRef Font::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
 {
     unsigned key = typesettingFeatures + 1;
     HashMap<unsigned, RetainPtr<CFDictionaryRef>>::AddResult addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>());
index 9b2b1e0..2625b8d 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #import "config.h"
-#import "SimpleFontData.h"
+#import "Font.h"
 
 #import "BlockExceptions.h"
 #import "Color.h"
@@ -71,7 +71,7 @@ static bool fontHasVerticalGlyphs(CTFontRef ctFont)
     return false;
 }
 
-static bool initFontData(SimpleFontData* fontData)
+static bool initFontData(Font* fontData)
 {
     if (!fontData->platformData().cgFont())
         return false;
@@ -85,7 +85,7 @@ static NSString *webFallbackFontFamily(void)
     return webFallbackFontFamily;
 }
 
-const SimpleFontData* SimpleFontData::compositeFontReferenceFontData(NSFont *key) const
+const Font* Font::compositeFontReferenceFont(NSFont *key) const
 {
     if (!key || CFEqual(adoptCF(CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort")))
         return nullptr;
@@ -103,12 +103,12 @@ const SimpleFontData* SimpleFontData::compositeFontReferenceFontData(NSFont *key
         bool syntheticOblique = platformData().syntheticOblique() && !(traits & kCTFontItalicTrait);
 
         FontPlatformData substitutePlatform(substituteFont, platformData().size(), isUsingPrinterFont, syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant());
-        addResult.iterator->value = SimpleFontData::create(substitutePlatform, isCustomFont());
+        addResult.iterator->value = Font::create(substitutePlatform, isCustomFont());
     }
     return addResult.iterator->value.get();
 }
 
-void SimpleFontData::platformInit()
+void Font::platformInit()
 {
     m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f;
 
@@ -226,7 +226,7 @@ void SimpleFontData::platformInit()
         else
             xHeight = scaleEmToUnits(CGFontGetXHeight(m_platformData.cgFont()), unitsPerEm) * pointSize;
     } else
-        xHeight = verticalRightOrientationFontData()->fontMetrics().xHeight();
+        xHeight = verticalRightOrientationFont()->fontMetrics().xHeight();
 
     m_fontMetrics.setUnitsPerEm(unitsPerEm);
     m_fontMetrics.setAscent(ascent);
@@ -241,7 +241,7 @@ static CFDataRef copyFontTableForTag(FontPlatformData& platformData, FourCharCod
     return CGFontCopyTableForTag(platformData.cgFont(), tableName);
 }
 
-void SimpleFontData::platformCharWidthInit()
+void Font::platformCharWidthInit()
 {
     m_avgCharWidth = 0;
     m_maxCharWidth = 0;
@@ -269,17 +269,17 @@ void SimpleFontData::platformCharWidthInit()
 }
 #endif // USE(APPKIT)
 
-void SimpleFontData::platformDestroy()
+void Font::platformDestroy()
 {
 }
 
 #if !PLATFORM(IOS)
-PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
+PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
 {
     if (isCustomFont()) {
         FontPlatformData scaledFontData(m_platformData);
         scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
-        return SimpleFontData::create(scaledFontData, true, false);
+        return Font::create(scaledFontData, true, false);
     }
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -310,7 +310,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
     return 0;
 }
 
-void SimpleFontData::determinePitch()
+void Font::determinePitch()
 {
     NSFont* f = m_platformData.nsFont();
     // Special case Osaka-Mono.
@@ -333,7 +333,7 @@ void SimpleFontData::determinePitch()
 }
 #endif // !PLATFORM(IOS)
 
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
+FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
 {
     FloatRect boundingBox;
     boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1);
@@ -345,7 +345,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
 }
 
 #if PLATFORM(MAC)
-inline CGFontRenderingStyle SimpleFontData::renderingStyle() const
+inline CGFontRenderingStyle Font::renderingStyle() const
 {
     CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization;
     NSFont *font = platformData().nsFont();
@@ -364,7 +364,7 @@ inline CGFontRenderingStyle SimpleFontData::renderingStyle() const
     return style;
 }
 
-inline bool SimpleFontData::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const
+inline bool Font::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const
 {
     NSFont *font = platformData().nsFont();
     if (!font || !platformData().isColorBitmapFont())
@@ -394,7 +394,7 @@ static inline bool isEmoji(const FontPlatformData& platformData)
 #endif
 }
 
-inline bool SimpleFontData::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const
+inline bool Font::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const
 {
     // Fast getter doesn't take custom tracking into account
     if (hasCustomTracking(platformData().ctFont()))
@@ -410,7 +410,7 @@ inline bool SimpleFontData::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& ad
     return true;
 }
 
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
+float Font::platformWidthForGlyph(Glyph glyph) const
 {
     CGSize advance = CGSizeZero;
     bool horizontal = platformData().orientation() == Horizontal;
@@ -446,7 +446,7 @@ static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* c
     return info->characters + stringIndex;
 }
 
-bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
+bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
 {
     ASSERT(isMainThread());
 
index 96c05b7..1eb1810 100644 (file)
 #include "config.h"
 #include "OpenTypeMathData.h"
 
+#include "Font.h"
 #include "FontPlatformData.h"
 #if ENABLE(OPENTYPE_MATH)
 #include "OpenTypeTypes.h"
 #endif
 #include "SharedBuffer.h"
-#include "SimpleFontData.h"
 
 using namespace std;
 
@@ -235,9 +235,9 @@ struct MATHTable : TableBase {
 #endif // ENABLE(OPENTYPE_MATH)
 
 #if ENABLE(OPENTYPE_MATH)
-OpenTypeMathData::OpenTypeMathData(const FontPlatformData& fontData)
+OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
 {
-    m_mathBuffer = fontData.openTypeTable(OpenType::MATHTag);
+    m_mathBuffer = font.openTypeTable(OpenType::MATHTag);
     const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer);
     if (!math) {
         m_mathBuffer = nullptr;
@@ -265,7 +265,7 @@ OpenTypeMathData::~OpenTypeMathData()
 }
 
 #if ENABLE(OPENTYPE_MATH)
-float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant constant) const
+float OpenTypeMathData::getMathConstant(const Font& font, MathConstant constant) const
 {
     int32_t value = 0;
 
@@ -288,7 +288,7 @@ float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant
 
     return value * font.sizePerUnit();
 #else
-float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) const
+float OpenTypeMathData::getMathConstant(const Font&, MathConstant) const
 {
     ASSERT_NOT_REACHED();
     return 0;
@@ -296,7 +296,7 @@ float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) con
 }
 
 #if ENABLE(OPENTYPE_MATH)
-float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph glyph) const
+float OpenTypeMathData::getItalicCorrection(const Font& font, Glyph glyph) const
 {
     const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer);
     ASSERT(math);
@@ -310,7 +310,7 @@ float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph gl
 
     return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit();
 #else
-float OpenTypeMathData::getItalicCorrection(const SimpleFontData&, Glyph) const
+float OpenTypeMathData::getItalicCorrection(const Font&, Glyph) const
 {
     ASSERT_NOT_REACHED();
     return 0;
index 6dff3e7..ffa2876 100644 (file)
@@ -35,13 +35,13 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
-class SimpleFontData;
+class Font;
 
 class OpenTypeMathData : public RefCounted<OpenTypeMathData> {
 public:
-    static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& fontData)
+    static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& font)
     {
-        return adoptRef(new OpenTypeMathData(fontData));
+        return adoptRef(new OpenTypeMathData(font));
     }
     ~OpenTypeMathData();
 
@@ -113,8 +113,8 @@ public:
         bool isExtender;
     };
 
-    float getMathConstant(const SimpleFontData&, MathConstant) const;
-    float getItalicCorrection(const SimpleFontData&, Glyph) const;
+    float getMathConstant(const Font&, MathConstant) const;
+    float getItalicCorrection(const Font&, Glyph) const;
     void getMathVariants(Glyph, bool isVertical, Vector<Glyph>& sizeVariants, Vector<AssemblyPart>& assemblyParts) const;
 
 private:
index 7c37043..41b002b 100644 (file)
 #include "OpenTypeVerticalData.h"
 
 #include "FloatRect.h"
+#include "Font.h"
 #include "GlyphPage.h"
 #include "OpenTypeTypes.h"
 #include "SharedBuffer.h"
-#include "SimpleFontData.h"
 #include <wtf/RefPtr.h>
 
 using namespace std;
@@ -479,7 +479,7 @@ void OpenTypeVerticalData::loadVerticalGlyphSubstitutions(const FontPlatformData
         gsub->getVerticalGlyphSubstitutions(&m_verticalGlyphMap, *buffer.get());
 }
 
-float OpenTypeVerticalData::advanceHeight(const SimpleFontData* font, Glyph glyph) const
+float OpenTypeVerticalData::advanceHeight(const Font* font, Glyph glyph) const
 {
     size_t countHeights = m_advanceHeights.size();
     if (countHeights) {
@@ -492,7 +492,7 @@ float OpenTypeVerticalData::advanceHeight(const SimpleFontData* font, Glyph glyp
     return font->fontMetrics().height();
 }
 
-void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const SimpleFontData* font, const Glyph* glyphs, size_t count, float* outXYArray) const
+void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const Font* font, const Glyph* glyphs, size_t count, float* outXYArray) const
 {
     size_t countWidths = m_advanceWidths.size();
     ASSERT(countWidths > 0);
@@ -535,7 +535,7 @@ void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const SimpleFontData
     }
 }
 
-void OpenTypeVerticalData::substituteWithVerticalGlyphs(const SimpleFontData* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const
+void OpenTypeVerticalData::substituteWithVerticalGlyphs(const Font* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const
 {
     const HashMap<Glyph, Glyph>& map = m_verticalGlyphMap;
     if (map.isEmpty())
index 26bc04d..b4639f9 100644 (file)
@@ -35,9 +35,9 @@
 
 namespace WebCore {
 
+class Font;
 class FontPlatformData;
 class GlyphPage;
-class SimpleFontData;
 
 class OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> {
 public:
@@ -48,9 +48,9 @@ public:
 
     bool isOpenType() const { return !m_advanceWidths.isEmpty(); }
     bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); }
-    float advanceHeight(const SimpleFontData*, Glyph) const;
-    void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, size_t, float* outXYArray) const;
-    void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigned offset, unsigned length) const;
+    float advanceHeight(const Font*, Glyph) const;
+    void getVerticalTranslationsForGlyphs(const Font*, const Glyph*, size_t, float* outXYArray) const;
+    void substituteWithVerticalGlyphs(const Font*, GlyphPage*, unsigned offset, unsigned length) const;
 
 private:
     explicit OpenTypeVerticalData(const FontPlatformData&);
index 5a7be5b..c490b11 100644 (file)
 
 #include "AffineTransform.h"
 #include "FloatConversion.h"
+#include "Font.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
-#include "SimpleFontData.h"
 #include "UniscribeController.h"
 #include "WebCoreTextRenderer.h"
 #include <ApplicationServices/ApplicationServices.h>
@@ -127,7 +127,7 @@ static CGPathRef createPathForGlyph(HDC hdc, Glyph glyph)
     return path;
 }
 
-void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
+void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const Font* font, const GlyphBuffer& glyphBuffer,
     int from, int numGlyphs, const FloatPoint& point) const
 {
     CGContextRef cgContext = graphicsContext->platformContext();
index ca13e5c..c52cf13 100644 (file)
@@ -28,9 +28,9 @@
 
 #include "config.h"
 #include <winsock2.h>
+#include "Font.h"
 #include "FontCache.h"
 #include "HWndDC.h"
-#include "SimpleFontData.h"
 #include <mlang.h>
 #include <windows.h>
 #include <wtf/HashSet.h>
@@ -199,10 +199,10 @@ static HFONT createMLangFont(IMLangFontLinkType* langFontLink, HDC hdc, DWORD co
     return hfont;
 }
 
-RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
 {
     UChar character = characters[0];
-    RefPtr<SimpleFontData> fontData;
+    RefPtr<Font> fontData;
     HWndDC hdc(0);
     HFONT primaryFont = originalFontData->platformData().hfont();
     HGDIOBJ oldFont = SelectObject(hdc, primaryFont);
@@ -309,16 +309,16 @@ RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescript
     return fontData.release();
 }
 
-RefPtr<SimpleFontData> FontCache::fontDataFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
+RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
 {
     AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
-    RefPtr<SimpleFontData> fontData = fontForFamily(fontDescription, familyName);
+    RefPtr<Font> fontData = fontForFamily(fontDescription, familyName);
     if (fontData)
         outFontFamilyName = familyName;
     return fontData;
 }
 
-Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
+Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
 {
     DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, fallbackFontName, ());
     if (!fallbackFontName.isEmpty())
@@ -337,7 +337,7 @@ Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fon
         AtomicString("Lucida Sans Unicode", AtomicString::ConstructFromLiteral),
         AtomicString("Arial", AtomicString::ConstructFromLiteral)
     };
-    RefPtr<SimpleFontData> simpleFont;
+    RefPtr<Font> simpleFont;
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) {
         if (simpleFont = fontForFamily(fontDescription, fallbackFonts[i])) {
             fallbackFontName = fallbackFonts[i];
@@ -349,7 +349,7 @@ Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fon
     if (HFONT defaultGUIFont = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT))) {
         LOGFONT defaultGUILogFont;
         GetObject(defaultGUIFont, sizeof(defaultGUILogFont), &defaultGUILogFont);
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName))
             return *simpleFont;
     }
 
@@ -357,15 +357,15 @@ Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fon
     NONCLIENTMETRICS nonClientMetrics = {0};
     nonClientMetrics.cbSize = sizeof(nonClientMetrics);
     if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) {
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))
             return *simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))
             return *simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))
             return *simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))
             return *simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
+        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
             return *simpleFont;
     }
     
index 0eab57e..911124e 100644 (file)
 #include "config.h"
 #include "FontCascade.h"
 
+#include "Font.h"
 #include "FontGlyphs.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "LayoutRect.h"
 #include "Logging.h"
-#include "SimpleFontData.h"
 #include "TextRun.h"
 #include "UniscribeController.h"
 #include <wtf/MathExtras.h>
@@ -120,7 +120,7 @@ void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, cons
     drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
 }
 
-float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     UniscribeController controller(this, run, fallbackFonts);
     controller.advance(run.length());
index a749417..feff633 100644 (file)
 #include "config.h"
 #include "GlyphPage.h"
 
-#include "SimpleFontData.h"
+#include "Font.h"
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 
 namespace WebCore {
 
-bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
     // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs.
     // We won't support this for now.
index fe9e94c..4106918 100644 (file)
 #include "config.h"
 #include "GlyphPage.h"
 
+#include "Font.h"
 #include "HWndDC.h"
-#include "SimpleFontData.h"
 
 namespace WebCore {
 
-bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
 {
     // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs.
     // We won't support this for now.
index 0aafdda..fb7e0ec 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #include "FloatRect.h"
 #include "FontCache.h"
@@ -48,7 +48,7 @@ namespace WebCore {
 
 using namespace std;
 
-void SimpleFontData::platformInit()
+void Font::platformInit()
 {
     m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
     m_scriptCache = 0;
@@ -103,7 +103,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setUnitsPerEm(unitsPerEm);
 }
 
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
+FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
 {
     if (!platformData().size())
         return FloatRect();
@@ -122,7 +122,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     return boundingBox;
 }
 
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
+float Font::platformWidthForGlyph(Glyph glyph) const
 {
     if (!platformData().size())
         return 0;
index 55a23e3..fae4b4a 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #include <windows.h>
 
@@ -41,7 +41,7 @@
 
 namespace WebCore {
 
-void SimpleFontData::platformInit()
+void Font::platformInit()
 {
     m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
     m_scriptCache = 0;
@@ -103,7 +103,7 @@ void SimpleFontData::platformInit()
     RestoreDC(dc, -1);
 }
 
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
+FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
 {
     if (m_platformData.useGDI())
         return boundsForGDIGlyph(glyph);
@@ -111,7 +111,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     return FloatRect();
 }
     
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
+float Font::platformWidthForGlyph(Glyph glyph) const
 {
     if (m_platformData.useGDI())
        return widthForGDIGlyph(glyph);
index 185d35e..b3722f2 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include "config.h"
-#include "SimpleFontData.h"
+#include "Font.h"
 
 #include "FontCache.h"
 #include "FloatRect.h"
@@ -43,17 +43,17 @@ const float cSmallCapsFontSizeMultiplier = 0.7f;
 
 static bool g_shouldApplyMacAscentHack;
 
-void SimpleFontData::setShouldApplyMacAscentHack(bool b)
+void Font::setShouldApplyMacAscentHack(bool b)
 {
     g_shouldApplyMacAscentHack = b;
 }
 
-bool SimpleFontData::shouldApplyMacAscentHack()
+bool Font::shouldApplyMacAscentHack()
 {
     return g_shouldApplyMacAscentHack;
 }
 
-float SimpleFontData::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent)
+float Font::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent)
 {
     if (!shouldApplyMacAscentHack())
         return ascent;
@@ -71,7 +71,7 @@ float SimpleFontData::ascentConsideringMacAscentHack(const WCHAR* faceName, floa
     return ascent;
 }
 
-void SimpleFontData::initGDIFont()
+void Font::initGDIFont()
 {
     if (!m_platformData.size()) {
         m_fontMetrics.reset();
@@ -106,7 +106,7 @@ void SimpleFontData::initGDIFont()
     SelectObject(hdc, oldFont);
 }
 
-void SimpleFontData::platformCharWidthInit()
+void Font::platformCharWidthInit()
 {
     // GDI Fonts init charwidths in initGDIFont.
     if (!m_platformData.useGDI()) {
@@ -116,29 +116,29 @@ void SimpleFontData::platformCharWidthInit()
     }
 }
 
-void SimpleFontData::platformDestroy()
+void Font::platformDestroy()
 {
     ScriptFreeCache(&m_scriptCache);
     delete m_scriptFontProperties;
 }
 
-PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
+PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
 {
     float scaledSize = scaleFactor * m_platformData.size();
     if (isCustomFont()) {
         FontPlatformData scaledFont(m_platformData);
         scaledFont.setSize(scaledSize);
-        return SimpleFontData::create(scaledFont, true, false);
+        return Font::create(scaledFont, true, false);
     }
 
     LOGFONT winfont;
     GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont);
     winfont.lfHeight = -lroundf(scaledSize * (m_platformData.useGDI() ? 1 : 32));
     auto hfont = adoptGDIObject(::CreateFontIndirect(&winfont));
-    return SimpleFontData::create(FontPlatformData(WTF::move(hfont), scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false);
+    return Font::create(FontPlatformData(WTF::move(hfont), scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false);
 }
 
-void SimpleFontData::determinePitch()
+void Font::determinePitch()
 {
     if (isCustomFont()) {
         m_treatAsFixedPitch = false;
@@ -159,7 +159,7 @@ void SimpleFontData::determinePitch()
     RestoreDC(dc, -1);
 }
 
-FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const
+FloatRect Font::boundsForGDIGlyph(Glyph glyph) const
 {
     HWndDC hdc(0);
     SetGraphicsMode(hdc, GM_ADVANCED);
@@ -175,7 +175,7 @@ FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const
         gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY); 
 }
 
-float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
+float Font::widthForGDIGlyph(Glyph glyph) const
 {
     HWndDC hdc(0);
     SetGraphicsMode(hdc, GM_ADVANCED);
@@ -191,7 +191,7 @@ float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
     return result;
 }
 
-SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
+SCRIPT_FONTPROPERTIES* Font::scriptFontProperties() const
 {
     if (!m_scriptFontProperties) {
         m_scriptFontProperties = new SCRIPT_FONTPROPERTIES;
index 599f8e3..c56650d 100644 (file)
 
 #include "config.h"
 #include "UniscribeController.h"
+
+#include "Font.h"
 #include "FontCascade.h"
 #include "HWndDC.h"
-#include "SimpleFontData.h"
 #include "TextRun.h"
 #include <wtf/MathExtras.h>
 
@@ -41,7 +42,7 @@ namespace WebCore {
 // that does stuff in that method instead of doing everything in the constructor.  Have advance()
 // take the GlyphBuffer as an arg so that we don't have to populate the glyph buffer when
 // measuring.
-UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts)
+UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts)
     : m_font(*font)
     , m_run(run)
     , m_fallbackFonts(fallbackFonts)
@@ -136,8 +137,8 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
     const UChar* curr = m_run.rtl() ? cp + length  - 1 : cp;
     const UChar* end = m_run.rtl() ? cp - 1 : cp + length;
 
-    const SimpleFontData* fontData;
-    const SimpleFontData* nextFontData = m_font.glyphDataForCharacter(*curr, false).fontData;
+    const Font* fontData;
+    const Font* nextFontData = m_font.glyphDataForCharacter(*curr, false).font;
 
     UChar newC = 0;
 
@@ -158,14 +159,14 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
         UChar c = *curr;
 
         bool forceSmallCaps = isSmallCaps && (U_GET_GC_MASK(c) & U_GC_M_MASK);
-        nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).fontData;
+        nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).font;
         if (m_font.isSmallCaps()) {
             nextIsSmallCaps = forceSmallCaps || (newC = u_toupper(c)) != c;
             if (nextIsSmallCaps)
                 smallCapsBuffer[index] = forceSmallCaps ? c : newC;
         }
 
-        if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFontData())
+        if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFont())
             m_fallbackFonts->add(fontData);
 
         if (nextFontData != fontData || nextIsSmallCaps != isSmallCaps) {
@@ -179,7 +180,7 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
     
     int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : length - indexOfFontTransition;
     if (itemLength) {
-        if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFontData())
+        if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFont())
             m_fallbackFonts->add(nextFontData);
 
         int itemStart = m_run.rtl() ? 0 : indexOfFontTransition;
@@ -190,7 +191,7 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
     m_currentCharacter = baseCharacter + length;
 }
 
-void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
+void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const Font* fontData, GlyphBuffer* glyphBuffer)
 {
     // ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1.  This is why there is an extra empty item
     // hanging out at the end of the array
@@ -232,7 +233,7 @@ void UniscribeController::resetControlAndState()
     m_state.fOverrideDirection = m_run.directionalOverride();
 }
 
-bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
+bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const Font* fontData, GlyphBuffer* glyphBuffer)
 {
     // Determine the string for this item.
     const UChar* str = cp + m_items[i].iCharPos;
@@ -404,7 +405,7 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
     return true;
 }
 
-bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,
+bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const Font* fontData,
                                 Vector<WORD>& glyphs, Vector<WORD>& clusters,
                                 Vector<SCRIPT_VISATTR>& visualAttributes)
 {
index e8731c4..a0c168f 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 class UniscribeController {
 public:
-    UniscribeController(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0);
+    UniscribeController(const FontCascade*, const TextRun&, HashSet<const Font*>* fallbackFonts = 0);
 
     // Advance and measure/place up to the specified character.
     void advance(unsigned to, GlyphBuffer* = 0);
@@ -54,15 +54,15 @@ public:
 private:    
     void resetControlAndState();
 
-    void itemizeShapeAndPlace(const UChar*, unsigned length, const SimpleFontData*, GlyphBuffer*);
-    bool shapeAndPlaceItem(const UChar*, unsigned index, const SimpleFontData*, GlyphBuffer*);
-    bool shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,
+    void itemizeShapeAndPlace(const UChar*, unsigned length, const Font*, GlyphBuffer*);
+    bool shapeAndPlaceItem(const UChar*, unsigned index, const Font*, GlyphBuffer*);
+    bool shape(const UChar* str, int len, SCRIPT_ITEM, const Font*,
                Vector<WORD>& glyphs, Vector<WORD>& clusters,
                Vector<SCRIPT_VISATTR>& visualAttributes);
 
     const FontCascade& m_font;
     const TextRun& m_run;
-    HashSet<const SimpleFontData*>* m_fallbackFonts;
+    HashSet<const Font*>* m_fallbackFonts;
     FloatPoint m_glyphOrigin;
     float m_minGlyphBoundingBoxX;
     float m_maxGlyphBoundingBoxX;
index 209594e..941f95e 100644 (file)
@@ -26,6 +26,7 @@
 #include "BitmapInfo.h"
 #include "Document.h"
 #include "FloatRect.h"
+#include "Font.h"
 #include "FontSelector.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -42,7 +43,6 @@
 #include "RenderView.h"
 #include "Scrollbar.h"
 #include "ScrollbarTheme.h"
-#include "SimpleFontData.h"
 #include "TextRun.h"
 #include "WebCoreInstanceHandle.h"
 #include <wtf/WindowsExtras.h>
index 2d66824..825fcad 100644 (file)
@@ -449,7 +449,7 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo
 
     const RenderStyle& lineStyle = this->lineStyle();
     if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright
-        || lineStyle.fontCascade().primaryFontData().hasVerticalGlyphs())
+        || lineStyle.fontCascade().primaryFont().hasVerticalGlyphs())
         return true;
 
     for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
@@ -460,18 +460,18 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo
             if (downcast<InlineFlowBox>(*child).requiresIdeographicBaseline(textBoxDataMap))
                 return true;
         } else {
-            if (child->lineStyle().fontCascade().primaryFontData().hasVerticalGlyphs())
+            if (child->lineStyle().fontCascade().primaryFont().hasVerticalGlyphs())
                 return true;
             
-            const Vector<const SimpleFontData*>* usedFonts = nullptr;
+            const Vector<const Font*>* usedFonts = nullptr;
             if (is<InlineTextBox>(*child)) {
                 GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(downcast<InlineTextBox>(child));
                 usedFonts = it == textBoxDataMap.end() ? nullptr : &it->value.first;
             }
 
             if (usedFonts) {
-                for (const SimpleFontData* fontData : *usedFonts) {
-                    if (fontData->hasVerticalGlyphs())
+                for (const Font* font : *usedFonts) {
+                    if (font->hasVerticalGlyphs())
                         return true;
                 }
             }
index 23aea72..e63b0ad 100644 (file)
@@ -31,12 +31,12 @@ class HitTestRequest;
 class HitTestResult;
 class InlineTextBox;
 class RenderLineBoxList;
-class SimpleFontData;
+class Font;
 class VerticalPositionCache;
 
 struct GlyphOverflow;
 
-typedef HashMap<const InlineTextBox*, std::pair<Vector<const SimpleFontData*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap;
+typedef HashMap<const InlineTextBox*, std::pair<Vector<const Font*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap;
 
 class InlineFlowBox : public InlineBox {
 public:
index 7746687..cb7bdeb 100644 (file)
@@ -1381,7 +1381,7 @@ TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const FontCasc
 
     TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath());
     run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
-    if (font.primaryFontData().isSVGFont())
+    if (font.primaryFont().isSVGFont())
         run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
 
     // Propagate the maximum length of the characters buffer to the TextRun, even when we're only processing a substring.
index a907b4f..f1c4304 100644 (file)
@@ -2325,7 +2325,7 @@ LayoutUnit RenderBlock::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloa
         return left;
 
     // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
-    float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
+    float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth();
     if (!maxCharWidth)
         return left;
 
@@ -2365,7 +2365,7 @@ LayoutUnit RenderBlock::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFlo
         return right;
 
     // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
-    float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
+    float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth();
     if (!maxCharWidth)
         return right;
 
@@ -3705,7 +3705,7 @@ static inline TextRun constructTextRunInternal(RenderObject* context, const Font
     bool directionalOverride = style.rtlOrdering() == VisualOrder;
 
     TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
-    if (font.primaryFontData().isSVGFont()) {
+    if (font.primaryFont().isSVGFont()) {
         ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
         run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     }
@@ -3725,7 +3725,7 @@ static inline TextRun constructTextRunInternal(RenderObject* context, const Font
             directionalOverride |= isOverride(style.unicodeBidi());
     }
     TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
-    if (font.primaryFontData().isSVGFont()) {
+    if (font.primaryFont().isSVGFont()) {
         ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
         run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     }
index 6e3beaf..cc4925d 100644 (file)
@@ -458,7 +458,7 @@ void RenderBlockFlow::setMarginsForRubyRun(BidiRun* run, RenderRubyRun& renderer
 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* run, RenderText* renderer, float xPos, const LineInfo& lineInfo,
     GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
 {
-    HashSet<const SimpleFontData*> fallbackFonts;
+    HashSet<const Font*> fallbackFonts;
     GlyphOverflow glyphOverflow;
 
     const FontCascade& font = lineStyle(*renderer->parent(), lineInfo).fontCascade();
@@ -509,8 +509,8 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru
             } else
                 measuredWidth += wordMeasurement.width;
             if (!wordMeasurement.fallbackFonts.isEmpty()) {
-                HashSet<const SimpleFontData*>::const_iterator end = wordMeasurement.fallbackFonts.end();
-                for (HashSet<const SimpleFontData*>::const_iterator it = wordMeasurement.fallbackFonts.begin(); it != end; ++it)
+                HashSet<const Font*>::const_iterator end = wordMeasurement.fallbackFonts.end();
+                for (HashSet<const Font*>::const_iterator it = wordMeasurement.fallbackFonts.begin(); it != end; ++it)
                     fallbackFonts.add(*it);
             }
         }
@@ -527,7 +527,7 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru
     run->box()->setLogicalWidth(measuredWidth + hyphenWidth);
     if (!fallbackFonts.isEmpty()) {
         ASSERT(run->box()->behavesLikeText());
-        GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
+        GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const Font*>(), GlyphOverflow())).iterator;
         ASSERT(it->value.first.isEmpty());
         copyToVector(fallbackFonts, it->value.first);
         run->box()->parent()->clearDescendantsHaveSameLineHeightAndBaseline();
@@ -539,7 +539,7 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru
 
     if (!glyphOverflow.isEmpty()) {
         ASSERT(run->box()->behavesLikeText());
-        GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
+        GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const Font*>(), GlyphOverflow())).iterator;
         it->value.second = glyphOverflow;
         run->box()->clearKnownToHaveNoOverflow();
     }
index 5f85d35..fb23379 100644 (file)
@@ -57,7 +57,7 @@ void RenderCombineText::setRenderedText(const String& text)
     m_needsFontUpdate = true;
 }
 
-float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     if (m_isCombined)
         return font.size();
index 77d2be7..9f8ea62 100644 (file)
@@ -46,7 +46,7 @@ private:
     void node() const = delete;
 
     virtual bool isCombineText() const override { return true; }
-    virtual float width(unsigned from, unsigned length, const FontCascade&, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const override;
+    virtual float width(unsigned from, unsigned length, const FontCascade&, float xPosition, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const override;
     virtual const char* renderName() const override { return "RenderCombineText"; }
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     virtual void setRenderedText(const String&) override;
index eb18c2d..004a259 100644 (file)
@@ -27,6 +27,7 @@
 #include "CSSFontSelector.h"
 #include "CSSValueKeywords.h"
 #include "Chrome.h"
+#include "Font.h"
 #include "Frame.h"
 #include "FrameSelection.h"
 #include "FrameView.h"
@@ -42,7 +43,6 @@
 #include "RenderView.h"
 #include "SearchPopupMenu.h"
 #include "Settings.h"
-#include "SimpleFontData.h"
 #include "StyleResolver.h"
 #include "TextControlInnerElements.h"
 
index e84909f..5508e8f 100644 (file)
@@ -451,7 +451,7 @@ LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay
     return box.root().computeCaretRect(left, caretWidth, extraWidthToEndOfLine);
 }
 
-ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
+ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
 {
     if (style.hasTextCombine() && is<RenderCombineText>(*this)) {
         const RenderCombineText& combineText = downcast<RenderCombineText>(*this);
@@ -630,7 +630,7 @@ LineBreakIteratorMode mapLineBreakToIteratorMode(LineBreak lineBreak)
 
 void RenderText::computePreferredLogicalWidths(float leadWidth)
 {
-    HashSet<const SimpleFontData*> fallbackFonts;
+    HashSet<const Font*> fallbackFonts;
     GlyphOverflow glyphOverflow;
     computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow);
     if (fallbackFonts.isEmpty() && !glyphOverflow.left && !glyphOverflow.right && !glyphOverflow.top && !glyphOverflow.bottom)
@@ -643,7 +643,7 @@ static inline float hyphenWidth(RenderText* renderer, const FontCascade& font)
     return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style));
 }
 
-static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const FontCascade& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
+static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const FontCascade& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const Font*>& fallbackFonts, GlyphOverflow& glyphOverflow)
 {
     suffixStart = 0;
     if (word.length() <= minimumSuffixLength)
@@ -683,7 +683,7 @@ static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style
     return maxFragmentWidth;
 }
 
-void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
+void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow& glyphOverflow)
 {
     ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
 
@@ -1206,7 +1206,7 @@ const SimpleLineLayout::Layout* RenderText::simpleLineLayout() const
     return downcast<RenderBlockFlow>(*parent()).simpleLineLayout();
 }
 
-float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     if (from >= textLength())
         return 0;
@@ -1218,7 +1218,7 @@ float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine,
     return width(from, len, lineStyle.fontCascade(), xPos, fallbackFonts, glyphOverflow);
 }
 
-float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     ASSERT(from + len <= textLength());
     if (!textLength())
index a2dc85e..9d9454a 100644 (file)
@@ -89,8 +89,8 @@ public:
     unsigned textLength() const { return m_text.impl()->length(); } // non virtual implementation of length()
     void positionLineBox(InlineTextBox&);
 
-    virtual float width(unsigned from, unsigned len, const FontCascade&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
-    virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+    virtual float width(unsigned from, unsigned len, const FontCascade&, float xPos, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+    virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
 
     float minLogicalWidth() const;
     float maxLogicalWidth() const;
@@ -180,7 +180,7 @@ private:
 
     virtual bool canHaveChildren() const override final { return false; }
 
-    void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&);
+    void computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow&);
 
     bool computeCanUseSimpleFontCodePath() const;
     
@@ -192,7 +192,7 @@ private:
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); return false; }
 
     bool containsOnlyWhitespace(unsigned from, unsigned len) const;
-    float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;
+    float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;
     bool isAllASCII() const { return m_isAllASCII; }
     bool computeUseBackslashAsYenSymbol() const;
 
index 0cf65bf..802f571 100644 (file)
@@ -27,6 +27,7 @@
 #include "CSSFontSelector.h"
 #include "CSSValueKeywords.h"
 #include "Chrome.h"
+#include "Font.h"
 #include "Frame.h"
 #include "FrameSelection.h"
 #include "FrameView.h"
@@ -40,7 +41,6 @@
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "Settings.h"
-#include "SimpleFontData.h"
 #include "StyleResolver.h"
 #include "TextControlInnerElements.h"
 #include <wtf/StackStats.h>
@@ -346,7 +346,7 @@ LayoutUnit RenderTextControlSingleLine::preferredContentLogicalWidth(float charW
     if (family == "Lucida Grande")
         maxCharWidth = scaleEmToUnits(4027);
     else if (style().fontCascade().hasValidAverageCharWidth())
-        maxCharWidth = roundf(style().fontCascade().primaryFontData().maxCharWidth());
+        maxCharWidth = roundf(style().fontCascade().primaryFont().maxCharWidth());
 #endif
 
     // For text inputs, IE adds some extra width.
index aaa137e..61b50d9 100644 (file)
@@ -580,7 +580,7 @@ static void adjustInputElementButtonStyle(RenderStyle& style, HTMLInputElement&
     FontCascade font = style.fontCascade();
     
     RenderObject* renderer = inputElement.renderer();
-    if (font.primaryFontData().isSVGFont() && !renderer)
+    if (font.primaryFont().isSVGFont() && !renderer)
         return;
     
     float maximumWidth = localizedDateCache().maximumWidthForDateType(dateType, font, RenderThemeMeasureTextClient(font, *renderer, style));
index a73d9a3..86f9a8a 100644 (file)
@@ -885,7 +885,7 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox& box, GlyphOverflowAndFallb
         return;
     }
 
-    Vector<const SimpleFontData*>* usedFonts = nullptr;
+    Vector<const Font*>* usedFonts = nullptr;
     GlyphOverflow* glyphOverflow = nullptr;
     if (is<InlineTextBox>(box)) {
         GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(&downcast<InlineTextBox>(box));
@@ -901,7 +901,7 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox& box, GlyphOverflowAndFallb
 
     const RenderStyle& boxLineStyle = box.lineStyle();
     if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) {
-        usedFonts->append(&boxLineStyle.fontCascade().primaryFontData());
+        usedFonts->append(&boxLineStyle.fontCascade().primaryFont());
         for (size_t i = 0; i < usedFonts->size(); ++i) {
             const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
             int usedFontAscent = fontMetrics.ascent(baselineType());
index 24722f9..9c59527 100644 (file)
@@ -52,7 +52,7 @@ namespace WebCore {
 namespace SimpleLineLayout {
 
 template <typename CharacterType>
-static bool canUseForText(const CharacterType* text, unsigned length, const SimpleFontData& fontData)
+static bool canUseForText(const CharacterType* text, unsigned length, const Font& font)
 {
     // FIXME: <textarea maxlength=0> generates empty text node.
     if (!length)
@@ -75,17 +75,17 @@ static bool canUseForText(const CharacterType* text, unsigned length, const Simp
             || direction == U_POP_DIRECTIONAL_FORMAT || direction == U_BOUNDARY_NEUTRAL)
             return false;
 
-        if (!fontData.glyphForCharacter(character))
+        if (!font.glyphForCharacter(character))
             return false;
     }
     return true;
 }
 
-static bool canUseForText(const RenderText& textRenderer, const SimpleFontData& fontData)
+static bool canUseForText(const RenderText& textRenderer, const Font& font)
 {
     if (textRenderer.is8Bit())
-        return canUseForText(textRenderer.characters8(), textRenderer.textLength(), fontData);
-    return canUseForText(textRenderer.characters16(), textRenderer.textLength(), fontData);
+        return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font);
+    return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font);
 }
 
 bool canUseFor(const RenderBlockFlow& flow)
@@ -184,11 +184,11 @@ bool canUseFor