Changeset 178940 in webkit
- Timestamp:
- Jan 22, 2015, 1:57:04 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 118 edited
- 2 moved
-
WebCore/CMakeLists.txt (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.exp.in (modified) (5 diffs)
-
WebCore/WebCore.vcxproj/WebCore.vcxproj (modified) (4 diffs)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (modified) (1 diff)
-
WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm (modified) (2 diffs)
-
WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (modified) (3 diffs)
-
WebCore/bindings/objc/DOM.mm (modified) (2 diffs)
-
WebCore/css/CSSFontFace.cpp (modified) (3 diffs)
-
WebCore/css/CSSFontFace.h (modified) (2 diffs)
-
WebCore/css/CSSFontFaceSource.cpp (modified) (7 diffs)
-
WebCore/css/CSSFontFaceSource.h (modified) (3 diffs)
-
WebCore/css/CSSFontSelector.cpp (modified) (4 diffs)
-
WebCore/css/CSSFontSelector.h (modified) (2 diffs)
-
WebCore/css/CSSSegmentedFontFace.cpp (modified) (4 diffs)
-
WebCore/editing/Editor.h (modified) (2 diffs)
-
WebCore/editing/cocoa/HTMLConverter.mm (modified) (3 diffs)
-
WebCore/editing/ios/EditorIOS.mm (modified) (5 diffs)
-
WebCore/editing/mac/EditorMac.mm (modified) (5 diffs)
-
WebCore/loader/cache/CachedFont.cpp (modified) (3 diffs)
-
WebCore/loader/cache/CachedFont.h (modified) (3 diffs)
-
WebCore/loader/cache/CachedSVGFont.cpp (modified) (1 diff)
-
WebCore/loader/cache/CachedSVGFont.h (modified) (1 diff)
-
WebCore/platform/graphics/Font.cpp (moved) (moved from trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp ) (23 diffs)
-
WebCore/platform/graphics/Font.h (moved) (moved from trunk/Source/WebCore/platform/graphics/SimpleFontData.h ) (16 diffs)
-
WebCore/platform/graphics/FontCache.cpp (modified) (12 diffs)
-
WebCore/platform/graphics/FontCache.h (modified) (6 diffs)
-
WebCore/platform/graphics/FontCascade.cpp (modified) (18 diffs)
-
WebCore/platform/graphics/FontCascade.h (modified) (9 diffs)
-
WebCore/platform/graphics/FontGlyphs.cpp (modified) (19 diffs)
-
WebCore/platform/graphics/FontGlyphs.h (modified) (6 diffs)
-
WebCore/platform/graphics/FontMetrics.h (modified) (1 diff)
-
WebCore/platform/graphics/FontRanges.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/FontRanges.h (modified) (4 diffs)
-
WebCore/platform/graphics/FontSelector.h (modified) (1 diff)
-
WebCore/platform/graphics/GlyphBuffer.h (modified) (7 diffs)
-
WebCore/platform/graphics/GlyphPage.h (modified) (6 diffs)
-
WebCore/platform/graphics/GraphicsContext.cpp (modified) (1 diff)
-
WebCore/platform/graphics/GraphicsContext.h (modified) (3 diffs)
-
WebCore/platform/graphics/TextRun.h (modified) (2 diffs)
-
WebCore/platform/graphics/WidthIterator.cpp (modified) (11 diffs)
-
WebCore/platform/graphics/WidthIterator.h (modified) (3 diffs)
-
WebCore/platform/graphics/cairo/FontCairo.cpp (modified) (9 diffs)
-
WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (modified) (13 diffs)
-
WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (modified) (7 diffs)
-
WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp (modified) (1 diff)
-
WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp (modified) (1 diff)
-
WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (modified) (7 diffs)
-
WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h (modified) (4 diffs)
-
WebCore/platform/graphics/ios/FontCacheIOS.mm (modified) (17 diffs)
-
WebCore/platform/graphics/ios/SimpleFontDataIOS.mm (modified) (6 diffs)
-
WebCore/platform/graphics/mac/ComplexTextController.cpp (modified) (17 diffs)
-
WebCore/platform/graphics/mac/ComplexTextController.h (modified) (6 diffs)
-
WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (modified) (8 diffs)
-
WebCore/platform/graphics/mac/FontCacheMac.mm (modified) (5 diffs)
-
WebCore/platform/graphics/mac/GlyphPageMac.cpp (modified) (5 diffs)
-
WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/mac/SimpleFontDataMac.mm (modified) (14 diffs)
-
WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (modified) (7 diffs)
-
WebCore/platform/graphics/opentype/OpenTypeMathData.h (modified) (2 diffs)
-
WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/opentype/OpenTypeVerticalData.h (modified) (2 diffs)
-
WebCore/platform/graphics/win/FontCGWin.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/win/FontCacheWin.cpp (modified) (7 diffs)
-
WebCore/platform/graphics/win/FontWin.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp (modified) (1 diff)
-
WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp (modified) (1 diff)
-
WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/win/SimpleFontDataWin.cpp (modified) (11 diffs)
-
WebCore/platform/graphics/win/UniscribeController.cpp (modified) (9 diffs)
-
WebCore/platform/graphics/win/UniscribeController.h (modified) (3 diffs)
-
WebCore/platform/win/PopupMenuWin.cpp (modified) (2 diffs)
-
WebCore/rendering/InlineFlowBox.cpp (modified) (3 diffs)
-
WebCore/rendering/InlineFlowBox.h (modified) (1 diff)
-
WebCore/rendering/InlineTextBox.cpp (modified) (1 diff)
-
WebCore/rendering/RenderBlock.cpp (modified) (4 diffs)
-
WebCore/rendering/RenderBlockLineLayout.cpp (modified) (4 diffs)
-
WebCore/rendering/RenderCombineText.cpp (modified) (1 diff)
-
WebCore/rendering/RenderCombineText.h (modified) (1 diff)
-
WebCore/rendering/RenderSearchField.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderText.cpp (modified) (6 diffs)
-
WebCore/rendering/RenderText.h (modified) (3 diffs)
-
WebCore/rendering/RenderTextControlSingleLine.cpp (modified) (3 diffs)
-
WebCore/rendering/RenderThemeIOS.mm (modified) (1 diff)
-
WebCore/rendering/RootInlineBox.cpp (modified) (2 diffs)
-
WebCore/rendering/SimpleLineLayout.cpp (modified) (5 diffs)
-
WebCore/rendering/line/BreakingContextInlineHeaders.h (modified) (5 diffs)
-
WebCore/rendering/mathml/RenderMathMLOperator.cpp (modified) (10 diffs)
-
WebCore/rendering/mathml/RenderMathMLOperator.h (modified) (1 diff)
-
WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp (modified) (4 diffs)
-
WebCore/rendering/mathml/RenderMathMLRoot.cpp (modified) (1 diff)
-
WebCore/rendering/style/RenderStyle.cpp (modified) (1 diff)
-
WebCore/rendering/svg/RenderSVGText.cpp (modified) (2 diffs)
-
WebCore/rendering/svg/SVGInlineTextBox.cpp (modified) (1 diff)
-
WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp (modified) (1 diff)
-
WebCore/rendering/svg/SVGTextMetrics.cpp (modified) (2 diffs)
-
WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (modified) (10 diffs)
-
WebCore/rendering/svg/SVGTextRunRenderingContext.h (modified) (2 diffs)
-
WebCore/svg/SVGFontData.cpp (modified) (9 diffs)
-
WebCore/svg/SVGFontData.h (modified) (3 diffs)
-
WebCore/svg/SVGFontElement.h (modified) (1 diff)
-
WebKit/ios/Misc/EmojiFallbackFontSelector.cpp (modified) (2 diffs)
-
WebKit/ios/Misc/EmojiFallbackFontSelector.h (modified) (1 diff)
-
WebKit/mac/Misc/WebCoreStatistics.mm (modified) (1 diff)
-
WebKit/mac/WebCoreSupport/PopupMenuMac.mm (modified) (3 diffs)
-
WebKit/mac/WebView/WebFrame.mm (modified) (2 diffs)
-
WebKit/mac/WebView/WebHTMLView.mm (modified) (4 diffs)
-
WebKit/win/DOMCoreClasses.cpp (modified) (2 diffs)
-
WebKit/win/WebCoreStatistics.cpp (modified) (2 diffs)
-
WebKit/win/WebView.cpp (modified) (3 diffs)
-
WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebProcess.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r178715 r178940 2055 2055 platform/graphics/FloatRoundedRect.cpp 2056 2056 platform/graphics/FloatSize.cpp 2057 platform/graphics/Font.cpp 2057 2058 platform/graphics/FontCache.cpp 2058 2059 platform/graphics/FontCascade.cpp … … 2090 2091 platform/graphics/SVGGlyph.cpp 2091 2092 platform/graphics/ShadowBlur.cpp 2092 platform/graphics/SimpleFontData.cpp2093 2093 platform/graphics/StringTruncator.cpp 2094 2094 platform/graphics/SurrogatePairAwareTextIterator.cpp -
trunk/Source/WebCore/ChangeLog
r178939 r178940 1 2015-01-21 Antti Koivisto <antti@apple.com> 2 3 Rename SimpleFontData to Font 4 https://bugs.webkit.org/show_bug.cgi?id=140496 5 6 Reviewed by Zalan Bujtas. 7 8 The fallback supporting Font type was renamed FontCascade. 9 We can now rename SimpleFontData to Font matching the usual definition. 10 1 11 2015-01-22 Zalan Bujtas <zalan@apple.com> 2 12 -
trunk/Source/WebCore/WebCore.exp.in
r178820 r178940 470 470 __ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b 471 471 __ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b 472 __ZN7WebCore14SimpleFontDataD1Ev473 472 __ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE 474 473 __ZN7WebCore14TileController14setTilesOpaqueEb … … 1180 1179 __ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURL18CFURLComponentType 1181 1180 __ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString 1181 __ZN7WebCore4FontD1Ev 1182 1182 __ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE 1183 1183 __ZN7WebCore4IconD1Ev … … 1493 1493 __ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE 1494 1494 __ZN7WebCore9FontCache10invalidateEv 1495 __ZN7WebCore9FontCache13fontDataCountEv1496 1495 __ZN7WebCore9FontCache13fontForFamilyERKNS_15FontDescriptionERKN3WTF12AtomicStringEb 1497 __ZN7WebCore9FontCache 21inactiveFontDataCountEv1496 __ZN7WebCore9FontCache17inactiveFontCountEv 1498 1497 __ZN7WebCore9FontCache21purgeInactiveFontDataEi 1499 1498 __ZN7WebCore9FontCache29purgeInactiveFontDataIfNeededEv 1499 __ZN7WebCore9FontCache9fontCountEv 1500 1500 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE 1501 1501 __ZN7WebCore9FrameTree7setNameERKN3WTF12AtomicStringE … … 1635 1635 __ZNK7WebCore10Credential7isEmptyEv 1636 1636 __ZNK7WebCore10FloatPointcv7CGPointEv 1637 __ZNK7WebCore10FontRanges 20fontDataForCharacterEi1638 __ZNK7WebCore10FontRanges 21fontDataForFirstRangeEv1637 __ZNK7WebCore10FontRanges16fontForCharacterEi 1638 __ZNK7WebCore10FontRanges17fontForFirstRangeEv 1639 1639 __ZNK7WebCore10LayoutRect8containsERKS0_ 1640 1640 __ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringENS0_18AllowedPluginTypesE … … 1666 1666 __ZNK7WebCore10TimeRanges5startEjRi 1667 1667 __ZNK7WebCore10TimeRanges6lengthEv 1668 __ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_ 14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE1668 __ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_4FontENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE 1669 1669 __ZNK7WebCore11FontCascade8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEiiNS0_24CustomFontNotReadyActionE 1670 1670 __ZNK7WebCore11FontCascadeeqERKS0_ -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r178761 r178940 8028 8028 <ClCompile Include="..\platform\graphics\FloatRoundedRect.cpp" /> 8029 8029 <ClCompile Include="..\platform\graphics\FloatSize.cpp" /> 8030 <ClCompile Include="..\platform\graphics\Font.cpp" /> 8030 8031 <ClCompile Include="..\platform\graphics\FontCache.cpp" /> 8031 8032 <ClCompile Include="..\platform\graphics\FontCascade.cpp" /> … … 8070 8071 <ClCompile Include="..\platform\graphics\RoundedRect.cpp" /> 8071 8072 <ClCompile Include="..\platform\graphics\ShadowBlur.cpp" /> 8072 <ClCompile Include="..\platform\graphics\SimpleFontData.cpp" />8073 8073 <ClCompile Include="..\platform\graphics\TextRun.cpp" /> 8074 8074 <ClCompile Include="..\platform\graphics\TextTrackRepresentation.cpp" /> … … 19517 19517 <ClInclude Include="..\platform\graphics\FloatSize.h" /> 19518 19518 <ClInclude Include="..\platform\graphics\FloatSizeHash.h" /> 19519 <ClInclude Include="..\platform\graphics\Font.h" /> 19519 19520 <ClInclude Include="..\platform\graphics\FontCache.h" /> 19520 19521 <ClInclude Include="..\platform\graphics\FontCascade.h" /> … … 19569 19570 <ClInclude Include="..\platform\graphics\RoundedRect.h" /> 19570 19571 <ClInclude Include="..\platform\graphics\ShadowBlur.h" /> 19571 <ClInclude Include="..\platform\graphics\SimpleFontData.h" />19572 19572 <ClInclude Include="..\platform\graphics\TextRun.h" /> 19573 19573 <ClInclude Include="..\platform\graphics\TextTrackRepresentation.h" /> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r178927 r178940 4709 4709 B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA510D006CD600EF6F26 /* FontCache.cpp */; }; 4710 4710 B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA520D006CD600EF6F26 /* FontCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4711 B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };4712 B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */; settings = {ATTRIBUTES = (Private, ); }; };4711 B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* Font.cpp */; }; 4712 B2C3DA650D006CD600EF6F26 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* Font.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4713 4713 B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4714 4714 B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */; }; … … 12093 12093 B2C3DA510D006CD600EF6F26 /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; }; 12094 12094 B2C3DA520D006CD600EF6F26 /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCache.h; sourceTree = "<group>"; }; 12095 B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };12096 B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SimpleFontData.h; sourceTree = "<group>"; };12095 B2C3DA530D006CD600EF6F26 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = "<group>"; }; 12096 B2C3DA540D006CD600EF6F26 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; }; 12097 12097 B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; }; 12098 12098 B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontGlyphs.cpp; sourceTree = "<group>"; }; … … 20573 20573 0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */, 20574 20574 0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */, 20575 B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,20576 B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,20575 B2C3DA530D006CD600EF6F26 /* Font.cpp */, 20576 B2C3DA540D006CD600EF6F26 /* Font.h */, 20577 20577 CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */, 20578 20578 CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */, … … 26035 26035 97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */, 26036 26036 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */, 26037 B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,26037 B2C3DA650D006CD600EF6F26 /* Font.h in Headers */, 26038 26038 E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */, 26039 26039 E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */, … … 29467 29467 E45390460EAFD637003695C8 /* SharedTimerIOS.mm in Sources */, 29468 29468 93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */, 29469 B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,29469 B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */, 29470 29470 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */, 29471 29471 37E65950163B10C200EB4574 /* SimpleFontDataIOS.mm in Sources */, -
trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
r178510 r178940 1759 1759 1760 1760 // set basic font info 1761 AXAttributeStringSetFont(attrString, style.fontCascade().primaryFont Data().getCTFont(), range);1761 AXAttributeStringSetFont(attrString, style.fontCascade().primaryFont().getCTFont(), range); 1762 1762 1763 1763 int decor = style.textDecorationsInEffect(); -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
r178510 r178940 47 47 #import "ColorMac.h" 48 48 #import "ContextMenuController.h" 49 #import "Font.h" 49 50 #import "FontCascade.h" 50 51 #import "Frame.h" … … 64 65 #import "RenderWidget.h" 65 66 #import "ScrollView.h" 66 #import "SimpleFontData.h"67 67 #import "TextCheckerClient.h" 68 68 #import "TextCheckingHelper.h" -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r178510 r178940 48 48 #import "ContextMenuController.h" 49 49 #import "Editor.h" 50 #import "Font.h" 50 51 #import "FontCascade.h" 51 52 #import "FrameLoaderClient.h" … … 65 66 #import "RenderWidget.h" 66 67 #import "ScrollView.h" 67 #import "SimpleFontData.h"68 68 #import "TextCheckerClient.h" 69 69 #import "TextCheckingHelper.h" … … 849 849 850 850 // set basic font info 851 AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont Data().getNSFont(), range);851 AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont().getNSFont(), range); 852 852 853 853 // set basic colors -
trunk/Source/WebCore/bindings/objc/DOM.mm
r178510 r178940 670 670 if (!renderer) 671 671 return nil; 672 return renderer->style().fontCascade().primaryFont Data().getNSFont();672 return renderer->style().fontCascade().primaryFont().getNSFont(); 673 673 } 674 674 #else … … 678 678 if (!renderer) 679 679 return nil; 680 return renderer->style().fontCascade().primaryFont Data().getCTFont();680 return renderer->style().fontCascade().primaryFont().getCTFont(); 681 681 } 682 682 #endif -
trunk/Source/WebCore/css/CSSFontFace.cpp
r171886 r178940 31 31 #include "CSSSegmentedFontFace.h" 32 32 #include "Document.h" 33 #include "Font.h" 33 34 #include "FontDescription.h" 34 35 #include "FontLoader.h" 35 36 #include "RuntimeEnabledFeatures.h" 36 #include "SimpleFontData.h"37 37 38 38 namespace WebCore { … … 109 109 } 110 110 111 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)111 RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic) 112 112 { 113 113 m_activeSource = 0; … … 125 125 size_t size = m_sources.size(); 126 126 for (size_t i = 0; i < size; ++i) { 127 if (RefPtr< SimpleFontData> result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector)) {127 if (RefPtr<Font> result = m_sources[i]->font(fontDescription, syntheticBold, syntheticItalic, fontSelector)) { 128 128 m_activeSource = m_sources[i].get(); 129 129 #if ENABLE(FONT_LOAD_EVENTS) -
trunk/Source/WebCore/css/CSSFontFace.h
r165676 r178940 41 41 class CSSSegmentedFontFace; 42 42 class FontDescription; 43 class SimpleFontData;43 class Font; 44 44 45 45 class CSSFontFace : public RefCounted<CSSFontFace> { … … 66 66 void fontLoaded(CSSFontFaceSource*); 67 67 68 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);68 RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic); 69 69 70 70 struct UnicodeRange { -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r178292 r178940 33 33 #include "Document.h" 34 34 #include "ElementIterator.h" 35 #include "Font.h" 35 36 #include "FontCache.h" 36 37 #include "FontDescription.h" 37 #include "SimpleFontData.h"38 38 39 39 #if ENABLE(SVG_OTF_CONVERTER) … … 75 75 void CSSFontFaceSource::pruneTable() 76 76 { 77 if (m_font DataTable.isEmpty())77 if (m_fontTable.isEmpty()) 78 78 return; 79 79 80 m_font DataTable.clear();80 m_fontTable.clear(); 81 81 } 82 82 … … 102 102 } 103 103 104 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)104 RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector) 105 105 { 106 106 // If the font hasn't loaded or an error occurred, then we've got nothing. … … 113 113 #endif 114 114 ) { 115 // We're local. Just return a SimpleFontDatafrom the normal cache.115 // We're local. Just return a Font from the normal cache. 116 116 // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter. 117 117 return fontCache().fontForFamily(fontDescription, m_string, true); 118 118 } 119 119 120 // See if we have a mapping in our FontData cache.121 120 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3 122 121 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); 123 122 124 RefPtr< SimpleFontData> fontData = m_fontDataTable.add(hashKey, nullptr).iterator->value;125 if (font Data)126 return font Data.release();123 RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value; 124 if (font) 125 return font.release(); 127 126 128 127 // If we are still loading, then we let the system pick a font. … … 137 136 return nullptr; 138 137 139 font Data = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);138 font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont); 140 139 } else { 141 140 #if ENABLE(SVG_FONTS) … … 153 152 return nullptr; 154 153 std::unique_ptr<FontCustomPlatformData> customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer); 155 font Data = SimpleFontData::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);154 font = Font::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false); 156 155 #else 157 font Data = SimpleFontData::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);156 font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); 158 157 #endif 159 158 } … … 165 164 fontSelector->beginLoadingFontSoon(m_font.get()); 166 165 167 Ref< SimpleFontData> placeholderFont = fontCache().lastResortFallbackFont(fontDescription);168 Ref< SimpleFontData> placeholderFontCopyInLoadingState = SimpleFontData::create(placeholderFont->platformData(), true, true);166 Ref<Font> placeholderFont = fontCache().lastResortFallbackFont(fontDescription); 167 Ref<Font> placeholderFontCopyInLoadingState = Font::create(placeholderFont->platformData(), true, true); 169 168 return WTF::move(placeholderFontCopyInLoadingState); 170 169 } 171 170 172 return font Data.release();171 return font.release(); 173 172 } 174 173 -
trunk/Source/WebCore/css/CSSFontFaceSource.h
r178292 r178940 43 43 class CSSFontFace; 44 44 class CSSFontSelector; 45 class Font; 45 46 class FontDescription; 46 class SimpleFontData;47 47 48 48 class CSSFontFaceSource final : public CachedFontClient { … … 60 60 virtual void fontLoaded(CachedFont*) override; 61 61 62 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);62 RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*); 63 63 64 64 void pruneTable(); … … 82 82 CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource. 83 83 CSSFontFace* m_face; // Our owning font face. 84 HashMap<unsigned, RefPtr< SimpleFontData>> m_fontDataTable; // The hash key is composed of size synthetic styles.84 HashMap<unsigned, RefPtr<Font>> m_fontTable; // The hash key is composed of size synthetic styles. 85 85 86 86 #if ENABLE(SVG_OTF_CONVERTER) -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r178388 r178940 41 41 #include "CachedResourceLoader.h" 42 42 #include "Document.h" 43 #include "Font.h" 43 44 #include "FontCache.h" 44 45 #include "Frame.h" … … 47 48 #include "SVGNames.h" 48 49 #include "Settings.h" 49 #include "SimpleFontData.h"50 50 #include "StyleProperties.h" 51 51 #include "StyleResolver.h" … … 613 613 } 614 614 615 size_t CSSFontSelector::fallbackFont DataCount()615 size_t CSSFontSelector::fallbackFontCount() 616 616 { 617 617 if (!m_document) … … 624 624 } 625 625 626 PassRefPtr< SimpleFontData> CSSFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t index)626 PassRefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t index) 627 627 { 628 628 ASSERT_UNUSED(index, !index); -
trunk/Source/WebCore/css/CSSFontSelector.h
r178388 r178940 28 28 29 29 #include "CachedResourceHandle.h" 30 #include "Font.h" 30 31 #include "FontSelector.h" 31 #include "SimpleFontData.h"32 32 #include "Timer.h" 33 33 #include <memory> … … 60 60 61 61 virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) override; 62 virtual size_t fallbackFont DataCount() override;63 virtual PassRefPtr< SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) override;62 virtual size_t fallbackFontCount() override; 63 virtual PassRefPtr<Font> fallbackFontAt(const FontDescription&, size_t) override; 64 64 CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family); 65 65 -
trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp
r178388 r178940 31 31 #include "CSSFontSelector.h" 32 32 #include "Document.h" 33 #include "Font.h" 33 34 #include "FontDescription.h" 34 35 #include "RuntimeEnabledFeatures.h" 35 #include "SimpleFontData.h"36 36 37 37 namespace WebCore { … … 91 91 } 92 92 93 static void appendFont DataWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<SimpleFontData>&& fontData, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)93 static void appendFontWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<Font>&& font, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges) 94 94 { 95 if (font Data->isLoading()) {96 ranges.appendRange(FontRanges::Range(0, 0, WTF::move(font Data)));95 if (font->isLoading()) { 96 ranges.appendRange(FontRanges::Range(0, 0, WTF::move(font))); 97 97 return; 98 98 } … … 100 100 unsigned numRanges = unicodeRanges.size(); 101 101 if (!numRanges) { 102 ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(font Data)));102 ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(font))); 103 103 return; 104 104 } 105 105 106 106 for (unsigned j = 0; j < numRanges; ++j) 107 ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), font Data.copyRef()));107 ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), font.copyRef())); 108 108 } 109 109 … … 129 129 bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)); 130 130 bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask); 131 if (RefPtr< SimpleFontData> faceFontData = face->getFontData(fontDescription, syntheticBold, syntheticItalic))132 appendFont DataWithInvalidUnicodeRangeIfLoading(fontRanges, faceFontData.releaseNonNull(), face->ranges());131 if (RefPtr<Font> faceFont = face->font(fontDescription, syntheticBold, syntheticItalic)) 132 appendFontWithInvalidUnicodeRangeIfLoading(fontRanges, faceFont.releaseNonNull(), face->ranges()); 133 133 } 134 134 } -
trunk/Source/WebCore/editing/Editor.h
r177739 r178940 65 65 class Pasteboard; 66 66 class SharedBuffer; 67 class SimpleFontData;67 class Font; 68 68 class SpellCheckRequest; 69 69 class SpellChecker; … … 423 423 WEBCORE_EXPORT static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove); 424 424 WEBCORE_EXPORT bool insertParagraphSeparatorInQuotedContent(); 425 WEBCORE_EXPORT const SimpleFontData* fontForSelection(bool&) const;425 WEBCORE_EXPORT const Font* fontForSelection(bool&) const; 426 426 WEBCORE_EXPORT NSDictionary *fontAttributesForSelectionStart() const; 427 427 WEBCORE_EXPORT String stringSelectionForPasteboard(); -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r178510 r178940 1115 1115 if (!renderer) 1116 1116 return nil; 1117 return renderer->style().fontCascade().primaryFont Data().getNSFont();1117 return renderer->style().fontCascade().primaryFont().getNSFont(); 1118 1118 } 1119 1119 #else … … 1123 1123 if (!renderer) 1124 1124 return nil; 1125 return (PlatformFont *)renderer->style().fontCascade().primaryFont Data().getCTFont();1125 return (PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont(); 1126 1126 } 1127 1127 #endif … … 2595 2595 if (style.textDecorationsInEffect() & TextDecorationLineThrough) 2596 2596 [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName]; 2597 if (NSFont *font = style.fontCascade().primaryFont Data().getNSFont())2597 if (NSFont *font = style.fontCascade().primaryFont().getNSFont()) 2598 2598 [attrs.get() setObject:font forKey:NSFontAttributeName]; 2599 2599 else 2600 [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont Data().platformData().size()] forKey:NSFontAttributeName];2600 [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont().platformData().size()] forKey:NSFontAttributeName]; 2601 2601 if (style.visitedDependentColor(CSSPropertyColor).alpha()) 2602 2602 [attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; -
trunk/Source/WebCore/editing/ios/EditorIOS.mm
r178510 r178940 204 204 } 205 205 206 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const206 const Font* Editor::fontForSelection(bool& hasMultipleFonts) const 207 207 { 208 208 hasMultipleFonts = false; … … 212 212 RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove 213 213 214 const SimpleFontData* result = nullptr;214 const Font* result = nullptr; 215 215 if (style) 216 result = &style->fontCascade().primaryFont Data();216 result = &style->fontCascade().primaryFont(); 217 217 218 218 if (nodeToRemove) { … … 225 225 } 226 226 227 const SimpleFontData* font = 0;227 const Font* font = 0; 228 228 RefPtr<Range> range = m_frame.selection().toNormalizedRange(); 229 229 if (Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode()) { … … 236 236 continue; 237 237 // FIXME: Are there any node types that have renderers, but that we should be skipping? 238 const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();238 const Font& primaryFont = renderer->style().fontCascade().primaryFont(); 239 239 if (!font) 240 240 font = &primaryFont; … … 258 258 NSMutableDictionary* result = [NSMutableDictionary dictionary]; 259 259 260 CTFontRef font = style->fontCascade().primaryFont Data().getCTFont();260 CTFontRef font = style->fontCascade().primaryFont().getCTFont(); 261 261 if (font) 262 262 [result setObject:(id)font forKey:NSFontAttributeName]; -
trunk/Source/WebCore/editing/mac/EditorMac.mm
r178510 r178940 106 106 } 107 107 108 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const108 const Font* Editor::fontForSelection(bool& hasMultipleFonts) const 109 109 { 110 110 hasMultipleFonts = false; … … 114 114 RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove 115 115 116 const SimpleFontData* result = nullptr;116 const Font* result = nullptr; 117 117 if (style) 118 result = &style->fontCascade().primaryFont Data();118 result = &style->fontCascade().primaryFont(); 119 119 120 120 if (nodeToRemove) … … 124 124 } 125 125 126 const SimpleFontData* font = 0;126 const Font* font = 0; 127 127 RefPtr<Range> range = m_frame.selection().toNormalizedRange(); 128 128 Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode(); … … 136 136 continue; 137 137 // FIXME: Are there any node types that have renderers, but that we should be skipping? 138 const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();138 const Font& primaryFont = renderer->style().fontCascade().primaryFont(); 139 139 if (!font) 140 140 font = &primaryFont; … … 161 161 [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; 162 162 163 if (style->fontCascade().primaryFont Data().getNSFont())164 [result setObject:style->fontCascade().primaryFont Data().getNSFont() forKey:NSFontAttributeName];163 if (style->fontCascade().primaryFont().getNSFont()) 164 [result setObject:style->fontCascade().primaryFont().getNSFont() forKey:NSFontAttributeName]; 165 165 166 166 if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black) -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r178628 r178940 100 100 bool CachedFont::ensureCustomFontData(SharedBuffer* data) 101 101 { 102 if (!m_font Data && !errorOccurred() && !isLoading() && data) {102 if (!m_fontCustomPlatformData && !errorOccurred() && !isLoading() && data) { 103 103 RefPtr<SharedBuffer> buffer(data); 104 104 … … 113 113 #endif 114 114 115 m_font Data = buffer ? createFontCustomPlatformData(*buffer) : nullptr;116 m_hasCreatedFontDataWrappingResource = m_font Data && (buffer == m_data);117 if (!m_font Data)115 m_fontCustomPlatformData = buffer ? createFontCustomPlatformData(*buffer) : nullptr; 116 m_hasCreatedFontDataWrappingResource = m_fontCustomPlatformData && (buffer == m_data); 117 if (!m_fontCustomPlatformData) 118 118 setStatus(DecodeError); 119 119 } 120 120 121 return m_font Data.get();121 return m_fontCustomPlatformData.get(); 122 122 } 123 123 124 PassRefPtr<SimpleFontData> CachedFont::getFontData(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)124 RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool) 125 125 { 126 return SimpleFontData::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,126 return Font::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, 127 127 fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false); 128 128 } … … 130 130 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode) 131 131 { 132 ASSERT(m_font Data);133 return m_font Data->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);132 ASSERT(m_fontCustomPlatformData); 133 return m_fontCustomPlatformData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode); 134 134 } 135 135 136 136 void CachedFont::allClientsRemoved() 137 137 { 138 m_font Data = nullptr;138 m_fontCustomPlatformData = nullptr; 139 139 } 140 140 -
trunk/Source/WebCore/loader/cache/CachedFont.h
r178628 r178940 29 29 #include "CachedResource.h" 30 30 #include "CachedResourceClient.h" 31 #include "Font.h" 31 32 #include "FontOrientation.h" 32 33 #include "FontRenderingMode.h" 33 34 #include "FontWidthVariant.h" 34 #include "SimpleFontData.h"35 35 36 36 namespace WebCore { … … 53 53 virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI); 54 54 55 virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);55 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG); 56 56 57 57 protected: … … 71 71 virtual void allClientsRemoved() override; 72 72 73 std::unique_ptr<FontCustomPlatformData> m_font Data;73 std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData; 74 74 bool m_loadInitiated; 75 75 bool m_hasCreatedFontDataWrappingResource; -
trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp
r178628 r178940 52 52 } 53 53 54 PassRefPtr<SimpleFontData> CachedSVGFont::getFontData(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)54 RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) 55 55 { 56 56 #if ENABLE(SVG_OTF_CONVERTER) 57 57 if (!externalSVG || firstFontFace(remoteURI)) 58 return CachedFont:: getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);58 return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG); 59 59 #else 60 60 if (!externalSVG) 61 return CachedFont:: getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);61 return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG); 62 62 63 63 if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI)) 64 return SimpleFontData::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);64 return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); 65 65 #endif 66 66 return nullptr; -
trunk/Source/WebCore/loader/cache/CachedSVGFont.h
r178628 r178940 41 41 virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override; 42 42 43 virtual PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;43 virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override; 44 44 45 45 private: -
trunk/Source/WebCore/platform/graphics/Font.cpp
r178650 r178940 29 29 30 30 #include "config.h" 31 #include " SimpleFontData.h"31 #include "Font.h" 32 32 33 33 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) … … 51 51 const float emphasisMarkFontSizeMultiplier = 0.5f; 52 52 53 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback)53 Font::Font(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback) 54 54 : m_maxCharWidth(-1) 55 55 , m_avgCharWidth(-1) … … 77 77 } 78 78 79 SimpleFontData::SimpleFontData(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)79 Font::Font(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic) 80 80 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) 81 81 , m_svgData(WTF::move(svgData)) … … 94 94 #endif 95 95 { 96 m_svgData->initializeFont Data(this, fontSize);96 m_svgData->initializeFont(this, fontSize); 97 97 } 98 98 99 99 // Estimates of avgCharWidth and maxCharWidth for platforms that don't support accessing these values from the font. 100 void SimpleFontData::initCharWidths()100 void Font::initCharWidths() 101 101 { 102 102 auto* glyphPageZero = glyphPage(0); … … 118 118 } 119 119 120 void SimpleFontData::platformGlyphInit()120 void Font::platformGlyphInit() 121 121 { 122 122 auto* glyphPageZero = glyphPage(0); … … 137 137 // Nasty hack to determine if we should round or ceil space widths. 138 138 // If the font is monospace or fake monospace we ceil to ensure that 139 // every character and the space are the same width. Otherwise we round.139 // every character and the space are the same width. Otherwise we round. 140 140 m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph; 141 141 float width = widthForGlyph(m_spaceGlyph); … … 148 148 // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE. 149 149 // Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph. 150 // See <http://bugs.webkit.org/show_bug.cgi?id=13178> and SimpleFontData::isZeroWidthSpaceGlyph()150 // See <http://bugs.webkit.org/show_bug.cgi?id=13178> and Font::isZeroWidthSpaceGlyph() 151 151 if (m_zeroWidthSpaceGlyph == m_spaceGlyph) 152 152 m_zeroWidthSpaceGlyph = 0; 153 153 } 154 154 155 SimpleFontData::~SimpleFontData()155 Font::~Font() 156 156 { 157 157 removeFromSystemFallbackCache(); 158 158 } 159 159 160 static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)160 static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* font) 161 161 { 162 162 #if ENABLE(SVG_FONTS) 163 if (auto* svgData = font Data->svgData())164 return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, font Data);165 #endif 166 bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, font Data);163 if (auto* svgData = font->svgData()) 164 return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, font); 165 #endif 166 bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, font); 167 167 #if ENABLE(OPENTYPE_VERTICAL) 168 if (hasGlyphs && font Data->verticalData())169 font Data->verticalData()->substituteWithVerticalGlyphs(fontData, &pageToFill, offset, length);168 if (hasGlyphs && font->verticalData()) 169 font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill, offset, length); 170 170 #endif 171 171 return hasGlyphs; 172 172 } 173 173 174 static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const SimpleFontData* fontData)174 static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font* font) 175 175 { 176 176 #if PLATFORM(IOS) 177 177 // FIXME: Times New Roman contains Arabic glyphs, but Core Text doesn't know how to shape them. See <rdar://problem/9823975>. 178 // Once we have the fix for <rdar://problem/9823975> then remove this code together with SimpleFontData::shouldNotBeUsedForArabic()178 // Once we have the fix for <rdar://problem/9823975> then remove this code together with Font::shouldNotBeUsedForArabic() 179 179 // in <rdar://problem/12096835>. 180 if (pageNumber == 6 && font Data->shouldNotBeUsedForArabic())180 if (pageNumber == 6 && font->shouldNotBeUsedForArabic()) 181 181 return nullptr; 182 182 #endif … … 191 191 buffer[i] = start + i; 192 192 193 if ( start == 0) {193 if (!start) { 194 194 // Control characters must not render at all. 195 195 for (unsigned i = 0; i < 0x20; ++i) … … 236 236 // for only 128 out of 256 characters. 237 237 RefPtr<GlyphPage> glyphPage; 238 if (GlyphPage::mayUseMixedFont DataWhenFilling(buffer, bufferLength, fontData))239 glyphPage = GlyphPage::createForMixedFont Data();238 if (GlyphPage::mayUseMixedFontsWhenFilling(buffer, bufferLength, font)) 239 glyphPage = GlyphPage::createForMixedFonts(); 240 240 else 241 glyphPage = GlyphPage::createForSingleFont Data(fontData);242 243 bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, font Data);241 glyphPage = GlyphPage::createForSingleFont(font); 242 243 bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, font); 244 244 if (!haveGlyphs) 245 245 return nullptr; … … 249 249 } 250 250 251 const GlyphPage* SimpleFontData::glyphPage(unsigned pageNumber) const252 { 253 if ( pageNumber == 0) {251 const GlyphPage* Font::glyphPage(unsigned pageNumber) const 252 { 253 if (!pageNumber) { 254 254 if (!m_glyphPageZero) 255 255 m_glyphPageZero = createAndFillGlyphPage(0, this); … … 263 263 } 264 264 265 Glyph SimpleFontData::glyphForCharacter(UChar32 character) const265 Glyph Font::glyphForCharacter(UChar32 character) const 266 266 { 267 267 auto* page = glyphPage(character / GlyphPage::size); … … 271 271 } 272 272 273 GlyphData SimpleFontData::glyphDataForCharacter(UChar32 character) const273 GlyphData Font::glyphDataForCharacter(UChar32 character) const 274 274 { 275 275 auto* page = glyphPage(character / GlyphPage::size); … … 279 279 } 280 280 281 PassRefPtr< SimpleFontData> SimpleFontData::verticalRightOrientationFontData() const281 PassRefPtr<Font> Font::verticalRightOrientationFont() const 282 282 { 283 283 if (!m_derivedFontData) … … 291 291 } 292 292 293 PassRefPtr< SimpleFontData> SimpleFontData::uprightOrientationFontData() const293 PassRefPtr<Font> Font::uprightOrientationFont() const 294 294 { 295 295 if (!m_derivedFontData) … … 300 300 } 301 301 302 PassRefPtr< SimpleFontData> SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const302 PassRefPtr<Font> Font::smallCapsFont(const FontDescription& fontDescription) const 303 303 { 304 304 if (!m_derivedFontData) 305 305 m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont()); 306 306 if (!m_derivedFontData->smallCaps) 307 m_derivedFontData->smallCaps = createScaledFont Data(fontDescription, smallCapsFontSizeMultiplier);307 m_derivedFontData->smallCaps = createScaledFont(fontDescription, smallCapsFontSizeMultiplier); 308 308 309 309 return m_derivedFontData->smallCaps; 310 310 } 311 311 312 PassRefPtr< SimpleFontData> SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const312 PassRefPtr<Font> Font::emphasisMarkFont(const FontDescription& fontDescription) const 313 313 { 314 314 if (!m_derivedFontData) 315 315 m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont()); 316 316 if (!m_derivedFontData->emphasisMark) 317 m_derivedFontData->emphasisMark = createScaledFont Data(fontDescription, emphasisMarkFontSizeMultiplier);317 m_derivedFontData->emphasisMark = createScaledFont(fontDescription, emphasisMarkFontSizeMultiplier); 318 318 319 319 return m_derivedFontData->emphasisMark; 320 320 } 321 321 322 PassRefPtr< SimpleFontData> SimpleFontData::brokenIdeographFontData() const322 PassRefPtr<Font> Font::brokenIdeographFont() const 323 323 { 324 324 if (!m_derivedFontData) … … 331 331 } 332 332 333 PassRefPtr< SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const333 PassRefPtr<Font> Font::nonSyntheticItalicFont() const 334 334 { 335 335 if (!m_derivedFontData) … … 346 346 347 347 #ifndef NDEBUG 348 String SimpleFontData::description() const348 String Font::description() const 349 349 { 350 350 if (isSVGFont()) … … 357 357 #endif 358 358 359 const OpenTypeMathData* SimpleFontData::mathData() const359 const OpenTypeMathData* Font::mathData() const 360 360 { 361 361 if (m_isLoading) … … 369 369 } 370 370 371 SimpleFontData::DerivedFontData::~DerivedFontData()372 { 373 } 374 375 PassRefPtr< SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const371 Font::DerivedFontData::~DerivedFontData() 372 { 373 } 374 375 PassRefPtr<Font> Font::createScaledFont(const FontDescription& fontDescription, float scaleFactor) const 376 376 { 377 377 if (isSVGFont()) 378 378 return nullptr; 379 379 380 return platformCreateScaledFont Data(fontDescription, scaleFactor);381 } 382 383 bool SimpleFontData::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const380 return platformCreateScaledFont(fontDescription, scaleFactor); 381 } 382 383 bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const 384 384 { 385 385 // We need to handle transforms on SVG fonts internally, since they are rendered internally. … … 397 397 } 398 398 399 // Font Datas are not refcounted to avoid cycles.400 typedef HashMap<std::pair<UChar32, unsigned>, SimpleFontData*> CharacterFallbackMap;401 typedef HashMap<const SimpleFontData*, CharacterFallbackMap> SystemFallbackCache;399 // Fonts are not ref'd to avoid cycles. 400 typedef HashMap<std::pair<UChar32, unsigned>, Font*> CharacterFallbackMap; 401 typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache; 402 402 403 403 static SystemFallbackCache& systemFallbackCache() … … 407 407 } 408 408 409 RefPtr< SimpleFontData> SimpleFontData::systemFallbackFontDataForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const409 RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const 410 410 { 411 411 auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap()); … … 414 414 auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr); 415 415 416 SimpleFontData*& fallbackFontData= characterAddResult.iterator->value;417 418 if (!fallbackFont Data) {416 Font*& fallbackFont = characterAddResult.iterator->value; 417 418 if (!fallbackFont) { 419 419 UChar codeUnits[2]; 420 420 int codeUnitsLength; … … 428 428 } 429 429 430 fallbackFont Data= fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();431 if (fallbackFont Data)432 fallbackFont Data->m_isUsedInSystemFallbackCache = true;433 } 434 435 return fallbackFont Data;436 } 437 438 void SimpleFontData::removeFromSystemFallbackCache()430 fallbackFont = fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get(); 431 if (fallbackFont) 432 fallbackFont->m_isUsedInSystemFallbackCache = true; 433 } 434 435 return fallbackFont; 436 } 437 438 void Font::removeFromSystemFallbackCache() 439 439 { 440 440 systemFallbackCache().remove(this); -
trunk/Source/WebCore/platform/graphics/Font.h
r178650 r178940 22 22 */ 23 23 24 #ifndef SimpleFontData_h 25 #define SimpleFontData_h 26 24 #ifndef Font_h 25 #define Font_h 26 27 #include "FloatRect.h" 27 28 #include "FontBaseline.h" 28 29 #include "FontMetrics.h" 29 30 #include "FontPlatformData.h" 30 #include "FloatRect.h"31 31 #include "GlyphBuffer.h" 32 32 #include "GlyphMetricsMap.h" … … 65 65 struct WidthIterator; 66 66 67 enum Font DataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };67 enum FontVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant }; 68 68 enum Pitch { UnknownPitch, FixedPitch, VariablePitch }; 69 69 70 class SimpleFontData : public RefCounted<SimpleFontData> {70 class Font : public RefCounted<Font> { 71 71 public: 72 72 class SVGData { … … 75 75 virtual ~SVGData() { } 76 76 77 virtual void initializeFont Data(SimpleFontData*, float fontSize) = 0;77 virtual void initializeFont(Font*, float fontSize) = 0; 78 78 virtual float widthForSVGGlyph(Glyph, float fontSize) const = 0; 79 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const = 0;79 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font*) const = 0; 80 80 }; 81 81 82 82 // Used to create platform fonts. 83 static Ref< SimpleFontData> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false)83 static Ref<Font> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false) 84 84 { 85 return adoptRef(*new SimpleFontData(platformData, isCustomFont, isLoading, isTextOrientationFallback));85 return adoptRef(*new Font(platformData, isCustomFont, isLoading, isTextOrientationFallback)); 86 86 } 87 87 88 88 // Used to create SVG Fonts. 89 static Ref< SimpleFontData> create(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)89 static Ref<Font> create(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic) 90 90 { 91 return adoptRef(*new SimpleFontData(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic));92 } 93 94 ~ SimpleFontData();95 96 static const SimpleFontData* systemFallback() { return reinterpret_cast<const SimpleFontData*>(-1); }91 return adoptRef(*new Font(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic)); 92 } 93 94 ~Font(); 95 96 static const Font* systemFallback() { return reinterpret_cast<const Font*>(-1); } 97 97 98 98 const FontPlatformData& platformData() const { return m_platformData; } … … 102 102 #endif 103 103 104 PassRefPtr< SimpleFontData> smallCapsFontData(const FontDescription&) const;105 PassRefPtr< SimpleFontData> emphasisMarkFontData(const FontDescription&) const;106 PassRefPtr< SimpleFontData> brokenIdeographFontData() const;107 PassRefPtr< SimpleFontData> nonSyntheticItalicFontData() const;108 109 PassRefPtr< SimpleFontData> variantFontData(const FontDescription& description, FontDataVariant variant) const104 PassRefPtr<Font> smallCapsFont(const FontDescription&) const; 105 PassRefPtr<Font> emphasisMarkFont(const FontDescription&) const; 106 PassRefPtr<Font> brokenIdeographFont() const; 107 PassRefPtr<Font> nonSyntheticItalicFont() const; 108 109 PassRefPtr<Font> variantFont(const FontDescription& description, FontVariant variant) const 110 110 { 111 111 switch (variant) { 112 112 case SmallCapsVariant: 113 return smallCapsFont Data(description);113 return smallCapsFont(description); 114 114 case EmphasisMarkVariant: 115 return emphasisMarkFont Data(description);115 return emphasisMarkFont(description); 116 116 case BrokenIdeographVariant: 117 return brokenIdeographFont Data();117 return brokenIdeographFont(); 118 118 case AutoVariant: 119 119 case NormalVariant: … … 121 121 } 122 122 ASSERT_NOT_REACHED(); 123 return const_cast< SimpleFontData*>(this);124 } 125 126 PassRefPtr< SimpleFontData> verticalRightOrientationFontData() const;127 PassRefPtr< SimpleFontData> uprightOrientationFontData() const;123 return const_cast<Font*>(this); 124 } 125 126 PassRefPtr<Font> verticalRightOrientationFont() const; 127 PassRefPtr<Font> uprightOrientationFont() const; 128 128 129 129 bool hasVerticalGlyphs() const { return m_hasVerticalGlyphs; } … … 141 141 142 142 FloatRect boundsForGlyph(Glyph) const; 143 float widthForGlyph(Glyph glyph) const;143 float widthForGlyph(Glyph) const; 144 144 FloatRect platformBoundsForGlyph(Glyph) const; 145 145 float platformWidthForGlyph(Glyph) const; … … 168 168 Glyph glyphForCharacter(UChar32) const; 169 169 170 RefPtr< SimpleFontData> systemFallbackFontDataForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;170 RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const; 171 171 172 172 const GlyphPage* glyphPage(unsigned pageNumber) const; … … 186 186 187 187 #if USE(APPKIT) 188 const SimpleFontData* compositeFontReferenceFontData(NSFont *key) const;188 const Font* compositeFontReferenceFont(NSFont *key) const; 189 189 NSFont* getNSFont() const { return m_platformData.nsFont(); } 190 190 #endif … … 214 214 215 215 private: 216 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false);217 218 SimpleFontData(std::unique_ptr<SVGData>, float fontSize, bool syntheticBold, bool syntheticItalic);216 Font(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false); 217 218 Font(std::unique_ptr<SVGData>, float fontSize, bool syntheticBold, bool syntheticItalic); 219 219 220 220 void platformInit(); … … 225 225 void initCharWidths(); 226 226 227 PassRefPtr< SimpleFontData> createScaledFontData(const FontDescription&, float scaleFactor) const;228 PassRefPtr< SimpleFontData> platformCreateScaledFontData(const FontDescription&, float scaleFactor) const;227 PassRefPtr<Font> createScaledFont(const FontDescription&, float scaleFactor) const; 228 PassRefPtr<Font> platformCreateScaledFont(const FontDescription&, float scaleFactor) const; 229 229 230 230 void removeFromSystemFallbackCache(); … … 233 233 void initGDIFont(); 234 234 void platformCommonDestroy(); 235 FloatRect boundsForGDIGlyph(Glyph glyph) const;236 float widthForGDIGlyph(Glyph glyph) const;235 FloatRect boundsForGDIGlyph(Glyph) const; 236 float widthForGDIGlyph(Glyph) const; 237 237 #endif 238 238 239 239 #if USE(CG) 240 bool canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const;240 bool canUseFastGlyphAdvanceGetter(Glyph, CGSize& advance, bool& populatedAdvance) const; 241 241 CGFontRenderingStyle renderingStyle() const; 242 242 bool advanceForColorBitmapFont(Glyph, CGSize& result) const; // Returns true if the font is a color bitmap font … … 256 256 257 257 bool m_treatAsFixedPitch; 258 bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face258 bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face 259 259 bool m_isLoading; // Whether or not this custom font is still in the act of loading. 260 260 … … 285 285 286 286 bool forCustomFont; 287 RefPtr< SimpleFontData> smallCaps;288 RefPtr< SimpleFontData> emphasisMark;289 RefPtr< SimpleFontData> brokenIdeograph;290 RefPtr< SimpleFontData> verticalRightOrientation;291 RefPtr< SimpleFontData> uprightOrientation;292 RefPtr< SimpleFontData> nonSyntheticItalic;287 RefPtr<Font> smallCaps; 288 RefPtr<Font> emphasisMark; 289 RefPtr<Font> brokenIdeograph; 290 RefPtr<Font> verticalRightOrientation; 291 RefPtr<Font> uprightOrientation; 292 RefPtr<Font> nonSyntheticItalic; 293 293 #if USE(APPKIT) 294 HashMap<NSFont*, RefPtr< SimpleFontData>> compositeFontReferences;294 HashMap<NSFont*, RefPtr<Font>> compositeFontReferences; 295 295 #endif 296 296 }; … … 320 320 }; 321 321 322 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const322 ALWAYS_INLINE FloatRect Font::boundsForGlyph(Glyph glyph) const 323 323 { 324 324 if (isZeroWidthSpaceGlyph(glyph)) … … 339 339 } 340 340 341 ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const341 ALWAYS_INLINE float Font::widthForGlyph(Glyph glyph) const 342 342 { 343 343 if (isZeroWidthSpaceGlyph(glyph)) … … 367 367 } // namespace WebCore 368 368 369 #endif // SimpleFontData_h369 #endif // Font_h -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r178853 r178940 53 53 54 54 // FIXME: We may be able to simplify this code using C++11 threading primitives, including std::call_once(). 55 static pthread_mutex_t font DataLock;55 static pthread_mutex_t fontLock; 56 56 57 57 static void initFontCacheLockOnce() … … 60 60 pthread_mutexattr_init(&mutexAttribute); 61 61 pthread_mutexattr_settype(&mutexAttribute, PTHREAD_MUTEX_RECURSIVE); 62 pthread_mutex_init(&font DataLock, &mutexAttribute);62 pthread_mutex_init(&fontLock, &mutexAttribute); 63 63 pthread_mutexattr_destroy(&mutexAttribute); 64 64 } … … 72 72 { 73 73 pthread_once(&initFontLockControl, initFontCacheLockOnce); 74 int lockcode = pthread_mutex_lock(&font DataLock);75 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "font DataLock lock failed with code:%d", lockcode);74 int lockcode = pthread_mutex_lock(&fontLock); 75 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock lock failed with code:%d", lockcode); 76 76 } 77 77 ~FontLocker() 78 78 { 79 int lockcode = pthread_mutex_unlock(&font DataLock);80 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "font DataLock unlock failed with code:%d", lockcode);79 int lockcode = pthread_mutex_unlock(&fontLock); 80 ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontLock unlock failed with code:%d", lockcode); 81 81 } 82 82 }; … … 360 360 }; 361 361 362 typedef HashMap<FontPlatformData, RefPtr< SimpleFontData>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;362 typedef HashMap<FontPlatformData, RefPtr<Font>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache; 363 363 364 364 static FontDataCache& cachedFonts() … … 380 380 const int cTargetUnderMemoryPressureInactiveFontData = 30; 381 381 382 RefPtr< SimpleFontData> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)382 RefPtr<Font> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName) 383 383 { 384 384 if (!m_purgeTimer.isActive()) … … 392 392 } 393 393 394 Ref< SimpleFontData> FontCache::fontForPlatformData(const FontPlatformData& platformData)394 Ref<Font> FontCache::fontForPlatformData(const FontPlatformData& platformData) 395 395 { 396 396 #if PLATFORM(IOS) … … 400 400 auto addResult = cachedFonts().add(platformData, nullptr); 401 401 if (addResult.isNewEntry) 402 addResult.iterator->value = SimpleFontData::create(platformData);402 addResult.iterator->value = Font::create(platformData); 403 403 404 404 return *addResult.iterator->value; … … 417 417 if (cachedFonts().size() < inactiveFontDataLimit) 418 418 return; 419 int inactiveCount = inactiveFont DataCount();419 int inactiveCount = inactiveFontCount(); 420 420 if (inactiveCount <= inactiveFontDataLimit) 421 421 return; … … 435 435 436 436 while (purgeCount) { 437 Vector<RefPtr< SimpleFontData>, 20> fontsToDelete;437 Vector<RefPtr<Font>, 20> fontsToDelete; 438 438 for (auto& font : cachedFonts().values()) { 439 439 if (!font->hasOneRef()) … … 467 467 verticalData->m_inFontCache = false; 468 468 } 469 for (auto& font Data: cachedFonts().values()) {470 auto* verticalData = const_cast<OpenTypeVerticalData*>(font Data->verticalData());469 for (auto& font : cachedFonts().values()) { 470 auto* verticalData = const_cast<OpenTypeVerticalData*>(font->verticalData()); 471 471 if (verticalData) 472 472 verticalData->m_inFontCache = true; … … 484 484 } 485 485 486 size_t FontCache::font DataCount()486 size_t FontCache::fontCount() 487 487 { 488 488 return cachedFonts().size(); 489 489 } 490 490 491 size_t FontCache::inactiveFont DataCount()491 size_t FontCache::inactiveFontCount() 492 492 { 493 493 #if PLATFORM(IOS) … … 552 552 553 553 #if !PLATFORM(COCOA) 554 RefPtr< SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&)554 RefPtr<Font> FontCache::similarFont(const FontDescription&) 555 555 { 556 556 return nullptr; -
trunk/Source/WebCore/platform/graphics/FontCache.h
r178510 r178940 56 56 class FontSelector; 57 57 class OpenTypeVerticalData; 58 class SimpleFontData;58 class Font; 59 59 60 60 #if PLATFORM(WIN) … … 112 112 113 113 // This method is implemented by the platform. 114 RefPtr< SimpleFontData> systemFallbackForCharacters(const FontDescription&, const SimpleFontData* originalFontData, bool isPlatformFont, const UChar* characters, int length);114 RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length); 115 115 116 116 // Also implemented by the platform. … … 129 129 void getTraitsInFamily(const AtomicString&, Vector<unsigned>&); 130 130 131 WEBCORE_EXPORT RefPtr< SimpleFontData> fontForFamily(const FontDescription&, const AtomicString&, bool checkingAlternateName = false);132 WEBCORE_EXPORT Ref< SimpleFontData> lastResortFallbackFont(const FontDescription&);133 WEBCORE_EXPORT Ref< SimpleFontData> fontForPlatformData(const FontPlatformData&);134 RefPtr< SimpleFontData> similarFontPlatformData(const FontDescription&);131 WEBCORE_EXPORT RefPtr<Font> fontForFamily(const FontDescription&, const AtomicString&, bool checkingAlternateName = false); 132 WEBCORE_EXPORT Ref<Font> lastResortFallbackFont(const FontDescription&); 133 WEBCORE_EXPORT Ref<Font> fontForPlatformData(const FontPlatformData&); 134 RefPtr<Font> similarFont(const FontDescription&); 135 135 136 136 void addClient(FontSelector*); … … 140 140 WEBCORE_EXPORT void invalidate(); 141 141 142 WEBCORE_EXPORT size_t font DataCount();143 WEBCORE_EXPORT size_t inactiveFont DataCount();142 WEBCORE_EXPORT size_t fontCount(); 143 WEBCORE_EXPORT size_t inactiveFontCount(); 144 144 WEBCORE_EXPORT void purgeInactiveFontData(int count = INT_MAX); 145 145 146 146 #if PLATFORM(WIN) 147 RefPtr< SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);147 RefPtr<Font> fontFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName); 148 148 #endif 149 149 … … 174 174 #if PLATFORM(IOS) 175 175 FontPlatformData* getCustomFallbackFont(const UInt32, const FontDescription&); 176 PassRefPtr< SimpleFontData> getSystemFontFallbackForCharacters(const FontDescription&, const SimpleFontData*, const UChar* characters, int length);176 PassRefPtr<Font> getSystemFontFallbackForCharacters(const FontDescription&, const Font*, const UChar* characters, int length); 177 177 #endif 178 178 std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family); … … 183 183 friend class ComplexTextController; 184 184 #endif 185 friend class SimpleFontData;185 friend class Font; 186 186 }; 187 187 -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r178853 r178940 125 125 126 126 // FIXME: We should make this constructor platform-independent. 127 FontCascade::FontCascade(const FontPlatformData& font Data, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)128 : m_glyphs(FontGlyphs::createForPlatformFont(font Data))127 FontCascade::FontCascade(const FontPlatformData& font, bool isPrinterFont, FontSmoothingMode fontSmoothingMode) 128 : m_glyphs(FontGlyphs::createForPlatformFont(font)) 129 129 , m_letterSpacing(0) 130 130 , m_wordSpacing(0) … … 135 135 m_fontDescription.setFontSmoothing(fontSmoothingMode); 136 136 #if PLATFORM(IOS) 137 m_fontDescription.setSpecifiedSize(CTFontGetSize(font Data.font()));138 m_fontDescription.setComputedSize(CTFontGetSize(font Data.font()));139 m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(font Data.font()) & kCTFontTraitItalic);140 m_fontDescription.setWeight((CTFontGetSymbolicTraits(font Data.font()) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);137 m_fontDescription.setSpecifiedSize(CTFontGetSize(font.font())); 138 m_fontDescription.setComputedSize(CTFontGetSize(font.font())); 139 m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(font.font()) & kCTFontTraitItalic); 140 m_fontDescription.setWeight((CTFontGetSymbolicTraits(font.font()) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal); 141 141 #endif 142 142 } … … 144 144 // FIXME: We should make this constructor platform-independent. 145 145 #if PLATFORM(IOS) 146 FontCascade::FontCascade(const FontPlatformData& font Data, PassRefPtr<FontSelector> fontSelector)147 : m_glyphs(FontGlyphs::createForPlatformFont(font Data))146 FontCascade::FontCascade(const FontPlatformData& font, PassRefPtr<FontSelector> fontSelector) 147 : m_glyphs(FontGlyphs::createForPlatformFont(font)) 148 148 , m_letterSpacing(0) 149 149 , m_wordSpacing(0) 150 150 , m_typesettingFeatures(computeTypesettingFeatures()) 151 151 { 152 CTFontRef primaryFont = font Data.font();152 CTFontRef primaryFont = font.font(); 153 153 m_fontDescription.setSpecifiedSize(CTFontGetSize(primaryFont)); 154 154 m_fontDescription.setComputedSize(CTFontGetSize(primaryFont)); 155 155 m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitItalic); 156 156 m_fontDescription.setWeight((CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal); 157 m_fontDescription.setUsePrinterFont(font Data.isPrinterFont());157 m_fontDescription.setUsePrinterFont(font.isPrinterFont()); 158 158 m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get()); 159 159 } … … 372 372 } 373 373 374 float FontCascade::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const374 float FontCascade::width(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 375 375 { 376 376 CodePath codePathToUse = codePath(run); … … 390 390 return *cacheEntry; 391 391 392 HashSet<const SimpleFontData*> localFallbackFonts;392 HashSet<const Font*> localFallbackFonts; 393 393 if (!fallbackFonts) 394 394 fallbackFonts = &localFallbackFonts; … … 417 417 } 418 418 419 GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, Font DataVariant variant) const419 GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontVariant variant) const 420 420 { 421 421 if (variant == AutoVariant) { 422 if (m_fontDescription.smallCaps() && !primaryFont Data().isSVGFont()) {422 if (m_fontDescription.smallCaps() && !primaryFont().isSVGFont()) { 423 423 UChar32 upperC = u_toupper(c); 424 424 if (upperC != c) { … … 447 447 } 448 448 449 float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const SimpleFontData*>*)449 float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*) 450 450 { 451 451 ASSERT_NOT_REACHED(); … … 506 506 #if PLATFORM(MAC) || PLATFORM(IOS) 507 507 // Internal fonts on OS X and iOS also have an invalid entry in the table for avgCharWidth. 508 if (primaryFont DataIsSystemFont())508 if (primaryFontIsSystemFont()) 509 509 return false; 510 510 #endif … … 526 526 bool success = hasValidAverageCharWidth(); 527 527 if (success) 528 width = roundf(primaryFont Data().avgCharWidth()); // FIXME: primaryFontData() might not correspond to firstFamily().528 width = roundf(primaryFont().avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily(). 529 529 return success; 530 530 } … … 1174 1174 return 0; 1175 1175 1176 const SimpleFontData* markFontData = markGlyphData.fontData;1176 const Font* markFontData = markGlyphData.font; 1177 1177 ASSERT(markFontData); 1178 1178 if (!markFontData) … … 1188 1188 return 0; 1189 1189 1190 const SimpleFontData* markFontData = markGlyphData.fontData;1190 const Font* markFontData = markGlyphData.font; 1191 1191 ASSERT(markFontData); 1192 1192 if (!markFontData) … … 1202 1202 return 0; 1203 1203 1204 const SimpleFontData* markFontData = markGlyphData.fontData;1204 const Font* markFontData = markGlyphData.font; 1205 1205 ASSERT(markFontData); 1206 1206 if (!markFontData) … … 1274 1274 1275 1275 // Draw each contiguous run of glyphs that use the same font data. 1276 const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);1276 const Font* fontData = glyphBuffer.fontAt(0); 1277 1277 FloatSize offset = glyphBuffer.offsetAt(0); 1278 1278 FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height()); … … 1285 1285 #endif 1286 1286 while (nextGlyph < glyphBuffer.size()) { 1287 const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);1287 const Font* nextFontData = glyphBuffer.fontAt(nextGlyph); 1288 1288 FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph); 1289 1289 … … 1318 1318 } 1319 1319 1320 inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)1320 inline static float offsetToMiddleOfGlyph(const Font* fontData, Glyph glyph) 1321 1321 { 1322 1322 if (fontData->platformData().orientation() == Horizontal) { … … 1330 1330 inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, size_t i) 1331 1331 { 1332 return offsetToMiddleOfGlyph(glyphBuffer.font DataAt(i), glyphBuffer.glyphAt(i));1332 return offsetToMiddleOfGlyph(glyphBuffer.fontAt(i), glyphBuffer.glyphAt(i)); 1333 1333 } 1334 1334 … … 1339 1339 return; 1340 1340 1341 const SimpleFontData* markFontData = markGlyphData.fontData;1341 const Font* markFontData = markGlyphData.font; 1342 1342 ASSERT(markFontData); 1343 1343 if (!markFontData) … … 1362 1362 } 1363 1363 1364 float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const1364 float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 1365 1365 { 1366 1366 WidthIterator it(this, run, fallbackFonts, glyphOverflow); -
trunk/Source/WebCore/platform/graphics/FontCascade.h
r178853 r178940 27 27 28 28 #include "DashArray.h" 29 #include "Font.h" 29 30 #include "FontDescription.h" 30 31 #include "FontGlyphs.h" 31 32 #include "Path.h" 32 #include "SimpleFontData.h"33 33 #include "TextDirection.h" 34 34 #include "TypesettingFeatures.h" … … 135 135 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady }; 136 136 WEBCORE_EXPORT float drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; 137 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const;137 void drawGlyphs(GraphicsContext*, const Font*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const; 138 138 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1) const; 139 139 140 140 DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const; 141 141 142 WEBCORE_EXPORT float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;142 WEBCORE_EXPORT float width(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 143 143 float width(const TextRun&, int& charsConsumed, String& glyphName) const; 144 144 145 145 PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWhiteSpace) const; 146 146 static void deleteLayout(TextLayout*); 147 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts = 0);147 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts = 0); 148 148 149 149 int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const; … … 173 173 bool isPlatformFont() const { return m_glyphs->isForPlatformFont(); } 174 174 175 const FontMetrics& fontMetrics() const { return primaryFont Data().fontMetrics(); }176 float spaceWidth() const { return primaryFont Data().spaceWidth() + m_letterSpacing; }177 float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const;178 float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFont Data(), tabSize, position); }175 const FontMetrics& fontMetrics() const { return primaryFont().fontMetrics(); } 176 float spaceWidth() const { return primaryFont().spaceWidth() + m_letterSpacing; } 177 float tabWidth(const Font&, unsigned tabSize, float position) const; 178 float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFont(), tabSize, position); } 179 179 bool hasValidAverageCharWidth() const; 180 180 bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success … … 184 184 int emphasisMarkHeight(const AtomicString&) const; 185 185 186 const SimpleFontData& primaryFontData() const;186 const Font& primaryFont() const; 187 187 const FontRanges& fallbackRangesAt(unsigned) const; 188 GlyphData glyphDataForCharacter(UChar32, bool mirror, Font DataVariant = AutoVariant) const;188 GlyphData glyphDataForCharacter(UChar32, bool mirror, FontVariant = AutoVariant) const; 189 189 190 190 #if PLATFORM(COCOA) 191 const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, size_t length, FontDataVariant) const;191 const Font* fontForCombiningCharacterSequence(const UChar*, size_t length, FontVariant) const; 192 192 #endif 193 193 … … 208 208 static CodePath characterRangeCodePath(const UChar*, unsigned len); 209 209 210 bool primaryFont DataIsSystemFont() const;210 bool primaryFontIsSystemFont() const; 211 211 212 212 private: … … 219 219 void drawGlyphBuffer(GraphicsContext*, const TextRun&, const GlyphBuffer&, FloatPoint&) const; 220 220 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const GlyphBuffer&, const AtomicString&, const FloatPoint&) const; 221 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;221 float floatWidthForSimpleText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 222 222 int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const; 223 223 void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, int from, int to) const; … … 232 232 float drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 233 233 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const; 234 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;234 float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 235 235 int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const; 236 236 void adjustSelectionRectForComplexText(const TextRun&, LayoutRect& selectionRect, int from, int to) const; … … 353 353 } 354 354 355 inline const SimpleFontData& FontCascade::primaryFontData() const355 inline const Font& FontCascade::primaryFont() const 356 356 { 357 357 ASSERT(m_glyphs); 358 return m_glyphs->primary SimpleFontData(m_fontDescription);358 return m_glyphs->primaryFont(m_fontDescription); 359 359 } 360 360 … … 376 376 } 377 377 378 inline float FontCascade::tabWidth(const SimpleFontData& fontData, unsigned tabSize, float position) const378 inline float FontCascade::tabWidth(const Font& font, unsigned tabSize, float position) const 379 379 { 380 380 if (!tabSize) 381 381 return letterSpacing(); 382 float tabWidth = tabSize * font Data.spaceWidth() + letterSpacing();382 float tabWidth = tabSize * font.spaceWidth() + letterSpacing(); 383 383 float tabDeltaWidth = tabWidth - fmodf(position, tabWidth); 384 return (tabDeltaWidth < font Data.spaceWidth() / 2) ? tabWidth : tabDeltaWidth;384 return (tabDeltaWidth < font.spaceWidth() / 2) ? tabWidth : tabDeltaWidth; 385 385 } 386 386 -
trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp
r178853 r178940 38 38 39 39 FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector) 40 : m_cachedPrimary SimpleFontData(0)40 : m_cachedPrimaryFont(0) 41 41 , m_fontSelector(fontSelector) 42 42 , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0) … … 46 46 47 47 FontGlyphs::FontGlyphs(const FontPlatformData& platformData) 48 : m_cachedPrimary SimpleFontData(0)48 : m_cachedPrimaryFont(0) 49 49 , m_fontSelector(0) 50 50 , m_fontSelectorVersion(0) … … 64 64 unsigned numRanges = primaryRanges.size(); 65 65 if (numRanges == 1) 66 m_pitch = primaryRanges.rangeAt(0).font Data().pitch();66 m_pitch = primaryRanges.rangeAt(0).font().pitch(); 67 67 else 68 68 m_pitch = VariablePitch; … … 97 97 // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the 98 98 // Geeza Pro font. 99 return FontRanges(fontCache().similarFont PlatformData(description));99 return FontRanges(fontCache().similarFont(description)); 100 100 } 101 101 … … 127 127 128 128 unsigned fontSelectorFallbackIndex = m_lastRealizedFallbackIndex - description.familyCount(); 129 if (fontSelectorFallbackIndex == m_fontSelector->fallbackFont DataCount())129 if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontCount()) 130 130 return fontRanges; 131 131 ++m_lastRealizedFallbackIndex; 132 fontRanges = FontRanges(m_fontSelector->fallbackFont DataAt(description, fontSelectorFallbackIndex));132 fontRanges = FontRanges(m_fontSelector->fallbackFontAt(description, fontSelectorFallbackIndex)); 133 133 } 134 134 … … 222 222 static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 character, GlyphData& data) 223 223 { 224 GlyphData nonItalicData = data.font Data->nonSyntheticItalicFontData()->glyphDataForCharacter(character);225 if (nonItalicData.font Data)224 GlyphData nonItalicData = data.font->nonSyntheticItalicFont()->glyphDataForCharacter(character); 225 if (nonItalicData.font) 226 226 return nonItalicData; 227 227 return data; … … 232 232 { 233 233 if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) { 234 GlyphData uprightData = data.font Data->uprightOrientationFontData()->glyphDataForCharacter(character);234 GlyphData uprightData = data.font->uprightOrientationFont()->glyphDataForCharacter(character); 235 235 // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright. 236 236 if (data.glyph == uprightData.glyph) … … 238 238 // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that 239 239 // glyph, so we fall back to the upright data and use the horizontal glyph. 240 if (uprightData.font Data)240 if (uprightData.font) 241 241 return uprightData; 242 242 } else if (orientation == NonCJKGlyphOrientationVerticalRight) { 243 GlyphData verticalRightData = data.font Data->verticalRightOrientationFontData()->glyphDataForCharacter(character);243 GlyphData verticalRightData = data.font->verticalRightOrientationFont()->glyphDataForCharacter(character); 244 244 // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked 245 245 // into it. … … 247 247 return data; 248 248 // The glyphs are identical, meaning that we should just use the horizontal glyph. 249 if (verticalRightData.font Data)249 if (verticalRightData.font) 250 250 return verticalRightData; 251 251 } … … 253 253 } 254 254 255 GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, Font DataVariant variant)255 GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontVariant variant) 256 256 { 257 257 // System fallback is character-dependent. 258 258 auto& primaryRanges = realizeFallbackRangesAt(description, 0); 259 auto* originalFont Data = primaryRanges.fontDataForCharacter(c);260 if (!originalFont Data)261 originalFont Data = &primaryRanges.fontDataForFirstRange();262 263 RefPtr< SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont);264 if (!systemFallbackFont Data)259 auto* originalFont = primaryRanges.fontForCharacter(c); 260 if (!originalFont) 261 originalFont = &primaryRanges.fontForFirstRange(); 262 263 RefPtr<Font> systemFallbackFont = originalFont->systemFallbackFontForCharacter(c, description, m_isForPlatformFont); 264 if (!systemFallbackFont) 265 265 return GlyphData(); 266 266 267 if (systemFallbackFont Data->platformData().orientation() == Vertical && !systemFallbackFontData->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))267 if (systemFallbackFont->platformData().orientation() == Vertical && !systemFallbackFont->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c)) 268 268 variant = BrokenIdeographVariant; 269 269 270 270 GlyphData fallbackGlyphData; 271 271 if (variant == NormalVariant) 272 fallbackGlyphData = systemFallbackFont Data->glyphDataForCharacter(c);272 fallbackGlyphData = systemFallbackFont->glyphDataForCharacter(c); 273 273 else 274 fallbackGlyphData = systemFallbackFont Data->variantFontData(description, variant)->glyphDataForCharacter(c);275 276 if (variant == NormalVariant && fallbackGlyphData.font Data) {277 if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.font Data->platformData().orientation() == Vertical && !fallbackGlyphData.fontData->isTextOrientationFallback())274 fallbackGlyphData = systemFallbackFont->variantFont(description, variant)->glyphDataForCharacter(c); 275 276 if (variant == NormalVariant && fallbackGlyphData.font) { 277 if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.font->platformData().orientation() == Vertical && !fallbackGlyphData.font->isTextOrientationFallback()) 278 278 fallbackGlyphData = glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), fallbackGlyphData); 279 279 } … … 281 281 // Keep the system fallback fonts we use alive. 282 282 if (fallbackGlyphData.glyph) 283 m_systemFallbackFont DataSet.add(systemFallbackFontData.release());283 m_systemFallbackFontSet.add(systemFallbackFont.release()); 284 284 285 285 return fallbackGlyphData; 286 286 } 287 287 288 GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, Font DataVariant variant, unsigned fallbackIndex)288 GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontVariant variant, unsigned fallbackIndex) 289 289 { 290 290 while (true) { … … 292 292 if (fontRanges.isNull()) 293 293 break; 294 auto* font Data = fontRanges.fontDataForCharacter(c);295 GlyphData data = font Data ? fontData->glyphDataForCharacter(c) : GlyphData();296 if (data.font Data) {297 // The variantFont Datafunction should not normally return 0.294 auto* font = fontRanges.fontForCharacter(c); 295 GlyphData data = font ? font->glyphDataForCharacter(c) : GlyphData(); 296 if (data.font) { 297 // The variantFont function should not normally return 0. 298 298 // But if it does, we will just render the capital letter big. 299 RefPtr< SimpleFontData> variantFontData = data.fontData->variantFontData(description, variant);300 if (!variantFont Data)299 RefPtr<Font> variantFont = data.font->variantFont(description, variant); 300 if (!variantFont) 301 301 return data; 302 302 303 return variantFont Data->glyphDataForCharacter(c);303 return variantFont->glyphDataForCharacter(c); 304 304 } 305 305 } … … 316 316 if (fontRanges.isNull()) 317 317 break; 318 auto* simpleFontData = fontRanges.fontDataForCharacter(c);319 auto* page = simpleFontData ? simpleFontData->glyphPage(pageNumber) : nullptr;318 auto* font = fontRanges.fontForCharacter(c); 319 auto* page = font ? font->glyphPage(pageNumber) : nullptr; 320 320 if (!page) 321 321 continue; 322 322 GlyphData data = page->glyphDataForCharacter(c); 323 if (data.font Data) {324 if (data.font Data->platformData().orientation() == Vertical && !data.fontData->isTextOrientationFallback()) {323 if (data.font) { 324 if (data.font->platformData().orientation() == Vertical && !data.font->isTextOrientationFallback()) { 325 325 if (!FontCascade::isCJKIdeographOrSymbol(c)) 326 326 return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data); 327 327 328 if (!data.font Data->hasVerticalGlyphs()) {328 if (!data.font->hasVerticalGlyphs()) { 329 329 // Use the broken ideograph font data. The broken ideograph font will use the horizontal width of glyphs 330 330 // to make sure you get a square (even for broken glyphs like symbols used for punctuation). … … 332 332 } 333 333 #if PLATFORM(COCOA) 334 if (data.font Data->platformData().syntheticOblique())334 if (data.font->platformData().syntheticOblique()) 335 335 return glyphDataForCJKCharacterWithoutSyntheticItalic(c, data); 336 336 #endif … … 346 346 static RefPtr<GlyphPage> glyphPageFromFontRanges(unsigned pageNumber, const FontRanges& fontRanges) 347 347 { 348 const SimpleFontData* simpleFontData= nullptr;348 const Font* font = nullptr; 349 349 UChar32 pageRangeFrom = pageNumber * GlyphPage::size; 350 350 UChar32 pageRangeTo = pageRangeFrom + GlyphPage::size - 1; … … 353 353 if (range.to()) { 354 354 if (range.from() <= pageRangeFrom && pageRangeTo <= range.to()) 355 simpleFontData = &range.fontData();355 font = &range.font(); 356 356 break; 357 357 } 358 358 } 359 if (! simpleFontData)359 if (!font) 360 360 return nullptr; 361 361 362 if ( simpleFontData->platformData().orientation() == Vertical)362 if (font->platformData().orientation() == Vertical) 363 363 return nullptr; 364 364 365 return const_cast<GlyphPage*>( simpleFontData->glyphPage(pageNumber));366 } 367 368 GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, Font DataVariant variant)365 return const_cast<GlyphPage*>(font->glyphPage(pageNumber)); 366 } 367 368 GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontVariant variant) 369 369 { 370 370 ASSERT(isMainThread()); … … 383 383 if (!glyphData.glyph) { 384 384 if (!cachedPage) 385 cachedPage = GlyphPage::createForMixedFont Data();385 cachedPage = GlyphPage::createForMixedFonts(); 386 386 else if (cachedPage->isImmutable()) 387 cachedPage = GlyphPage::createCopyForMixedFont Data(*cachedPage);387 cachedPage = GlyphPage::createCopyForMixedFonts(*cachedPage); 388 388 389 389 glyphData = glyphDataForNormalVariant(c, description); 390 cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font Data);390 cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font); 391 391 } 392 392 return glyphData; … … 395 395 void FontGlyphs::pruneSystemFallbacks() 396 396 { 397 if (m_systemFallbackFont DataSet.isEmpty())397 if (m_systemFallbackFontSet.isEmpty()) 398 398 return; 399 399 // Mutable glyph pages may reference fallback fonts. … … 403 403 return !keyAndValue.value->isImmutable(); 404 404 }); 405 m_systemFallbackFont DataSet.clear();406 } 407 408 } 405 m_systemFallbackFontSet.clear(); 406 } 407 408 } -
trunk/Source/WebCore/platform/graphics/FontGlyphs.h
r178853 r178940 22 22 #define FontGlyphs_h 23 23 24 #include "Font.h" 24 25 #include "FontRanges.h" 25 26 #include "FontSelector.h" 26 27 #include "GlyphPage.h" 27 #include "SimpleFontData.h"28 28 #include "WidthCache.h" 29 29 #include <wtf/Forward.h> … … 52 52 bool isForPlatformFont() const { return m_isForPlatformFont; } 53 53 54 GlyphData glyphDataForCharacter(UChar32, const FontDescription&, Font DataVariant);54 GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontVariant); 55 55 56 56 bool isFixedPitch(const FontDescription&); … … 67 67 const WidthCache& widthCache() const { return m_widthCache; } 68 68 69 const SimpleFontData& primarySimpleFontData(const FontDescription&);69 const Font& primaryFont(const FontDescription&); 70 70 WEBCORE_EXPORT const FontRanges& realizeFallbackRangesAt(const FontDescription&, unsigned fallbackIndex); 71 71 … … 76 76 FontGlyphs(const FontPlatformData&); 77 77 78 GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, Font DataVariant);78 GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontVariant); 79 79 GlyphData glyphDataForNormalVariant(UChar32, const FontDescription&); 80 GlyphData glyphDataForVariant(UChar32, const FontDescription&, Font DataVariant, unsigned fallbackIndex);80 GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontVariant, unsigned fallbackIndex); 81 81 82 82 Vector<FontRanges, 1> m_realizedFallbackRanges; … … 86 86 HashMap<int, RefPtr<GlyphPage>> m_cachedPages; 87 87 88 HashSet<RefPtr< SimpleFontData>> m_systemFallbackFontDataSet;88 HashSet<RefPtr<Font>> m_systemFallbackFontSet; 89 89 90 const SimpleFontData* m_cachedPrimarySimpleFontData;90 const Font* m_cachedPrimaryFont; 91 91 RefPtr<FontSelector> m_fontSelector; 92 92 … … 106 106 }; 107 107 108 inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescription& description)108 inline const Font& FontGlyphs::primaryFont(const FontDescription& description) 109 109 { 110 110 ASSERT(isMainThread()); 111 if (!m_cachedPrimary SimpleFontData) {111 if (!m_cachedPrimaryFont) { 112 112 auto& primaryRanges = realizeFallbackRangesAt(description, 0); 113 m_cachedPrimary SimpleFontData = primaryRanges.fontDataForCharacter(' ');114 if (!m_cachedPrimary SimpleFontData)115 m_cachedPrimary SimpleFontData = &primaryRanges.fontDataForFirstRange();113 m_cachedPrimaryFont = primaryRanges.fontForCharacter(' '); 114 if (!m_cachedPrimaryFont) 115 m_cachedPrimaryFont = &primaryRanges.fontForFirstRange(); 116 116 } 117 return *m_cachedPrimary SimpleFontData;117 return *m_cachedPrimaryFont; 118 118 } 119 119 -
trunk/Source/WebCore/platform/graphics/FontMetrics.h
r176298 r178940 134 134 135 135 private: 136 friend class SimpleFontData;136 friend class Font; 137 137 138 138 void reset() -
trunk/Source/WebCore/platform/graphics/FontRanges.cpp
r178388 r178940 27 27 #include "FontRanges.h" 28 28 29 #include " SimpleFontData.h"29 #include "Font.h" 30 30 #include <wtf/Assertions.h> 31 31 #include <wtf/text/WTFString.h> … … 37 37 } 38 38 39 FontRanges::FontRanges(RefPtr< SimpleFontData>&& fontData)39 FontRanges::FontRanges(RefPtr<Font>&& font) 40 40 { 41 if (font Data)42 m_ranges.append(Range { 0, 0x7FFFFFFF, font Data.releaseNonNull() });41 if (font) 42 m_ranges.append(Range { 0, 0x7FFFFFFF, font.releaseNonNull() }); 43 43 } 44 44 … … 47 47 } 48 48 49 const SimpleFontData* FontRanges::fontDataForCharacter(UChar32 c) const49 const Font* FontRanges::fontForCharacter(UChar32 c) const 50 50 { 51 51 for (auto& range : m_ranges) { 52 52 if (range.from() <= c && c <= range.to()) 53 return &range.font Data();53 return &range.font(); 54 54 } 55 55 return nullptr; 56 56 } 57 57 58 const SimpleFontData& FontRanges::fontDataForFirstRange() const58 const Font& FontRanges::fontForFirstRange() const 59 59 { 60 return m_ranges[0].font Data();60 return m_ranges[0].font(); 61 61 } 62 62 … … 64 64 { 65 65 for (auto& range : m_ranges) { 66 if (range.font Data().isLoading())66 if (range.font().isLoading()) 67 67 return true; 68 68 } -
trunk/Source/WebCore/platform/graphics/FontRanges.h
r178388 r178940 27 27 #define FontRanges_h 28 28 29 #include " SimpleFontData.h"29 #include "Font.h" 30 30 #include <wtf/TypeCasts.h> 31 31 #include <wtf/Vector.h> … … 36 36 public: 37 37 struct Range { 38 Range(UChar32 from, UChar32 to, Ref< SimpleFontData>&& fontData)38 Range(UChar32 from, UChar32 to, Ref<Font>&& font) 39 39 : m_from(from) 40 40 , m_to(to) 41 , m_font Data(WTF::move(fontData))41 , m_font(WTF::move(font)) 42 42 { 43 43 } … … 45 45 UChar32 from() const { return m_from; } 46 46 UChar32 to() const { return m_to; } 47 const SimpleFontData& fontData() const { return *m_fontData; }47 const Font& font() const { return *m_font; } 48 48 49 49 private: 50 50 UChar32 m_from; 51 51 UChar32 m_to; 52 RefPtr< SimpleFontData> m_fontData;52 RefPtr<Font> m_font; 53 53 }; 54 54 55 55 FontRanges(); 56 explicit FontRanges(RefPtr< SimpleFontData>&&);56 explicit FontRanges(RefPtr<Font>&&); 57 57 ~FontRanges(); 58 58 … … 63 63 const Range& rangeAt(unsigned i) const { return m_ranges[i]; } 64 64 65 const SimpleFontData* fontDataForCharacter(UChar32) const;66 const SimpleFontData& fontDataForFirstRange() const;65 const Font* fontForCharacter(UChar32) const; 66 const Font& fontForFirstRange() const; 67 67 bool isLoading() const; 68 68 -
trunk/Source/WebCore/platform/graphics/FontSelector.h
r178388 r178940 42 42 43 43 virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) = 0; 44 virtual PassRefPtr< SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) = 0;44 virtual PassRefPtr<Font> fallbackFontAt(const FontDescription&, size_t) = 0; 45 45 46 virtual size_t fallbackFont DataCount() = 0;46 virtual size_t fallbackFontCount() = 0; 47 47 virtual bool resolvesFamilyFor(const FontDescription&) const = 0; 48 48 -
trunk/Source/WebCore/platform/graphics/GlyphBuffer.h
r174269 r178940 46 46 namespace WebCore { 47 47 48 class SimpleFontData;48 class Font; 49 49 50 50 #if USE(CAIRO) … … 77 77 class GlyphBuffer { 78 78 public: 79 bool isEmpty() const { return m_font Data.isEmpty(); }80 int size() const { return m_font Data.size(); }79 bool isEmpty() const { return m_font.isEmpty(); } 80 int size() const { return m_font.size(); } 81 81 82 82 void clear() 83 83 { 84 m_font Data.clear();84 m_font.clear(); 85 85 m_glyphs.clear(); 86 86 m_advances.clear(); … … 97 97 const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; } 98 98 99 const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }99 const Font* fontAt(int index) const { return m_font[index]; } 100 100 101 101 void setInitialAdvance(GlyphBufferAdvance initialAdvance) { m_initialAdvance = initialAdvance; } … … 127 127 128 128 static const unsigned noOffset = UINT_MAX; 129 void add(Glyph glyph, const SimpleFontData* font, float width, unsigned offsetInString = noOffset, const FloatSize* offset = 0)130 { 131 m_font Data.append(font);129 void add(Glyph glyph, const Font* font, float width, unsigned offsetInString = noOffset, const FloatSize* offset = 0) 130 { 131 m_font.append(font); 132 132 133 133 #if USE(CAIRO) … … 160 160 161 161 #if !USE(WINGDI) 162 void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset)163 { 164 m_font Data.append(font);162 void add(Glyph glyph, const Font* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset) 163 { 164 m_font.append(font); 165 165 #if USE(CAIRO) 166 166 cairo_glyph_t cairoGlyph; … … 206 206 void swap(int index1, int index2) 207 207 { 208 const SimpleFontData* f = m_fontData[index1];209 m_font Data[index1] = m_fontData[index2];210 m_font Data[index2] = f;208 const Font* f = m_font[index1]; 209 m_font[index1] = m_font[index2]; 210 m_font[index2] = f; 211 211 212 212 GlyphBufferGlyph g = m_glyphs[index1]; … … 225 225 } 226 226 227 Vector<const SimpleFontData*, 2048> m_fontData;227 Vector<const Font*, 2048> m_font; 228 228 Vector<GlyphBufferGlyph, 2048> m_glyphs; 229 229 Vector<GlyphBufferAdvance, 2048> m_advances; -
trunk/Source/WebCore/platform/graphics/GlyphPage.h
r177876 r178940 40 40 namespace WebCore { 41 41 42 class SimpleFontData;42 class Font; 43 43 44 // Holds the glyph index and the corresponding SimpleFontDatainformation for a given44 // Holds the glyph index and the corresponding Font information for a given 45 45 // character. 46 46 struct GlyphData { 47 GlyphData(Glyph g = 0, const SimpleFontData* f = 0)47 GlyphData(Glyph g = 0, const Font* f = 0) 48 48 : glyph(g) 49 , font Data(f)49 , font(f) 50 50 { 51 51 } 52 52 Glyph glyph; 53 const SimpleFontData* fontData;53 const Font* font; 54 54 }; 55 55 … … 67 67 class GlyphPage : public RefCounted<GlyphPage> { 68 68 public: 69 static PassRefPtr<GlyphPage> createForMixedFont Data()69 static PassRefPtr<GlyphPage> createForMixedFonts() 70 70 { 71 void* slot = fastMalloc(sizeof(GlyphPage) + sizeof( SimpleFontData*) * GlyphPage::size);71 void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(Font*) * GlyphPage::size); 72 72 return adoptRef(new (NotNull, slot) GlyphPage(nullptr)); 73 73 } 74 74 75 static PassRefPtr<GlyphPage> createCopyForMixedFont Data(const GlyphPage& original)75 static PassRefPtr<GlyphPage> createCopyForMixedFonts(const GlyphPage& original) 76 76 { 77 RefPtr<GlyphPage> page = createForMixedFont Data();77 RefPtr<GlyphPage> page = createForMixedFonts(); 78 78 for (unsigned i = 0; i < GlyphPage::size; ++i) 79 79 page->setGlyphDataForIndex(i, original.glyphDataForIndex(i)); … … 81 81 } 82 82 83 static PassRefPtr<GlyphPage> createForSingleFont Data(const SimpleFontData* fontData)83 static PassRefPtr<GlyphPage> createForSingleFont(const Font* font) 84 84 { 85 ASSERT(font Data);86 return adoptRef(new GlyphPage(font Data));85 ASSERT(font); 86 return adoptRef(new GlyphPage(font)); 87 87 } 88 88 … … 112 112 if (hasPerGlyphFontData()) 113 113 return GlyphData(glyph, m_perGlyphFontData[index]); 114 return GlyphData(glyph, glyph ? m_font DataForAllGlyphs : 0);114 return GlyphData(glyph, glyph ? m_fontForAllGlyphs : 0); 115 115 } 116 116 … … 121 121 } 122 122 123 ALWAYS_INLINE const SimpleFontData* fontDataForCharacter(UChar32 c) const123 ALWAYS_INLINE const Font* fontForCharacter(UChar32 c) const 124 124 { 125 125 unsigned index = indexForCharacter(c); 126 126 if (hasPerGlyphFontData()) 127 127 return m_perGlyphFontData[index]; 128 return m_glyphs[index] ? m_font DataForAllGlyphs : 0;128 return m_glyphs[index] ? m_fontForAllGlyphs : 0; 129 129 } 130 130 131 void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)131 void setGlyphDataForCharacter(UChar32 c, Glyph g, const Font* f) 132 132 { 133 133 setGlyphDataForIndex(indexForCharacter(c), g, f); 134 134 } 135 135 136 void setGlyphDataForIndex(unsigned index, Glyph glyph, const SimpleFontData* fontData)136 void setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font) 137 137 { 138 138 ASSERT_WITH_SECURITY_IMPLICATION(index < size); … … 141 141 m_glyphs[index] = glyph; 142 142 143 // GlyphPage getters will always return a null SimpleFontData* for glyph #0 if there's no per-glyph font array.143 // GlyphPage getters will always return a null Font* for glyph #0 if there's no per-glyph font array. 144 144 if (hasPerGlyphFontData()) { 145 m_perGlyphFontData[index] = glyph ? font Data: 0;145 m_perGlyphFontData[index] = glyph ? font : 0; 146 146 return; 147 147 } 148 148 149 // A single-font GlyphPage already assigned m_font DataForAllGlyphs in the constructor.150 ASSERT(!glyph || font Data == m_fontDataForAllGlyphs);149 // A single-font GlyphPage already assigned m_fontForAllGlyphs in the constructor. 150 ASSERT(!glyph || font == m_fontForAllGlyphs); 151 151 } 152 152 153 153 void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData) 154 154 { 155 setGlyphDataForIndex(index, glyphData.glyph, glyphData.font Data);155 setGlyphDataForIndex(index, glyphData.glyph, glyphData.font); 156 156 } 157 157 158 158 // Implemented by the platform. 159 bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);159 bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const Font*); 160 160 #if PLATFORM(COCOA) 161 static bool mayUseMixedFont DataWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);161 static bool mayUseMixedFontsWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const Font*); 162 162 #else 163 static bool mayUseMixedFont DataWhenFilling(const UChar*, unsigned, const SimpleFontData*) { return false; }163 static bool mayUseMixedFontsWhenFilling(const UChar*, unsigned, const Font*) { return false; } 164 164 #endif 165 165 166 166 private: 167 explicit GlyphPage(const SimpleFontData* fontDataForAllGlyphs)168 : m_font DataForAllGlyphs(fontDataForAllGlyphs)167 explicit GlyphPage(const Font* fontForAllGlyphs) 168 : m_fontForAllGlyphs(fontForAllGlyphs) 169 169 { 170 170 memset(m_glyphs, 0, sizeof(m_glyphs)); 171 171 if (hasPerGlyphFontData()) 172 memset(m_perGlyphFontData, 0, sizeof( SimpleFontData*) * GlyphPage::size);172 memset(m_perGlyphFontData, 0, sizeof(Font*) * GlyphPage::size); 173 173 ++s_count; 174 174 } 175 175 176 bool hasPerGlyphFontData() const { return !m_font DataForAllGlyphs; }176 bool hasPerGlyphFontData() const { return !m_fontForAllGlyphs; } 177 177 178 const SimpleFontData* m_fontDataForAllGlyphs;178 const Font* m_fontForAllGlyphs; 179 179 Glyph m_glyphs[size]; 180 180 181 181 bool m_isImmutable { false }; 182 // NOTE: This array has (GlyphPage::size) elements if m_font DataForAllGlyphs is null.183 const SimpleFontData* m_perGlyphFontData[0];182 // NOTE: This array has (GlyphPage::size) elements if m_fontForAllGlyphs is null. 183 const Font* m_perGlyphFontData[0]; 184 184 185 185 static unsigned s_count; -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r178510 r178940 449 449 #endif // !PLATFORM(IOS) 450 450 451 void GraphicsContext::drawGlyphs(const FontCascade& font , const SimpleFontData& fontData, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point)452 { 453 if (paintingDisabled()) 454 return; 455 456 font .drawGlyphs(this, &fontData, buffer, from, numGlyphs, point);451 void GraphicsContext::drawGlyphs(const FontCascade& fontCascade, const Font& font, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point) 452 { 453 if (paintingDisabled()) 454 return; 455 456 fontCascade.drawGlyphs(this, &font, buffer, from, numGlyphs, point); 457 457 } 458 458 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r178510 r178940 65 65 #if USE(WINGDI) 66 66 class SharedBitmap; 67 class SimpleFontData;67 class Font; 68 68 class GlyphBuffer; 69 69 #endif … … 361 361 float drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1); 362 362 #endif 363 void drawGlyphs(const FontCascade&, const SimpleFontData&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);363 void drawGlyphs(const FontCascade&, const Font&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&); 364 364 void drawEmphasisMarks(const FontCascade&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1); 365 365 #if !PLATFORM(IOS) … … 480 480 void resetAffineTransform(); 481 481 void fillRect(const FloatRect&, const Gradient*); 482 void drawText(const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point);482 void drawText(const Font*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&); 483 483 void drawFrameControl(const IntRect& rect, unsigned type, unsigned state); 484 484 void drawFocusRect(const IntRect& rect); -
trunk/Source/WebCore/platform/graphics/TextRun.h
r178510 r178940 37 37 class GlyphBuffer; 38 38 class GlyphToPathTranslator; 39 class SimpleFontData;39 class Font; 40 40 41 41 struct GlyphData; … … 199 199 #if ENABLE(SVG_FONTS) 200 200 virtual GlyphData glyphDataForCharacter(const FontCascade&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) = 0; 201 virtual void drawSVGGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0;201 virtual void drawSVGGlyphs(GraphicsContext*, const Font*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0; 202 202 virtual float floatWidthUsingSVGFont(const FontCascade&, const TextRun&, int& charsConsumed, String& glyphName) const = 0; 203 virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const = 0;204 virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const SimpleFontData&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const = 0;203 virtual bool applySVGKerning(const Font*, WidthIterator&, GlyphBuffer*, int from) const = 0; 204 virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const Font&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const = 0; 205 205 #endif 206 206 }; -
trunk/Source/WebCore/platform/graphics/WidthIterator.cpp
r178510 r178940 23 23 #include "WidthIterator.h" 24 24 25 #include "Font.h" 25 26 #include "FontCascade.h" 26 27 #include "GlyphBuffer.h" 27 28 #include "Latin1TextIterator.h" 28 #include "SimpleFontData.h"29 29 #include "SurrogatePairAwareTextIterator.h" 30 30 #include <wtf/MathExtras.h> … … 35 35 namespace WebCore { 36 36 37 WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)37 WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis) 38 38 : m_font(font) 39 39 , m_run(run) … … 101 101 typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace; 102 102 103 static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)103 static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace) 104 104 { 105 105 ASSERT(typesettingFeatures & (Kerning | Ligatures)); … … 124 124 #else 125 125 // We need to handle transforms on SVG fonts internally, since they are rendered internally. 126 if (font Data->isSVGFont()) {126 if (font->isSVGFont()) { 127 127 // SVG font ligatures are handled during glyph selection, only kerning remaining. 128 128 if (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) { 129 129 // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point. 130 130 // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely. 131 iterator.run().renderingContext()->applySVGKerning(font Data, iterator, glyphBuffer, lastGlyphCount);131 iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount); 132 132 } 133 133 } else 134 134 #endif 135 font Data->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);135 font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures); 136 136 137 137 if (!ltr) … … 167 167 FloatRect bounds; 168 168 169 const SimpleFontData& primaryFontData = m_font->primaryFontData();170 const SimpleFontData* lastFontData = &primaryFontData;169 const Font& primaryFont = m_font->primaryFont(); 170 const Font* lastFontData = &primaryFont; 171 171 int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0; 172 172 … … 184 184 continue; 185 185 } 186 const SimpleFontData* fontData = glyphData.fontData;187 ASSERT(font Data);186 const Font* font = glyphData.font; 187 ASSERT(font); 188 188 189 189 // Now that we have a glyph and font data, get its width. 190 190 float width; 191 191 if (character == '\t' && m_run.allowTabs()) 192 width = m_font->tabWidth(*font Data, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);192 width = m_font->tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding); 193 193 else { 194 width = font Data->widthForGlyph(glyph);194 width = font->widthForGlyph(glyph); 195 195 196 196 // SVG uses horizontalGlyphStretch(), when textLength is used to stretch/squeeze text. … … 201 201 // Second, in fixed-pitch fonts we ensure that all characters that 202 202 // match the width of the space character have the same width as the space character. 203 if (m_run.applyWordRounding() && width == font Data->spaceWidth() && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph()))204 width = font Data->adjustedSpaceWidth();205 } 206 207 if (font Data!= lastFontData && width) {203 if (m_run.applyWordRounding() && width == font->spaceWidth() && (font->pitch() == FixedPitch || glyph == font->spaceGlyph())) 204 width = font->adjustedSpaceWidth(); 205 } 206 207 if (font != lastFontData && width) { 208 208 if (shouldApplyFontTransforms()) { 209 209 m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, charactersTreatedAsSpace); … … 211 211 } 212 212 213 lastFontData = font Data;214 if (m_fallbackFonts && font Data != &primaryFontData) {213 lastFontData = font; 214 if (m_fallbackFonts && font != &primaryFont) { 215 215 // FIXME: This does a little extra work that could be avoided if 216 216 // glyphDataForCharacter() returned whether it chose to use a small caps font. 217 217 if (!m_font->isSmallCaps() || character == u_toupper(character)) 218 m_fallbackFonts->add(font Data);218 m_fallbackFonts->add(font); 219 219 else { 220 220 const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(u_toupper(character), rtl); 221 if (uppercaseGlyphData.font Data != &primaryFontData)222 m_fallbackFonts->add(uppercaseGlyphData.font Data);221 if (uppercaseGlyphData.font != &primaryFont) 222 m_fallbackFonts->add(uppercaseGlyphData.font); 223 223 } 224 224 } … … 244 244 if (glyphBuffer->isEmpty()) { 245 245 if (m_forTextEmphasis) 246 glyphBuffer->add(font Data->zeroWidthSpaceGlyph(), fontData, m_expansionPerOpportunity, currentCharacter);246 glyphBuffer->add(font->zeroWidthSpaceGlyph(), font, m_expansionPerOpportunity, currentCharacter); 247 247 else 248 glyphBuffer->add(font Data->spaceGlyph(), fontData, expansionAtThisOpportunity, currentCharacter);248 glyphBuffer->add(font->spaceGlyph(), font, expansionAtThisOpportunity, currentCharacter); 249 249 } else 250 250 glyphBuffer->expandLastAdvance(expansionAtThisOpportunity); … … 275 275 276 276 if (m_accountForGlyphBounds) { 277 bounds = font Data->boundsForGlyph(glyph);277 bounds = font->boundsForGlyph(glyph); 278 278 if (!currentCharacter) 279 279 m_firstGlyphOverflow = std::max<float>(0, -bounds.x()); … … 315 315 316 316 if (glyphBuffer) 317 glyphBuffer->add(glyph, font Data, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter);317 glyphBuffer->add(glyph, font, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter); 318 318 319 319 lastRoundingWidth = width - oldWidth; -
trunk/Source/WebCore/platform/graphics/WidthIterator.h
r178510 r178940 33 33 class FontCascade; 34 34 class GlyphBuffer; 35 class SimpleFontData;35 class Font; 36 36 class TextRun; 37 37 struct GlyphData; … … 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 WidthIterator(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);42 WidthIterator(const FontCascade*, const TextRun&, HashSet<const Font*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false); 43 43 44 44 unsigned advance(int to, GlyphBuffer*); … … 95 95 96 96 TypesettingFeatures m_typesettingFeatures; 97 HashSet<const SimpleFontData*>* m_fallbackFonts;97 HashSet<const Font*>* m_fallbackFonts; 98 98 bool m_accountForGlyphBounds; 99 99 float m_maxGlyphBoundingBoxY; -
trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp
r178510 r178940 34 34 #include "AffineTransform.h" 35 35 #include "CairoUtilities.h" 36 #include "Font.h" 36 37 #include "GlyphBuffer.h" 37 38 #include "Gradient.h" … … 42 43 #include "PlatformPathCairo.h" 43 44 #include "ShadowBlur.h" 44 #include "SimpleFontData.h"45 45 46 46 namespace WebCore { 47 47 48 static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)48 static void drawGlyphsToContext(cairo_t* context, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs) 49 49 { 50 50 cairo_matrix_t originalTransform; … … 65 65 } 66 66 67 static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)67 static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs) 68 68 { 69 69 ShadowBlur& shadow = graphicsContext->platformContext()->shadowBlur(); … … 96 96 } 97 97 98 void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,98 void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, 99 99 int from, int numGlyphs, const FloatPoint& point) const 100 100 { … … 217 217 , m_textRun(textRun) 218 218 , m_glyphBuffer(glyphBuffer) 219 , m_fontData(glyphBuffer.font DataAt(m_index))219 , m_fontData(glyphBuffer.fontAt(m_index)) 220 220 , m_translation(AffineTransform().translate(textOrigin.x(), textOrigin.y())) 221 221 { … … 236 236 const TextRun& m_textRun; 237 237 const GlyphBuffer& m_glyphBuffer; 238 const SimpleFontData* m_fontData;238 const Font* m_fontData; 239 239 AffineTransform m_translation; 240 240 }; … … 287 287 if (m_index >= m_glyphBuffer.size()) 288 288 break; 289 m_fontData = m_glyphBuffer.font DataAt(m_index);289 m_fontData = m_glyphBuffer.fontAt(m_index); 290 290 } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size()); 291 291 } … … 308 308 309 309 // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778 310 const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);310 const Font* fontData = glyphBuffer.fontAt(0); 311 311 std::unique_ptr<GlyphToPathTranslator> translator; 312 312 bool isSVG = false; … … 327 327 float centerOfLine = lineExtents.y() + (lineExtents.height() / 2); 328 328 GlyphIterationState info = GlyphIterationState(FloatPoint(), FloatPoint(), centerOfLine, lineExtents.x() + lineExtents.width(), lineExtents.x()); 329 const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);329 const Font* localFontData = glyphBuffer.fontAt(index); 330 330 if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) { 331 331 // The advances will get all messed up if we do anything other than bail here. -
trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
r178510 r178940 28 28 #include "FontCascade.h" 29 29 30 #include "Font.h" 30 31 #include "GraphicsContext.h" 31 32 #include "HarfBuzzShaper.h" … … 34 35 #include "NotImplemented.h" 35 36 #include "PlatformContextCairo.h" 36 #include "SimpleFontData.h"37 37 #include <cairo.h> 38 38 … … 84 84 } 85 85 86 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const86 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>*, GlyphOverflow*) const 87 87 { 88 88 HarfBuzzShaper shaper(this, run); -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r174931 r178940 42 42 #include "FloatRect.h" 43 43 #include "FloatRoundedRect.h" 44 #include "Font.h" 44 45 #include "GraphicsContextPlatformPrivateCairo.h" 45 46 #include "IntRect.h" … … 52 53 #include "RefPtrCairo.h" 53 54 #include "ShadowBlur.h" 54 #include "SimpleFontData.h"55 55 #include "TransformationMatrix.h" 56 56 #include <cairo.h> -
trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
r178578 r178940 28 28 #import "CoreTextSPI.h" 29 29 #import "DashArray.h" 30 #import "Font.h" 30 31 #import "GlyphBuffer.h" 31 32 #import "GraphicsContext.h" 32 33 #import "LayoutRect.h" 33 34 #import "Logging.h" 34 #import "SimpleFontData.h"35 35 #import "WebCoreSystemInterface.h" 36 36 #if USE(APPKIT) … … 92 92 } 93 93 94 static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)94 static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count) 95 95 { 96 96 #if ENABLE(LETTERPRESS) … … 132 132 } 133 133 134 static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)134 static void showGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count) 135 135 { 136 136 if (!count) … … 198 198 #endif 199 199 200 void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const200 void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const 201 201 { 202 202 const FontPlatformData& platformData = font->platformData(); … … 469 469 , m_textRun(textRun) 470 470 , m_glyphBuffer(glyphBuffer) 471 , m_fontData(glyphBuffer.font DataAt(m_index))471 , m_fontData(glyphBuffer.fontAt(m_index)) 472 472 , m_translation(CGAffineTransformScale(CGAffineTransformMakeTranslation(textOrigin.x(), textOrigin.y()), 1, -1)) 473 473 { … … 488 488 const TextRun& m_textRun; 489 489 const GlyphBuffer& m_glyphBuffer; 490 const SimpleFontData* m_fontData;490 const Font* m_fontData; 491 491 CGAffineTransform m_translation; 492 492 }; … … 525 525 if (m_index >= m_glyphBuffer.size()) 526 526 break; 527 m_fontData = m_glyphBuffer.font DataAt(m_index);527 m_fontData = m_glyphBuffer.fontAt(m_index); 528 528 } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size()); 529 529 } … … 546 546 547 547 // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778 548 const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);548 const Font* fontData = glyphBuffer.fontAt(0); 549 549 std::unique_ptr<GlyphToPathTranslator> translator; 550 550 bool isSVG = false; … … 562 562 for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) { 563 563 GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x()); 564 const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);565 if (!localFont Data || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData!= fontData)) {564 const Font* localFont = glyphBuffer.fontAt(index); 565 if (!localFont || (!isSVG && localFont->isSVGFont()) || (isSVG && localFont != fontData)) { 566 566 // The advances will get all messed up if we do anything other than bail here. 567 567 result.clear(); … … 593 593 #endif 594 594 595 bool FontCascade::primaryFont DataIsSystemFont() const595 bool FontCascade::primaryFontIsSystemFont() const 596 596 { 597 597 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090 598 const auto& fontData = primaryFont Data();598 const auto& fontData = primaryFont(); 599 599 return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get()); 600 600 #else … … 672 672 } 673 673 674 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const674 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 675 675 { 676 676 ComplexTextController controller(this, run, true, fallbackFonts); … … 690 690 } 691 691 692 const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const692 const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length, FontVariant variant) const 693 693 { 694 694 UChar32 baseCharacter; … … 702 702 703 703 if (length == baseCharacterLength) 704 return baseCharacterGlyphData.font Data;705 706 bool triedBaseCharacterFont Data= false;704 return baseCharacterGlyphData.font; 705 706 bool triedBaseCharacterFont = false; 707 707 708 708 for (unsigned i = 0; !fallbackRangesAt(i).isNull(); ++i) { 709 const SimpleFontData* simpleFontData = fallbackRangesAt(i).fontDataForCharacter(baseCharacter);710 if (! simpleFontData)709 const Font* font = fallbackRangesAt(i).fontForCharacter(baseCharacter); 710 if (!font) 711 711 continue; 712 712 #if PLATFORM(IOS) 713 if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && simpleFontData->shouldNotBeUsedForArabic())713 if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && font->shouldNotBeUsedForArabic()) 714 714 continue; 715 715 #endif 716 716 if (variant == NormalVariant) { 717 if ( simpleFontData->platformData().orientation() == Vertical) {718 if (isCJKIdeographOrSymbol(baseCharacter) && ! simpleFontData->hasVerticalGlyphs()) {717 if (font->platformData().orientation() == Vertical) { 718 if (isCJKIdeographOrSymbol(baseCharacter) && !font->hasVerticalGlyphs()) { 719 719 variant = BrokenIdeographVariant; 720 simpleFontData = simpleFontData->brokenIdeographFontData().get();720 font = font->brokenIdeographFont().get(); 721 721 } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) { 722 SimpleFontData* verticalRightFontData = simpleFontData->verticalRightOrientationFontData().get();723 Glyph verticalRightGlyph = verticalRightFont Data->glyphForCharacter(baseCharacter);722 Font* verticalRightFont = font->verticalRightOrientationFont().get(); 723 Glyph verticalRightGlyph = verticalRightFont->glyphForCharacter(baseCharacter); 724 724 if (verticalRightGlyph == baseCharacterGlyphData.glyph) 725 simpleFontData = verticalRightFontData;725 font = verticalRightFont; 726 726 } else { 727 SimpleFontData* uprightFontData = simpleFontData->uprightOrientationFontData().get();728 Glyph uprightGlyph = uprightFont Data->glyphForCharacter(baseCharacter);727 Font* uprightFont = font->uprightOrientationFont().get(); 728 Glyph uprightGlyph = uprightFont->glyphForCharacter(baseCharacter); 729 729 if (uprightGlyph != baseCharacterGlyphData.glyph) 730 simpleFontData = uprightFontData;730 font = uprightFont; 731 731 } 732 732 } 733 733 } else { 734 if (const SimpleFontData* variantFontData = simpleFontData->variantFontData(m_fontDescription, variant).get())735 simpleFontData = variantFontData;736 } 737 738 if ( simpleFontData == baseCharacterGlyphData.fontData)739 triedBaseCharacterFont Data= true;740 741 if ( simpleFontData->canRenderCombiningCharacterSequence(characters, length))742 return simpleFontData;743 } 744 745 if (!triedBaseCharacterFont Data && baseCharacterGlyphData.fontData && baseCharacterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, length))746 return baseCharacterGlyphData.font Data;747 748 return SimpleFontData::systemFallback();749 } 750 751 } 734 if (const Font* variantFont = font->variantFont(m_fontDescription, variant).get()) 735 font = variantFont; 736 } 737 738 if (font == baseCharacterGlyphData.font) 739 triedBaseCharacterFont = true; 740 741 if (font->canRenderCombiningCharacterSequence(characters, length)) 742 return font; 743 } 744 745 if (!triedBaseCharacterFont && baseCharacterGlyphData.font && baseCharacterGlyphData.font->canRenderCombiningCharacterSequence(characters, length)) 746 return baseCharacterGlyphData.font; 747 748 return Font::systemFallback(); 749 } 750 751 } -
trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
r178510 r178940 23 23 #include "FontCache.h" 24 24 25 #include "Font.h" 25 26 #include "OwnPtrCairo.h" 26 27 #include "RefPtrCairo.h" 27 #include "SimpleFontData.h"28 28 #include "UTF16UChar32Iterator.h" 29 29 #include <cairo-ft.h> … … 81 81 } 82 82 83 RefPtr< SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)83 RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length) 84 84 { 85 85 RefPtr<FcPattern> pattern = adoptRef(createFontConfigPatternForCharacters(characters, length)); … … 100 100 } 101 101 102 Ref< SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)102 Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 103 103 { 104 104 // We want to return a fallback font here, otherwise the logic preventing FontConfig -
trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
r177876 r178940 32 32 #include "GlyphPage.h" 33 33 34 #include " SimpleFontData.h"34 #include "Font.h" 35 35 #include "UTF16UChar32Iterator.h" 36 36 #include <cairo-ft.h> … … 40 40 namespace WebCore { 41 41 42 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)42 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData) 43 43 { 44 44 cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont(); -
trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
r178510 r178940 32 32 33 33 #include "config.h" 34 #include " SimpleFontData.h"34 #include "Font.h" 35 35 36 36 #include "FloatConversion.h" … … 52 52 namespace WebCore { 53 53 54 void SimpleFontData::platformInit()54 void Font::platformInit() 55 55 { 56 56 if (!m_platformData.m_size) … … 94 94 } 95 95 96 void SimpleFontData::platformCharWidthInit()96 void Font::platformCharWidthInit() 97 97 { 98 98 m_avgCharWidth = 0.f; … … 101 101 } 102 102 103 PassRefPtr< SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const103 PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const 104 104 { 105 105 ASSERT(m_platformData.scaledFont()); 106 return SimpleFontData::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()),106 return Font::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()), 107 107 scaleFactor * fontDescription.computedSize(), 108 108 m_platformData.syntheticBold(), … … 112 112 } 113 113 114 void SimpleFontData::determinePitch()114 void Font::determinePitch() 115 115 { 116 116 m_treatAsFixedPitch = m_platformData.isFixedPitch(); 117 117 } 118 118 119 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const119 FloatRect Font::platformBoundsForGlyph(Glyph glyph) const 120 120 { 121 121 if (!m_platformData.size()) … … 132 132 } 133 133 134 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const134 float Font::platformWidthForGlyph(Glyph glyph) const 135 135 { 136 136 if (!m_platformData.size()) … … 148 148 149 149 #if USE(HARFBUZZ) 150 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const150 bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const 151 151 { 152 152 if (!m_combiningCharacterSequenceSupport) -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
r176945 r178940 33 33 #include "HarfBuzzFace.h" 34 34 35 #include "Font.h" 35 36 #include "FontPlatformData.h" 36 37 #include "GlyphBuffer.h" 37 38 #include "HarfBuzzShaper.h" 38 #include "SimpleFontData.h"39 39 #include "TextEncoding.h" 40 40 #include <cairo-ft.h> -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp
r178166 r178940 32 32 #include "HarfBuzzFace.h" 33 33 34 #include "Font.h" 34 35 #include "FontPlatformData.h" 35 36 #include "HarfBuzzShaper.h" 36 #include "SimpleFontData.h"37 37 #include <ApplicationServices/ApplicationServices.h> 38 38 #include <hb.h> -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
r178510 r178940 73 73 } 74 74 75 HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)75 HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const Font* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script) 76 76 : m_fontData(fontData) 77 77 , m_startIndex(startIndex) … … 402 402 return false; 403 403 404 const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData;404 const Font* nextFontData = m_font->glyphDataForCharacter(character, false).font; 405 405 UErrorCode errorCode = U_ZERO_ERROR; 406 406 UScriptCode nextScript = uscript_getScript(character, &errorCode); … … 410 410 do { 411 411 const UChar* currentCharacterPosition = iterator.characters(); 412 const SimpleFontData* currentFontData = nextFontData;412 const Font* currentFontData = nextFontData; 413 413 if (!currentFontData) 414 currentFontData = &m_font->primaryFont Data();414 currentFontData = &m_font->primaryFont(); 415 415 UScriptCode currentScript = nextScript; 416 416 … … 436 436 continue; 437 437 } 438 nextFontData = m_font->glyphDataForCharacter(character, false).font Data;438 nextFontData = m_font->glyphDataForCharacter(character, false).font; 439 439 } else 440 nextFontData = m_font->glyphDataForCharacter(character, false).font Data;440 nextFontData = m_font->glyphDataForCharacter(character, false).font; 441 441 442 442 nextScript = uscript_getScript(character, &errorCode); … … 468 468 unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; 469 469 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); 470 const SimpleFontData* currentFontData = currentRun->fontData();470 const Font* currentFontData = currentRun->fontData(); 471 471 if (currentFontData->isSVGFont()) 472 472 return false; … … 486 486 if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) { 487 487 String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()).upper(); 488 currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).font Data;488 currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).font; 489 489 const UChar* characters = StringView(upperText).upconvertedCharacters(); 490 490 hb_buffer_add_utf16(harfBuzzBuffer.get(), reinterpret_cast<const uint16_t*>(characters), currentRun->numCharacters(), 0, currentRun->numCharacters()); … … 515 515 void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb_buffer_t* harfBuzzBuffer) 516 516 { 517 const SimpleFontData* currentFontData = currentRun->fontData();517 const Font* currentFontData = currentRun->fontData(); 518 518 hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfBuzzBuffer, 0); 519 519 hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfBuzzBuffer, 0); -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h
r178510 r178940 45 45 namespace WebCore { 46 46 47 class Font; 47 48 class FontCascade; 48 class SimpleFontData;49 49 50 50 class HarfBuzzShaper { … … 67 67 class HarfBuzzRun { 68 68 public: 69 HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t);69 HarfBuzzRun(const Font*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t); 70 70 71 71 void applyShapeResult(hb_buffer_t*); … … 76 76 float xPositionForOffset(unsigned offset); 77 77 78 const SimpleFontData* fontData() { return m_fontData; }78 const Font* fontData() { return m_fontData; } 79 79 unsigned startIndex() const { return m_startIndex; } 80 80 unsigned numCharacters() const { return m_numCharacters; } … … 89 89 90 90 private: 91 const SimpleFontData* m_fontData;91 const Font* m_fontData; 92 92 unsigned m_startIndex; 93 93 size_t m_numCharacters; -
trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
r178510 r178940 74 74 } 75 75 76 PassRefPtr< SimpleFontData> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, const UChar* characters, int length)76 PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const Font* originalFontData, const UChar* characters, int length) 77 77 { 78 78 const FontPlatformData& platformData = originalFontData->platformData(); … … 195 195 } 196 196 197 RefPtr< SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)197 RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length) 198 198 { 199 199 // Unlike OS X, our fallback font on iPhone is Arial Unicode, which doesn't have some apple-specific glyphs like F8FF. … … 221 221 languageSpecificFont = languageSpecificFallbackFont(c); 222 222 223 RefPtr< SimpleFontData> simpleFontData;223 RefPtr<Font> font; 224 224 225 225 switch (languageSpecificFont) { … … 299 299 } 300 300 301 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false);301 font = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false); 302 302 bool useSecondaryFont = true; 303 if ( simpleFontData) {303 if (font) { 304 304 CGGlyph glyphs[2]; 305 305 // CGFontGetGlyphsForUnichars takes UTF-16 buffer. Should only be 1 codepoint but since we may pass in two UTF-16 characters, 306 306 // make room for 2 glyphs just to be safe. 307 CGFontGetGlyphsForUnichars( simpleFontData->platformData().cgFont(), characters, glyphs, length);307 CGFontGetGlyphsForUnichars(font->platformData().cgFont(), characters, glyphs, length); 308 308 309 309 useSecondaryFont = (glyphs[0] == 0); … … 311 311 312 312 if (useSecondaryFont) 313 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[secondaryCJKFont] : *cjkPlain[secondaryCJKFont], false);313 font = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[secondaryCJKFont] : *cjkPlain[secondaryCJKFont], false); 314 314 break; 315 315 } … … 317 317 static NeverDestroyed<AtomicString> koreanPlain("AppleSDGothicNeo-Medium", AtomicString::ConstructFromLiteral); 318 318 static NeverDestroyed<AtomicString> koreanBold("AppleSDGothicNeo-Bold", AtomicString::ConstructFromLiteral); 319 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? koreanBold : koreanPlain, false);319 font = fontForFamily(description, isFontWeightBold(description.weight()) ? koreanBold : koreanPlain, false); 320 320 break; 321 321 } … … 323 323 static NeverDestroyed<AtomicString> cyrillicPlain("HelveticaNeue", AtomicString::ConstructFromLiteral); 324 324 static NeverDestroyed<AtomicString> cyrillicBold("HelveticaNeue-Bold", AtomicString::ConstructFromLiteral); 325 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? cyrillicBold : cyrillicPlain, false);325 font = fontForFamily(description, isFontWeightBold(description.weight()) ? cyrillicBold : cyrillicPlain, false); 326 326 break; 327 327 } … … 329 329 static NeverDestroyed<AtomicString> arabicPlain("GeezaPro", AtomicString::ConstructFromLiteral); 330 330 static NeverDestroyed<AtomicString> arabicBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral); 331 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? arabicBold : arabicPlain, false);331 font = fontForFamily(description, isFontWeightBold(description.weight()) ? arabicBold : arabicPlain, false); 332 332 break; 333 333 } … … 335 335 static NeverDestroyed<AtomicString> hebrewPlain("ArialHebrew", AtomicString::ConstructFromLiteral); 336 336 static NeverDestroyed<AtomicString> hebrewBold("ArialHebrew-Bold", AtomicString::ConstructFromLiteral); 337 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? hebrewBold : hebrewPlain, false);337 font = fontForFamily(description, isFontWeightBold(description.weight()) ? hebrewBold : hebrewPlain, false); 338 338 break; 339 339 } … … 391 391 AtomicString* indicFontString = isFontWeightBold(description.weight()) ? indicUnicodePageFontsBold[indicPageOrderIndex] : indicUnicodePageFonts[indicPageOrderIndex]; 392 392 if (indicFontString) 393 simpleFontData= fontForFamily(description, *indicFontString, false);393 font = fontForFamily(description, *indicFontString, false); 394 394 } 395 395 break; … … 398 398 static NeverDestroyed<AtomicString> thaiPlain("Thonburi", AtomicString::ConstructFromLiteral); 399 399 static NeverDestroyed<AtomicString> thaiBold("Thonburi-Bold", AtomicString::ConstructFromLiteral); 400 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? thaiBold : thaiPlain, false);400 font = fontForFamily(description, isFontWeightBold(description.weight()) ? thaiBold : thaiPlain, false); 401 401 break; 402 402 } … … 404 404 static NeverDestroyed<AtomicString> tibetanPlain("Kailasa", AtomicString::ConstructFromLiteral); 405 405 static NeverDestroyed<AtomicString> tibetanBold("Kailasa-Bold", AtomicString::ConstructFromLiteral); 406 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? tibetanBold : tibetanPlain, false);406 font = fontForFamily(description, isFontWeightBold(description.weight()) ? tibetanBold : tibetanPlain, false); 407 407 break; 408 408 } … … 410 410 static NeverDestroyed<AtomicString> casPlain("EuphemiaUCAS", AtomicString::ConstructFromLiteral); 411 411 static NeverDestroyed<AtomicString> casBold("EuphemiaUCAS-Bold", AtomicString::ConstructFromLiteral); 412 simpleFontData= fontForFamily(description, isFontWeightBold(description.weight()) ? casBold : casPlain, false);412 font = fontForFamily(description, isFontWeightBold(description.weight()) ? casBold : casPlain, false); 413 413 break; 414 414 } 415 415 case LanguageSpecificFont::Khmer: { 416 416 static NeverDestroyed<AtomicString> khmer("KhmerSangamMN", AtomicString::ConstructFromLiteral); 417 simpleFontData= fontForFamily(description, khmer, false);417 font = fontForFamily(description, khmer, false); 418 418 break; 419 419 } 420 420 case LanguageSpecificFont::Lao: { 421 421 static NeverDestroyed<AtomicString> lao("LaoSangamMN", AtomicString::ConstructFromLiteral); 422 simpleFontData= fontForFamily(description, lao, false);422 font = fontForFamily(description, lao, false); 423 423 break; 424 424 } … … 431 431 } 432 432 if (useEmojiFont) 433 simpleFontData= fontForFamily(description, appleColorEmoji, false);433 font = fontForFamily(description, appleColorEmoji, false); 434 434 else { 435 435 RetainPtr<CTFontRef> fallbackFont = adoptCF(CTFontCreateForCharacters(originalFontData->getCTFont(), characters, length, nullptr)); 436 436 if (RetainPtr<CFStringRef> foundFontName = adoptCF(CTFontCopyPostScriptName(fallbackFont.get()))) 437 simpleFontData= fontForFamily(description, foundFontName.get(), false);438 } 439 break; 440 } 441 } 442 443 if ( simpleFontData)444 return simpleFontData.release();437 font = fontForFamily(description, foundFontName.get(), false); 438 } 439 break; 440 } 441 } 442 443 if (font) 444 return font.release(); 445 445 446 446 return lastResortFallbackFont(description); 447 447 } 448 448 449 RefPtr< SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)449 RefPtr<Font> FontCache::similarFont(const FontDescription& description) 450 450 { 451 451 // Attempt to find an appropriate font using a match based on the presence of keywords in 452 452 // the requested names. For example, we'll match any name that contains "Arabic" to Geeza Pro. 453 RefPtr< SimpleFontData> simpleFontData;453 RefPtr<Font> font; 454 454 for (unsigned i = 0; i < description.familyCount(); ++i) { 455 455 const AtomicString& family = description.familyAt(i); … … 462 462 static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral); 463 463 if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) { 464 simpleFontData= fontForFamily(description, courier);464 font = fontForFamily(description, courier); 465 465 continue; 466 466 } … … 470 470 static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral); 471 471 if (equalIgnoringCase(family, lucidaGrande)) { 472 simpleFontData= fontForFamily(description, verdana);472 font = fontForFamily(description, verdana); 473 473 continue; 474 474 } … … 480 480 static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral); 481 481 static NeverDestroyed<AtomicString> geezaBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral); 482 for (int j = 0; j < 3 && ! simpleFontData; ++j)482 for (int j = 0; j < 3 && !font; ++j) { 483 483 if (family.contains(*matchWords[j], false)) 484 simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain); 485 } 486 487 return simpleFontData.release(); 488 } 489 490 Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 484 font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain); 485 } 486 } 487 488 return font.release(); 489 } 490 491 Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 491 492 { 492 493 static NeverDestroyed<AtomicString> fallbackFontFamily(".PhoneFallback", AtomicString::ConstructFromLiteral); -
trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm
r178510 r178940 26 26 27 27 #import "config.h" 28 #import " SimpleFontData.h"28 #import "Font.h" 29 29 30 30 #import "BlockExceptions.h" … … 68 68 } 69 69 70 void SimpleFontData::platformInit()70 void Font::platformInit() 71 71 { 72 72 m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size() / 24.0f) : 0.f; … … 129 129 } 130 130 131 void SimpleFontData::platformCharWidthInit()131 void Font::platformCharWidthInit() 132 132 { 133 133 m_avgCharWidth = 0; … … 138 138 } 139 139 140 PassRefPtr< SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription&, float scaleFactor) const140 PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const 141 141 { 142 142 if (isCustomFont()) { 143 143 FontPlatformData scaledFontData(m_platformData); 144 144 scaledFontData.m_size = scaledFontData.m_size * scaleFactor; 145 return SimpleFontData::create(scaledFontData, true, false);145 return Font::create(scaledFontData, true, false); 146 146 } 147 147 … … 168 168 } 169 169 170 void SimpleFontData::determinePitch()170 void Font::determinePitch() 171 171 { 172 172 CTFontRef ctFont = m_platformData.font(); … … 185 185 } 186 186 187 CGFontRenderingStyle SimpleFontData::renderingStyle() const187 CGFontRenderingStyle Font::renderingStyle() const 188 188 { 189 189 return kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered; 190 190 } 191 191 192 bool SimpleFontData::advanceForColorBitmapFont(Glyph, CGSize&) const192 bool Font::advanceForColorBitmapFont(Glyph, CGSize&) const 193 193 { 194 194 return false; -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r178510 r178940 57 57 } 58 58 59 float width(unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)59 float width(unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts) 60 60 { 61 61 m_controller->advance(from, 0, ByWholeGlyphs, fallbackFonts); … … 97 97 } 98 98 99 float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)99 float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts) 100 100 { 101 101 return layout.width(from, len, fallbackFonts); … … 116 116 } 117 117 118 ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const SimpleFontData*>* fallbackFonts, bool forTextEmphasis)118 ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis) 119 119 : m_font(*font) 120 120 , m_run(run) … … 292 292 return; 293 293 294 // We break up glyph run generation for the string by Font Data.294 // We break up glyph run generation for the string by Font. 295 295 const UChar* cp; 296 296 … … 309 309 const UChar* end = cp + m_end; 310 310 311 const SimpleFontData* fontData;311 const Font* font; 312 312 bool isMissingGlyph; 313 const SimpleFontData* nextFontData;313 const Font* nextFont; 314 314 bool nextIsMissingGlyph; 315 315 … … 333 333 334 334 nextIsMissingGlyph = false; 335 nextFont Data = m_font.fontDataForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);336 if (!nextFont Data)335 nextFont = m_font.fontForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant); 336 if (!nextFont) 337 337 nextIsMissingGlyph = true; 338 338 339 339 while (curr < end) { 340 font Data = nextFontData;340 font = nextFont; 341 341 isMissingGlyph = nextIsMissingGlyph; 342 342 isSmallCaps = nextIsSmallCaps; … … 359 359 nextIsMissingGlyph = false; 360 360 if (baseCharacter == zeroWidthJoiner) 361 nextFont Data = fontData;361 nextFont = font; 362 362 else { 363 nextFont Data = m_font.fontDataForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);364 if (!nextFont Data)363 nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant); 364 if (!nextFont) 365 365 nextIsMissingGlyph = true; 366 366 } 367 367 368 if (nextFont Data != fontData|| nextIsMissingGlyph != isMissingGlyph) {368 if (nextFont != font || nextIsMissingGlyph != isMissingGlyph) { 369 369 int itemStart = static_cast<int>(indexOfFontTransition); 370 370 int itemLength = index - indexOfFontTransition; 371 collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? font Data: 0);371 collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? font : 0); 372 372 indexOfFontTransition = index; 373 373 } … … 377 377 if (itemLength) { 378 378 int itemStart = indexOfFontTransition; 379 collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFont Data: 0);379 collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFont : 0); 380 380 } 381 381 … … 470 470 } 471 471 472 void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const SimpleFontData*>* fallbackFonts)472 void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const Font*>* fallbackFonts) 473 473 { 474 474 if (static_cast<int>(offset) > m_end) … … 495 495 unsigned g = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun; 496 496 unsigned k = leftmostGlyph + g; 497 if (fallbackFonts && &complexTextRun.font Data() != &m_font.primaryFontData())498 fallbackFonts->add(&complexTextRun.font Data());497 if (fallbackFonts && &complexTextRun.font() != &m_font.primaryFont()) 498 fallbackFonts->add(&complexTextRun.font()); 499 499 500 500 // We must store the initial advance for the first glyph we are going to draw. … … 521 521 522 522 if (glyphBuffer && !m_characterInCurrentGlyph) 523 glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font Data(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));523 glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun)); 524 524 525 525 unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph; … … 567 567 ComplexTextRun& complexTextRun = *m_complexTextRuns[r]; 568 568 unsigned glyphCount = complexTextRun.glyphCount(); 569 const SimpleFontData& fontData = complexTextRun.fontData();569 const Font& font = complexTextRun.font(); 570 570 #if PLATFORM(IOS) 571 bool isEmoji = font Data.platformData().m_isEmoji;571 bool isEmoji = font.platformData().m_isEmoji; 572 572 #endif 573 573 … … 589 589 590 590 bool lastRun = r + 1 == runCount; 591 bool roundsAdvances = !m_font.isPrinterFont() && font Data.platformData().roundsGlyphAdvances();592 float spaceWidth = font Data.spaceWidth() - fontData.syntheticBoldOffset();591 bool roundsAdvances = !m_font.isPrinterFont() && font.platformData().roundsGlyphAdvances(); 592 float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset(); 593 593 CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth); 594 594 const UChar* cp = complexTextRun.characters(); … … 617 617 618 618 bool treatAsSpace = FontCascade::treatAsSpace(ch); 619 CGGlyph glyph = treatAsSpace ? font Data.spaceGlyph() : glyphs[i];619 CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i]; 620 620 CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i]; 621 621 #if PLATFORM(IOS) 622 622 if (isEmoji && advance.width) 623 advance.width = font Data.widthForGlyph(glyph);623 advance.width = font.widthForGlyph(glyph); 624 624 #endif 625 625 626 626 if (ch == '\t' && m_run.allowTabs()) 627 advance.width = m_font.tabWidth(font Data, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);627 advance.width = m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit); 628 628 else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) { 629 629 advance.width = 0; 630 glyph = font Data.spaceGlyph();630 glyph = font.spaceGlyph(); 631 631 } 632 632 … … 635 635 advance.width = roundedAdvanceWidth; 636 636 637 advance.width += font Data.syntheticBoldOffset();637 advance.width += font.syntheticBoldOffset(); 638 638 639 639 … … 642 642 // Second, in fixed-pitch fonts we ensure that all glyphs that 643 643 // match the width of the space glyph have the same width as the space glyph. 644 if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (font Data.pitch() == FixedPitch || glyph == fontData.spaceGlyph()))645 advance.width = font Data.adjustedSpaceWidth();644 if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (font.pitch() == FixedPitch || glyph == font.spaceGlyph())) 645 advance.width = font.adjustedSpaceWidth(); 646 646 647 647 if (hasExtraSpacing) { … … 718 718 m_adjustedGlyphs.append(glyph); 719 719 720 FloatRect glyphBounds = font Data.boundsForGlyph(glyph);720 FloatRect glyphBounds = font.boundsForGlyph(glyph); 721 721 glyphBounds.move(glyphOrigin.x, glyphOrigin.y); 722 722 m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x()); -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h
r178510 r178940 42 42 43 43 class FontCascade; 44 class SimpleFontData;44 class Font; 45 45 class TextRun; 46 46 … … 51 51 class ComplexTextController { 52 52 public: 53 ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false);53 ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const Font*>* fallbackFonts = 0, bool forTextEmphasis = false); 54 54 55 55 // Advance and emit glyphs up to the specified character. 56 void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const SimpleFontData*>* fallbackFonts = 0);56 void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const Font*>* fallbackFonts = 0); 57 57 58 58 // Compute the character offset for a given x coordinate. … … 74 74 class ComplexTextRun : public RefCounted<ComplexTextRun> { 75 75 public: 76 static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)76 static Ref<ComplexTextRun> create(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) 77 77 { 78 return adoptRef(*new ComplexTextRun(ctRun, font Data, characters, stringLocation, stringLength, runRange));78 return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, runRange)); 79 79 } 80 80 81 static Ref<ComplexTextRun> create(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)81 static Ref<ComplexTextRun> create(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) 82 82 { 83 return adoptRef(*new ComplexTextRun(font Data, characters, stringLocation, stringLength, ltr));83 return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr)); 84 84 } 85 85 86 86 unsigned glyphCount() const { return m_glyphCount; } 87 const SimpleFontData& fontData() const { return m_fontData; }87 const Font& font() const { return m_font; } 88 88 const UChar* characters() const { return m_characters; } 89 89 unsigned stringLocation() const { return m_stringLocation; } … … 101 101 102 102 private: 103 ComplexTextRun(CTRunRef, const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);104 ComplexTextRun(const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);103 ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); 104 ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); 105 105 106 106 unsigned m_glyphCount; 107 const SimpleFontData& m_fontData;107 const Font& m_font; 108 108 const UChar* m_characters; 109 109 unsigned m_stringLocation; … … 128 128 void collectComplexTextRuns(); 129 129 130 void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);130 void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const Font*); 131 131 void adjustGlyphsAndAdvances(); 132 132 … … 170 170 bool m_afterExpansion; 171 171 172 HashSet<const SimpleFontData*>* m_fallbackFonts;172 HashSet<const Font*>* m_fallbackFonts; 173 173 174 174 float m_minGlyphBoundingBoxX; -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
r178510 r178940 62 62 63 63 // By the time a WebCascadeList is used, the FontCascade has already been asked to realize all of its 64 // Font Data, so this loop does not hit the FontCache.64 // Fonts, so this loop does not hit the FontCache. 65 65 while (!_font->fallbackRangesAt(_count).isNull()) 66 66 _count++; … … 83 83 _fontDescriptors.grow(index + 1); 84 84 85 const WebCore:: SimpleFontData* simpleFontData = _font->fallbackRangesAt(index).fontDataForCharacter(_character);86 if (! simpleFontData)87 simpleFontData = &_font->fallbackRangesAt(index).fontDataForFirstRange();88 fontDescriptor = CTFontCopyFontDescriptor( simpleFontData->platformData().ctFont());85 const WebCore::Font* font = _font->fallbackRangesAt(index).fontForCharacter(_character); 86 if (!font) 87 font = &_font->fallbackRangesAt(index).fontForFirstRange(); 88 fontDescriptor = CTFontCopyFontDescriptor(font->platformData().ctFont()); 89 89 _fontDescriptors[index] = adoptCF(fontDescriptor); 90 90 return (id)fontDescriptor; … … 95 95 namespace WebCore { 96 96 97 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)98 : m_font Data(fontData)97 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) 98 : m_font(font) 99 99 , m_characters(characters) 100 100 , m_stringLocation(stringLocation) … … 131 131 // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on 132 132 // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path. 133 ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)134 : m_font Data(fontData)133 ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) 134 : m_font(font) 135 135 , m_characters(characters) 136 136 , m_stringLocation(stringLocation) … … 164 164 m_glyphsVector.fill(0, m_glyphCount); 165 165 m_glyphs = m_glyphsVector.data(); 166 m_advancesVector.fill(CGSizeMake(m_font Data.widthForGlyph(0), 0), m_glyphCount);166 m_advancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount); 167 167 m_advances = m_advancesVector.data(); 168 168 } … … 185 185 } 186 186 187 void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)188 { 189 if (!font Data) {187 void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const Font* font) 188 { 189 if (!font) { 190 190 // Create a run of missing glyphs from the primary font. 191 m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont Data(), cp, stringLocation, length, m_run.ltr()));191 m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); 192 192 return; 193 193 } … … 197 197 UChar32 baseCharacter = 0; 198 198 RetainPtr<CFDictionaryRef> stringAttributes; 199 if (font Data == SimpleFontData::systemFallback()) {199 if (font == Font::systemFallback()) { 200 200 // FIXME: This code path does not support small caps. 201 201 isSystemFallback = true; 202 202 203 203 U16_GET(cp, 0, 0, length, baseCharacter); 204 font Data = m_font.fallbackRangesAt(0).fontDataForCharacter(baseCharacter);205 if (!font Data)206 font Data = &m_font.fallbackRangesAt(0).fontDataForFirstRange();204 font = m_font.fallbackRangesAt(0).fontForCharacter(baseCharacter); 205 if (!font) 206 font = &m_font.fallbackRangesAt(0).fontForFirstRange(); 207 207 208 208 RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]); 209 209 210 stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font Data->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation())));210 stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation()))); 211 211 static const void* attributeKeys[] = { kCTFontCascadeListAttribute }; 212 212 const void* values[] = { cascadeList.get() }; 213 213 RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 214 214 RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); 215 RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(font Data->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));215 RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(font->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get())); 216 216 CFDictionarySetValue(const_cast<CFMutableDictionaryRef>(stringAttributes.get()), kCTFontAttributeName, fontWithCascadeList.get()); 217 217 } else 218 stringAttributes = font Data->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation());218 stringAttributes = font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation()); 219 219 220 220 RetainPtr<CTLineRef> line; … … 249 249 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); 250 250 CFRange runRange = CTRunGetStringRange(ctRun); 251 const SimpleFontData* runFontData = fontData;251 const Font* runFont = font; 252 252 if (isSystemFallback) { 253 253 CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun); 254 CTFontRef run Font = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName));255 ASSERT(CFGetTypeID(run Font) == CTFontGetTypeID());256 RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(run Font);257 if (!CFEqual(runFontEqualityObject.get(), font Data->platformData().objectForEqualityCheck().get())) {254 CTFontRef runCTFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName)); 255 ASSERT(CFGetTypeID(runCTFont) == CTFontGetTypeID()); 256 RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(runCTFont); 257 if (!CFEqual(runFontEqualityObject.get(), font->platformData().objectForEqualityCheck().get())) { 258 258 // Begin trying to see if runFont matches any of the fonts in the fallback list. 259 259 260 260 for (unsigned i = 0; !m_font.fallbackRangesAt(i).isNull(); ++i) { 261 runFont Data = m_font.fallbackRangesAt(i).fontDataForCharacter(baseCharacter);262 if (!runFont Data)261 runFont = m_font.fallbackRangesAt(i).fontForCharacter(baseCharacter); 262 if (!runFont) 263 263 continue; 264 RetainPtr<CFTypeRef> runFontEqualityObject = runFont Data->platformData().objectForEqualityCheck();264 RetainPtr<CFTypeRef> runFontEqualityObject = runFont->platformData().objectForEqualityCheck(); 265 265 if (CFEqual(runFontEqualityObject.get(), runFontEqualityObject.get())) 266 266 break; 267 runFont Data = 0;267 runFont = nullptr; 268 268 } 269 269 // If there is no matching font, look up by name in the font cache. 270 if (!runFont Data) {270 if (!runFont) { 271 271 // Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through 272 272 // the font cache and ultimately through NSFontManager in order to get an NSFont with the right 273 273 // NSFontRenderingMode. 274 RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(run Font));274 RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runCTFont)); 275 275 if (CFEqual(fontName.get(), CFSTR("LastResort"))) { 276 m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont Data(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));276 m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr())); 277 277 continue; 278 278 } 279 runFont Data= fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();279 runFont = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get(); 280 280 #if !PLATFORM(IOS) 281 281 // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on 282 282 // using the font as returned, even though it may not have the best NSFontRenderingMode. 283 if (!runFont Data) {284 FontPlatformData runFontPlatformData((NSFont *)run Font, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont());285 runFont Data= &fontCache().fontForPlatformData(runFontPlatformData).get();283 if (!runFont) { 284 FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont), m_font.fontDescription().usePrinterFont()); 285 runFont = &fontCache().fontForPlatformData(runFontPlatformData).get(); 286 286 } 287 287 #else 288 288 // FIXME: Just assert for now, until we can devise a better fix that works with iOS. 289 ASSERT(runFont Data);289 ASSERT(runFont); 290 290 #endif 291 291 } 292 if (m_fallbackFonts && runFont Data != &m_font.primaryFontData())293 m_fallbackFonts->add(runFont Data);292 if (m_fallbackFonts && runFont != &m_font.primaryFont()) 293 m_fallbackFonts->add(runFont); 294 294 } 295 295 } 296 if (m_fallbackFonts && runFont Data != &m_font.primaryFontData())297 m_fallbackFonts->add(font Data);298 299 m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont Data, cp, stringLocation, length, runRange));296 if (m_fallbackFonts && runFont != &m_font.primaryFont()) 297 m_fallbackFonts->add(font); 298 299 m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange)); 300 300 } 301 301 } -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r178510 r178940 34 34 35 35 #import "CoreGraphicsSPI.h" 36 #import "Font.h" 36 37 #import "FontCascade.h" 37 #import "SimpleFontData.h"38 38 #import "FontPlatformData.h" 39 39 #import "NSFontSPI.h" … … 338 338 } 339 339 340 RefPtr< SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool isPlatformFont, const UChar* characters, int length)340 RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length) 341 341 { 342 342 UChar32 character; … … 406 406 } 407 407 408 RefPtr< SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)408 RefPtr<Font> FontCache::similarFont(const FontDescription& description) 409 409 { 410 410 // Attempt to find an appropriate font using a match based on 411 411 // the presence of keywords in the the requested names. For example, we'll 412 412 // match any name that contains "Arabic" to Geeza Pro. 413 RefPtr< SimpleFontData> simpleFontData;413 RefPtr<Font> font; 414 414 for (unsigned i = 0; i < description.familyCount(); ++i) { 415 415 const AtomicString& family = description.familyAt(i); … … 418 418 static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") }; 419 419 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral)); 420 for (int j = 0; j < 3 && ! simpleFontData; ++j)420 for (int j = 0; j < 3 && !font; ++j) { 421 421 if (family.contains(*matchWords[j], false)) 422 simpleFontData = fontForFamily(description, geezaStr); 423 } 424 return simpleFontData.release(); 425 } 426 427 Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 422 font = fontForFamily(description, geezaStr); 423 } 424 } 425 return font.release(); 426 } 427 428 Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 428 429 { 429 430 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times", AtomicString::ConstructFromLiteral)); … … 431 432 // FIXME: Would be even better to somehow get the user's default font here. For now we'll pick 432 433 // the default that the user would get without changing any prefs. 433 RefPtr< SimpleFontData> simpleFontData= fontForFamily(fontDescription, timesStr, false);434 if ( simpleFontData)435 return * simpleFontData;434 RefPtr<Font> font = fontForFamily(fontDescription, timesStr, false); 435 if (font) 436 return *font; 436 437 437 438 // The Times fallback will almost always work, but in the highly unusual case where -
trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp
r178510 r178940 32 32 #include "CoreGraphicsSPI.h" 33 33 #include "CoreTextSPI.h" 34 #include "Font.h" 34 35 #include "FontCascade.h" 35 #include "SimpleFontData.h"36 36 #include "WebCoreSystemInterface.h" 37 37 #if !PLATFORM(IOS) … … 41 41 namespace WebCore { 42 42 43 static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)43 static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData) 44 44 { 45 45 if (fontData->platformData().isCompositeFontReference()) … … 56 56 } 57 57 58 bool GlyphPage::mayUseMixedFont DataWhenFilling(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)58 bool GlyphPage::mayUseMixedFontsWhenFilling(const UChar* buffer, unsigned bufferLength, const Font* fontData) 59 59 { 60 60 #if USE(APPKIT) … … 69 69 } 70 70 71 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)71 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData) 72 72 { 73 73 bool haveGlyphs = false; … … 164 164 #if USE(APPKIT) 165 165 } else { 166 const SimpleFontData* runSimple = fontData->compositeFontReferenceFontData((NSFont *)runFont);166 const Font* runSimple = fontData->compositeFontReferenceFont((NSFont *)runFont); 167 167 if (runSimple) { 168 168 for (CFIndex i = 0; i < glyphCount; ++i) { -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
r161589 r178940 26 26 27 27 #include "config.h" 28 #include " SimpleFontData.h"28 #include "Font.h" 29 29 30 30 #if !PLATFORM(IOS) … … 36 36 namespace WebCore { 37 37 38 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const38 CFDictionaryRef Font::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const 39 39 { 40 40 unsigned key = typesettingFeatures + 1; -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r178573 r178940 26 26 27 27 #import "config.h" 28 #import " SimpleFontData.h"28 #import "Font.h" 29 29 30 30 #import "BlockExceptions.h" … … 72 72 } 73 73 74 static bool initFontData( SimpleFontData* fontData)74 static bool initFontData(Font* fontData) 75 75 { 76 76 if (!fontData->platformData().cgFont()) … … 86 86 } 87 87 88 const SimpleFontData* SimpleFontData::compositeFontReferenceFontData(NSFont *key) const88 const Font* Font::compositeFontReferenceFont(NSFont *key) const 89 89 { 90 90 if (!key || CFEqual(adoptCF(CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort"))) … … 104 104 105 105 FontPlatformData substitutePlatform(substituteFont, platformData().size(), isUsingPrinterFont, syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant()); 106 addResult.iterator->value = SimpleFontData::create(substitutePlatform, isCustomFont());106 addResult.iterator->value = Font::create(substitutePlatform, isCustomFont()); 107 107 } 108 108 return addResult.iterator->value.get(); 109 109 } 110 110 111 void SimpleFontData::platformInit()111 void Font::platformInit() 112 112 { 113 113 m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f; … … 227 227 xHeight = scaleEmToUnits(CGFontGetXHeight(m_platformData.cgFont()), unitsPerEm) * pointSize; 228 228 } else 229 xHeight = verticalRightOrientationFont Data()->fontMetrics().xHeight();229 xHeight = verticalRightOrientationFont()->fontMetrics().xHeight(); 230 230 231 231 m_fontMetrics.setUnitsPerEm(unitsPerEm); … … 242 242 } 243 243 244 void SimpleFontData::platformCharWidthInit()244 void Font::platformCharWidthInit() 245 245 { 246 246 m_avgCharWidth = 0; … … 270 270 #endif // USE(APPKIT) 271 271 272 void SimpleFontData::platformDestroy()272 void Font::platformDestroy() 273 273 { 274 274 } 275 275 276 276 #if !PLATFORM(IOS) 277 PassRefPtr< SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const277 PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const 278 278 { 279 279 if (isCustomFont()) { 280 280 FontPlatformData scaledFontData(m_platformData); 281 281 scaledFontData.m_size = scaledFontData.m_size * scaleFactor; 282 return SimpleFontData::create(scaledFontData, true, false);282 return Font::create(scaledFontData, true, false); 283 283 } 284 284 … … 311 311 } 312 312 313 void SimpleFontData::determinePitch()313 void Font::determinePitch() 314 314 { 315 315 NSFont* f = m_platformData.nsFont(); … … 334 334 #endif // !PLATFORM(IOS) 335 335 336 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const336 FloatRect Font::platformBoundsForGlyph(Glyph glyph) const 337 337 { 338 338 FloatRect boundingBox; … … 346 346 347 347 #if PLATFORM(MAC) 348 inline CGFontRenderingStyle SimpleFontData::renderingStyle() const348 inline CGFontRenderingStyle Font::renderingStyle() const 349 349 { 350 350 CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization; … … 365 365 } 366 366 367 inline bool SimpleFontData::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const367 inline bool Font::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const 368 368 { 369 369 NSFont *font = platformData().nsFont(); … … 395 395 } 396 396 397 inline bool SimpleFontData::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const397 inline bool Font::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const 398 398 { 399 399 // Fast getter doesn't take custom tracking into account … … 411 411 } 412 412 413 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const413 float Font::platformWidthForGlyph(Glyph glyph) const 414 414 { 415 415 CGSize advance = CGSizeZero; … … 447 447 } 448 448 449 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const449 bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const 450 450 { 451 451 ASSERT(isMainThread()); -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
r177955 r178940 27 27 #include "OpenTypeMathData.h" 28 28 29 #include "Font.h" 29 30 #include "FontPlatformData.h" 30 31 #if ENABLE(OPENTYPE_MATH) … … 32 33 #endif 33 34 #include "SharedBuffer.h" 34 #include "SimpleFontData.h"35 35 36 36 using namespace std; … … 236 236 237 237 #if ENABLE(OPENTYPE_MATH) 238 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font Data)239 { 240 m_mathBuffer = font Data.openTypeTable(OpenType::MATHTag);238 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font) 239 { 240 m_mathBuffer = font.openTypeTable(OpenType::MATHTag); 241 241 const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer); 242 242 if (!math) { … … 266 266 267 267 #if ENABLE(OPENTYPE_MATH) 268 float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant constant) const268 float OpenTypeMathData::getMathConstant(const Font& font, MathConstant constant) const 269 269 { 270 270 int32_t value = 0; … … 289 289 return value * font.sizePerUnit(); 290 290 #else 291 float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) const291 float OpenTypeMathData::getMathConstant(const Font&, MathConstant) const 292 292 { 293 293 ASSERT_NOT_REACHED(); … … 297 297 298 298 #if ENABLE(OPENTYPE_MATH) 299 float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph glyph) const299 float OpenTypeMathData::getItalicCorrection(const Font& font, Glyph glyph) const 300 300 { 301 301 const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer); … … 311 311 return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit(); 312 312 #else 313 float OpenTypeMathData::getItalicCorrection(const SimpleFontData&, Glyph) const313 float OpenTypeMathData::getItalicCorrection(const Font&, Glyph) const 314 314 { 315 315 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h
r177955 r178940 36 36 class FontPlatformData; 37 37 class SharedBuffer; 38 class SimpleFontData;38 class Font; 39 39 40 40 class OpenTypeMathData : public RefCounted<OpenTypeMathData> { 41 41 public: 42 static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& font Data)42 static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& font) 43 43 { 44 return adoptRef(new OpenTypeMathData(font Data));44 return adoptRef(new OpenTypeMathData(font)); 45 45 } 46 46 ~OpenTypeMathData(); … … 114 114 }; 115 115 116 float getMathConstant(const SimpleFontData&, MathConstant) const;117 float getItalicCorrection(const SimpleFontData&, Glyph) const;116 float getMathConstant(const Font&, MathConstant) const; 117 float getItalicCorrection(const Font&, Glyph) const; 118 118 void getMathVariants(Glyph, bool isVertical, Vector<Glyph>& sizeVariants, Vector<AssemblyPart>& assemblyParts) const; 119 119 -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp
r166640 r178940 28 28 29 29 #include "FloatRect.h" 30 #include "Font.h" 30 31 #include "GlyphPage.h" 31 32 #include "OpenTypeTypes.h" 32 33 #include "SharedBuffer.h" 33 #include "SimpleFontData.h"34 34 #include <wtf/RefPtr.h> 35 35 … … 480 480 } 481 481 482 float OpenTypeVerticalData::advanceHeight(const SimpleFontData* font, Glyph glyph) const482 float OpenTypeVerticalData::advanceHeight(const Font* font, Glyph glyph) const 483 483 { 484 484 size_t countHeights = m_advanceHeights.size(); … … 493 493 } 494 494 495 void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const SimpleFontData* font, const Glyph* glyphs, size_t count, float* outXYArray) const495 void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const Font* font, const Glyph* glyphs, size_t count, float* outXYArray) const 496 496 { 497 497 size_t countWidths = m_advanceWidths.size(); … … 536 536 } 537 537 538 void OpenTypeVerticalData::substituteWithVerticalGlyphs(const SimpleFontData* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const538 void OpenTypeVerticalData::substituteWithVerticalGlyphs(const Font* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const 539 539 { 540 540 const HashMap<Glyph, Glyph>& map = m_verticalGlyphMap; -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h
r134871 r178940 36 36 namespace WebCore { 37 37 38 class Font; 38 39 class FontPlatformData; 39 40 class GlyphPage; 40 class SimpleFontData;41 41 42 42 class OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> { … … 49 49 bool isOpenType() const { return !m_advanceWidths.isEmpty(); } 50 50 bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); } 51 float advanceHeight(const SimpleFontData*, Glyph) const;52 void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, size_t, float* outXYArray) const;53 void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigned offset, unsigned length) const;51 float advanceHeight(const Font*, Glyph) const; 52 void getVerticalTranslationsForGlyphs(const Font*, const Glyph*, size_t, float* outXYArray) const; 53 void substituteWithVerticalGlyphs(const Font*, GlyphPage*, unsigned offset, unsigned length) const; 54 54 55 55 private: -
trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp
r178510 r178940 29 29 #include "AffineTransform.h" 30 30 #include "FloatConversion.h" 31 #include "Font.h" 31 32 #include "GlyphBuffer.h" 32 33 #include "GraphicsContext.h" 33 34 #include "IntRect.h" 34 #include "SimpleFontData.h"35 35 #include "UniscribeController.h" 36 36 #include "WebCoreTextRenderer.h" … … 128 128 } 129 129 130 void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,130 void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const Font* font, const GlyphBuffer& glyphBuffer, 131 131 int from, int numGlyphs, const FloatPoint& point) const 132 132 { -
trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp
r178521 r178940 29 29 #include "config.h" 30 30 #include <winsock2.h> 31 #include "Font.h" 31 32 #include "FontCache.h" 32 33 #include "HWndDC.h" 33 #include "SimpleFontData.h"34 34 #include <mlang.h> 35 35 #include <windows.h> … … 200 200 } 201 201 202 RefPtr< SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)202 RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length) 203 203 { 204 204 UChar character = characters[0]; 205 RefPtr< SimpleFontData> fontData;205 RefPtr<Font> fontData; 206 206 HWndDC hdc(0); 207 207 HFONT primaryFont = originalFontData->platformData().hfont(); … … 310 310 } 311 311 312 RefPtr< SimpleFontData> FontCache::fontDataFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)312 RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName) 313 313 { 314 314 AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE)); 315 RefPtr< SimpleFontData> fontData = fontForFamily(fontDescription, familyName);315 RefPtr<Font> fontData = fontForFamily(fontDescription, familyName); 316 316 if (fontData) 317 317 outFontFamilyName = familyName; … … 319 319 } 320 320 321 Ref< SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)321 Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription) 322 322 { 323 323 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, fallbackFontName, ()); … … 338 338 AtomicString("Arial", AtomicString::ConstructFromLiteral) 339 339 }; 340 RefPtr< SimpleFontData> simpleFont;340 RefPtr<Font> simpleFont; 341 341 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) { 342 342 if (simpleFont = fontForFamily(fontDescription, fallbackFonts[i])) { … … 350 350 LOGFONT defaultGUILogFont; 351 351 GetObject(defaultGUIFont, sizeof(defaultGUILogFont), &defaultGUILogFont); 352 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName))352 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName)) 353 353 return *simpleFont; 354 354 } … … 358 358 nonClientMetrics.cbSize = sizeof(nonClientMetrics); 359 359 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) { 360 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))360 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName)) 361 361 return *simpleFont; 362 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))362 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName)) 363 363 return *simpleFont; 364 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))364 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName)) 365 365 return *simpleFont; 366 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))366 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName)) 367 367 return *simpleFont; 368 if (simpleFont = font DataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))368 if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName)) 369 369 return *simpleFont; 370 370 } -
trunk/Source/WebCore/platform/graphics/win/FontWin.cpp
r178510 r178940 27 27 #include "FontCascade.h" 28 28 29 #include "Font.h" 29 30 #include "FontGlyphs.h" 30 31 #include "GlyphBuffer.h" … … 33 34 #include "LayoutRect.h" 34 35 #include "Logging.h" 35 #include "SimpleFontData.h"36 36 #include "TextRun.h" 37 37 #include "UniscribeController.h" … … 121 121 } 122 122 123 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const123 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 124 124 { 125 125 UniscribeController controller(this, run, fallbackFonts); -
trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp
r177876 r178940 30 30 #include "GlyphPage.h" 31 31 32 #include " SimpleFontData.h"32 #include "Font.h" 33 33 #include <WebKitSystemInterface/WebKitSystemInterface.h> 34 34 35 35 namespace WebCore { 36 36 37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData) 38 38 { 39 39 // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs. -
trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
r177876 r178940 30 30 #include "GlyphPage.h" 31 31 32 #include "Font.h" 32 33 #include "HWndDC.h" 33 #include "SimpleFontData.h"34 34 35 35 namespace WebCore { 36 36 37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData) 38 38 { 39 39 // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs. -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
r178510 r178940 28 28 29 29 #include "config.h" 30 #include " SimpleFontData.h"30 #include "Font.h" 31 31 32 32 #include "FloatRect.h" … … 49 49 using namespace std; 50 50 51 void SimpleFontData::platformInit()51 void Font::platformInit() 52 52 { 53 53 m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f; … … 104 104 } 105 105 106 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const106 FloatRect Font::platformBoundsForGlyph(Glyph glyph) const 107 107 { 108 108 if (!platformData().size()) … … 123 123 } 124 124 125 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const125 float Font::platformWidthForGlyph(Glyph glyph) const 126 126 { 127 127 if (!platformData().size()) -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
r178510 r178940 28 28 29 29 #include "config.h" 30 #include " SimpleFontData.h"30 #include "Font.h" 31 31 32 32 #include <windows.h> … … 42 42 namespace WebCore { 43 43 44 void SimpleFontData::platformInit()44 void Font::platformInit() 45 45 { 46 46 m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f; … … 104 104 } 105 105 106 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const106 FloatRect Font::platformBoundsForGlyph(Glyph glyph) const 107 107 { 108 108 if (m_platformData.useGDI()) … … 112 112 } 113 113 114 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const114 float Font::platformWidthForGlyph(Glyph glyph) const 115 115 { 116 116 if (m_platformData.useGDI()) -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
r178510 r178940 28 28 29 29 #include "config.h" 30 #include " SimpleFontData.h"30 #include "Font.h" 31 31 32 32 #include "FontCache.h" … … 44 44 static bool g_shouldApplyMacAscentHack; 45 45 46 void SimpleFontData::setShouldApplyMacAscentHack(bool b)46 void Font::setShouldApplyMacAscentHack(bool b) 47 47 { 48 48 g_shouldApplyMacAscentHack = b; 49 49 } 50 50 51 bool SimpleFontData::shouldApplyMacAscentHack()51 bool Font::shouldApplyMacAscentHack() 52 52 { 53 53 return g_shouldApplyMacAscentHack; 54 54 } 55 55 56 float SimpleFontData::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent)56 float Font::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent) 57 57 { 58 58 if (!shouldApplyMacAscentHack()) … … 72 72 } 73 73 74 void SimpleFontData::initGDIFont()74 void Font::initGDIFont() 75 75 { 76 76 if (!m_platformData.size()) { … … 107 107 } 108 108 109 void SimpleFontData::platformCharWidthInit()109 void Font::platformCharWidthInit() 110 110 { 111 111 // GDI Fonts init charwidths in initGDIFont. … … 117 117 } 118 118 119 void SimpleFontData::platformDestroy()119 void Font::platformDestroy() 120 120 { 121 121 ScriptFreeCache(&m_scriptCache); … … 123 123 } 124 124 125 PassRefPtr< SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const125 PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const 126 126 { 127 127 float scaledSize = scaleFactor * m_platformData.size(); … … 129 129 FontPlatformData scaledFont(m_platformData); 130 130 scaledFont.setSize(scaledSize); 131 return SimpleFontData::create(scaledFont, true, false);131 return Font::create(scaledFont, true, false); 132 132 } 133 133 … … 136 136 winfont.lfHeight = -lroundf(scaledSize * (m_platformData.useGDI() ? 1 : 32)); 137 137 auto hfont = adoptGDIObject(::CreateFontIndirect(&winfont)); 138 return SimpleFontData::create(FontPlatformData(WTF::move(hfont), scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false);139 } 140 141 void SimpleFontData::determinePitch()138 return Font::create(FontPlatformData(WTF::move(hfont), scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false); 139 } 140 141 void Font::determinePitch() 142 142 { 143 143 if (isCustomFont()) { … … 160 160 } 161 161 162 FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const162 FloatRect Font::boundsForGDIGlyph(Glyph glyph) const 163 163 { 164 164 HWndDC hdc(0); … … 176 176 } 177 177 178 float SimpleFontData::widthForGDIGlyph(Glyph glyph) const178 float Font::widthForGDIGlyph(Glyph glyph) const 179 179 { 180 180 HWndDC hdc(0); … … 192 192 } 193 193 194 SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const194 SCRIPT_FONTPROPERTIES* Font::scriptFontProperties() const 195 195 { 196 196 if (!m_scriptFontProperties) { -
trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp
r178510 r178940 26 26 #include "config.h" 27 27 #include "UniscribeController.h" 28 29 #include "Font.h" 28 30 #include "FontCascade.h" 29 31 #include "HWndDC.h" 30 #include "SimpleFontData.h"31 32 #include "TextRun.h" 32 33 #include <wtf/MathExtras.h> … … 42 43 // take the GlyphBuffer as an arg so that we don't have to populate the glyph buffer when 43 44 // measuring. 44 UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts)45 UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts) 45 46 : m_font(*font) 46 47 , m_run(run) … … 137 138 const UChar* end = m_run.rtl() ? cp - 1 : cp + length; 138 139 139 const SimpleFontData* fontData;140 const SimpleFontData* nextFontData = m_font.glyphDataForCharacter(*curr, false).fontData;140 const Font* fontData; 141 const Font* nextFontData = m_font.glyphDataForCharacter(*curr, false).font; 141 142 142 143 UChar newC = 0; … … 159 160 160 161 bool forceSmallCaps = isSmallCaps && (U_GET_GC_MASK(c) & U_GC_M_MASK); 161 nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).font Data;162 nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).font; 162 163 if (m_font.isSmallCaps()) { 163 164 nextIsSmallCaps = forceSmallCaps || (newC = u_toupper(c)) != c; … … 166 167 } 167 168 168 if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFont Data())169 if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFont()) 169 170 m_fallbackFonts->add(fontData); 170 171 … … 180 181 int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : length - indexOfFontTransition; 181 182 if (itemLength) { 182 if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFont Data())183 if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFont()) 183 184 m_fallbackFonts->add(nextFontData); 184 185 … … 191 192 } 192 193 193 void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)194 void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const Font* fontData, GlyphBuffer* glyphBuffer) 194 195 { 195 196 // ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1. This is why there is an extra empty item … … 233 234 } 234 235 235 bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)236 bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const Font* fontData, GlyphBuffer* glyphBuffer) 236 237 { 237 238 // Determine the string for this item. … … 405 406 } 406 407 407 bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,408 bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const Font* fontData, 408 409 Vector<WORD>& glyphs, Vector<WORD>& clusters, 409 410 Vector<SCRIPT_VISATTR>& visualAttributes) -
trunk/Source/WebCore/platform/graphics/win/UniscribeController.h
r178510 r178940 36 36 class UniscribeController { 37 37 public: 38 UniscribeController(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0);38 UniscribeController(const FontCascade*, const TextRun&, HashSet<const Font*>* fallbackFonts = 0); 39 39 40 40 // Advance and measure/place up to the specified character. … … 55 55 void resetControlAndState(); 56 56 57 void itemizeShapeAndPlace(const UChar*, unsigned length, const SimpleFontData*, GlyphBuffer*);58 bool shapeAndPlaceItem(const UChar*, unsigned index, const SimpleFontData*, GlyphBuffer*);59 bool shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,57 void itemizeShapeAndPlace(const UChar*, unsigned length, const Font*, GlyphBuffer*); 58 bool shapeAndPlaceItem(const UChar*, unsigned index, const Font*, GlyphBuffer*); 59 bool shape(const UChar* str, int len, SCRIPT_ITEM, const Font*, 60 60 Vector<WORD>& glyphs, Vector<WORD>& clusters, 61 61 Vector<SCRIPT_VISATTR>& visualAttributes); … … 63 63 const FontCascade& m_font; 64 64 const TextRun& m_run; 65 HashSet<const SimpleFontData*>* m_fallbackFonts;65 HashSet<const Font*>* m_fallbackFonts; 66 66 FloatPoint m_glyphOrigin; 67 67 float m_minGlyphBoundingBoxX; -
trunk/Source/WebCore/platform/win/PopupMenuWin.cpp
r178520 r178940 27 27 #include "Document.h" 28 28 #include "FloatRect.h" 29 #include "Font.h" 29 30 #include "FontSelector.h" 30 31 #include "Frame.h" … … 43 44 #include "Scrollbar.h" 44 45 #include "ScrollbarTheme.h" 45 #include "SimpleFontData.h"46 46 #include "TextRun.h" 47 47 #include "WebCoreInstanceHandle.h" -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r178510 r178940 450 450 const RenderStyle& lineStyle = this->lineStyle(); 451 451 if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright 452 || lineStyle.fontCascade().primaryFont Data().hasVerticalGlyphs())452 || lineStyle.fontCascade().primaryFont().hasVerticalGlyphs()) 453 453 return true; 454 454 … … 461 461 return true; 462 462 } else { 463 if (child->lineStyle().fontCascade().primaryFont Data().hasVerticalGlyphs())463 if (child->lineStyle().fontCascade().primaryFont().hasVerticalGlyphs()) 464 464 return true; 465 465 466 const Vector<const SimpleFontData*>* usedFonts = nullptr;466 const Vector<const Font*>* usedFonts = nullptr; 467 467 if (is<InlineTextBox>(*child)) { 468 468 GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(downcast<InlineTextBox>(child)); … … 471 471 472 472 if (usedFonts) { 473 for (const SimpleFontData* fontData: *usedFonts) {474 if (font Data->hasVerticalGlyphs())473 for (const Font* font : *usedFonts) { 474 if (font->hasVerticalGlyphs()) 475 475 return true; 476 476 } -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r176354 r178940 32 32 class InlineTextBox; 33 33 class RenderLineBoxList; 34 class SimpleFontData;34 class Font; 35 35 class VerticalPositionCache; 36 36 37 37 struct GlyphOverflow; 38 38 39 typedef HashMap<const InlineTextBox*, std::pair<Vector<const SimpleFontData*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap;39 typedef HashMap<const InlineTextBox*, std::pair<Vector<const Font*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap; 40 40 41 41 class InlineFlowBox : public InlineBox { -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r178510 r178940 1382 1382 TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath()); 1383 1383 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 1384 if (font.primaryFont Data().isSVGFont())1384 if (font.primaryFont().isSVGFont()) 1385 1385 run.setRenderingContext(SVGTextRunRenderingContext::create(renderer())); 1386 1386 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r178822 r178940 2326 2326 2327 2327 // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge? 2328 float maxCharWidth = lineGrid->style().fontCascade().primaryFont Data().maxCharWidth();2328 float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth(); 2329 2329 if (!maxCharWidth) 2330 2330 return left; … … 2366 2366 2367 2367 // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge? 2368 float maxCharWidth = lineGrid->style().fontCascade().primaryFont Data().maxCharWidth();2368 float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth(); 2369 2369 if (!maxCharWidth) 2370 2370 return right; … … 3706 3706 3707 3707 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); 3708 if (font.primaryFont Data().isSVGFont()) {3708 if (font.primaryFont().isSVGFont()) { 3709 3709 ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything. 3710 3710 run.setRenderingContext(SVGTextRunRenderingContext::create(*context)); … … 3726 3726 } 3727 3727 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); 3728 if (font.primaryFont Data().isSVGFont()) {3728 if (font.primaryFont().isSVGFont()) { 3729 3729 ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything. 3730 3730 run.setRenderingContext(SVGTextRunRenderingContext::create(*context)); -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r178510 r178940 459 459 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements) 460 460 { 461 HashSet<const SimpleFontData*> fallbackFonts;461 HashSet<const Font*> fallbackFonts; 462 462 GlyphOverflow glyphOverflow; 463 463 … … 510 510 measuredWidth += wordMeasurement.width; 511 511 if (!wordMeasurement.fallbackFonts.isEmpty()) { 512 HashSet<const SimpleFontData*>::const_iterator end = wordMeasurement.fallbackFonts.end();513 for (HashSet<const SimpleFontData*>::const_iterator it = wordMeasurement.fallbackFonts.begin(); it != end; ++it)512 HashSet<const Font*>::const_iterator end = wordMeasurement.fallbackFonts.end(); 513 for (HashSet<const Font*>::const_iterator it = wordMeasurement.fallbackFonts.begin(); it != end; ++it) 514 514 fallbackFonts.add(*it); 515 515 } … … 528 528 if (!fallbackFonts.isEmpty()) { 529 529 ASSERT(run->box()->behavesLikeText()); 530 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;530 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const Font*>(), GlyphOverflow())).iterator; 531 531 ASSERT(it->value.first.isEmpty()); 532 532 copyToVector(fallbackFonts, it->value.first); … … 540 540 if (!glyphOverflow.isEmpty()) { 541 541 ASSERT(run->box()->behavesLikeText()); 542 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;542 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const Font*>(), GlyphOverflow())).iterator; 543 543 it->value.second = glyphOverflow; 544 544 run->box()->clearKnownToHaveNoOverflow(); -
trunk/Source/WebCore/rendering/RenderCombineText.cpp
r178510 r178940 58 58 } 59 59 60 float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const60 float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 61 61 { 62 62 if (m_isCombined) -
trunk/Source/WebCore/rendering/RenderCombineText.h
r178510 r178940 47 47 48 48 virtual bool isCombineText() const override { return true; } 49 virtual float width(unsigned from, unsigned length, const FontCascade&, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const override;49 virtual float width(unsigned from, unsigned length, const FontCascade&, float xPosition, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const override; 50 50 virtual const char* renderName() const override { return "RenderCombineText"; } 51 51 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; -
trunk/Source/WebCore/rendering/RenderSearchField.cpp
r178510 r178940 28 28 #include "CSSValueKeywords.h" 29 29 #include "Chrome.h" 30 #include "Font.h" 30 31 #include "Frame.h" 31 32 #include "FrameSelection.h" … … 43 44 #include "SearchPopupMenu.h" 44 45 #include "Settings.h" 45 #include "SimpleFontData.h"46 46 #include "StyleResolver.h" 47 47 #include "TextControlInnerElements.h" -
trunk/Source/WebCore/rendering/RenderText.cpp
r178510 r178940 452 452 } 453 453 454 ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const454 ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const 455 455 { 456 456 if (style.hasTextCombine() && is<RenderCombineText>(*this)) { … … 631 631 void RenderText::computePreferredLogicalWidths(float leadWidth) 632 632 { 633 HashSet<const SimpleFontData*> fallbackFonts;633 HashSet<const Font*> fallbackFonts; 634 634 GlyphOverflow glyphOverflow; 635 635 computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow); … … 644 644 } 645 645 646 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)646 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) 647 647 { 648 648 suffixStart = 0; … … 684 684 } 685 685 686 void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)686 void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow& glyphOverflow) 687 687 { 688 688 ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts); … … 1207 1207 } 1208 1208 1209 float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const1209 float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 1210 1210 { 1211 1211 if (from >= textLength()) … … 1219 1219 } 1220 1220 1221 float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const1221 float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 1222 1222 { 1223 1223 ASSERT(from + len <= textLength()); -
trunk/Source/WebCore/rendering/RenderText.h
r178510 r178940 90 90 void positionLineBox(InlineTextBox&); 91 91 92 virtual float width(unsigned from, unsigned len, const FontCascade&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;93 virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;92 virtual float width(unsigned from, unsigned len, const FontCascade&, float xPos, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 93 virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 94 94 95 95 float minLogicalWidth() const; … … 181 181 virtual bool canHaveChildren() const override final { return false; } 182 182 183 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&);183 void computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow&); 184 184 185 185 bool computeCanUseSimpleFontCodePath() const; … … 193 193 194 194 bool containsOnlyWhitespace(unsigned from, unsigned len) const; 195 float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;195 float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const; 196 196 bool isAllASCII() const { return m_isAllASCII; } 197 197 bool computeUseBackslashAsYenSymbol() const; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r178510 r178940 28 28 #include "CSSValueKeywords.h" 29 29 #include "Chrome.h" 30 #include "Font.h" 30 31 #include "Frame.h" 31 32 #include "FrameSelection.h" … … 41 42 #include "RenderView.h" 42 43 #include "Settings.h" 43 #include "SimpleFontData.h"44 44 #include "StyleResolver.h" 45 45 #include "TextControlInnerElements.h" … … 347 347 maxCharWidth = scaleEmToUnits(4027); 348 348 else if (style().fontCascade().hasValidAverageCharWidth()) 349 maxCharWidth = roundf(style().fontCascade().primaryFont Data().maxCharWidth());349 maxCharWidth = roundf(style().fontCascade().primaryFont().maxCharWidth()); 350 350 #endif 351 351 -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r178510 r178940 581 581 582 582 RenderObject* renderer = inputElement.renderer(); 583 if (font.primaryFont Data().isSVGFont() && !renderer)583 if (font.primaryFont().isSVGFont() && !renderer) 584 584 return; 585 585 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r178510 r178940 886 886 } 887 887 888 Vector<const SimpleFontData*>* usedFonts = nullptr;888 Vector<const Font*>* usedFonts = nullptr; 889 889 GlyphOverflow* glyphOverflow = nullptr; 890 890 if (is<InlineTextBox>(box)) { … … 902 902 const RenderStyle& boxLineStyle = box.lineStyle(); 903 903 if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) { 904 usedFonts->append(&boxLineStyle.fontCascade().primaryFont Data());904 usedFonts->append(&boxLineStyle.fontCascade().primaryFont()); 905 905 for (size_t i = 0; i < usedFonts->size(); ++i) { 906 906 const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics(); -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r178939 r178940 53 53 54 54 template <typename CharacterType> 55 static bool canUseForText(const CharacterType* text, unsigned length, const SimpleFontData& fontData)55 static bool canUseForText(const CharacterType* text, unsigned length, const Font& font) 56 56 { 57 57 // FIXME: <textarea maxlength=0> generates empty text node. … … 76 76 return false; 77 77 78 if (!font Data.glyphForCharacter(character))78 if (!font.glyphForCharacter(character)) 79 79 return false; 80 80 } … … 82 82 } 83 83 84 static bool canUseForText(const RenderText& textRenderer, const SimpleFontData& fontData)84 static bool canUseForText(const RenderText& textRenderer, const Font& font) 85 85 { 86 86 if (textRenderer.is8Bit()) 87 return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font Data);88 return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font Data);87 return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font); 88 return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font); 89 89 } 90 90 … … 185 185 } 186 186 } 187 if (style.fontCascade().primaryFont Data().isSVGFont())187 if (style.fontCascade().primaryFont().isSVGFont()) 188 188 return false; 189 189 // We assume that all lines have metrics based purely on the primary font. 190 auto& primaryFont Data = style.fontCascade().primaryFontData();191 if (primaryFont Data.isLoading())190 auto& primaryFont = style.fontCascade().primaryFont(); 191 if (primaryFont.isLoading()) 192 192 return false; 193 193 for (const auto& textRenderer : childrenOfType<RenderText>(flow)) { … … 197 197 if (style.fontCascade().codePath(TextRun(textRenderer.text())) != FontCascade::Simple) 198 198 return false; 199 if (!canUseForText(textRenderer, primaryFont Data))199 if (!canUseForText(textRenderer, primaryFont)) 200 200 return false; 201 201 } -
trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h
r178510 r178940 60 60 int startOffset; 61 61 int endOffset; 62 HashSet<const SimpleFontData*> fallbackFonts;62 HashSet<const Font*> fallbackFonts; 63 63 }; 64 64 … … 487 487 } 488 488 489 inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const SimpleFontData*>* fallbackFonts = 0)489 inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const Font*>* fallbackFonts = 0) 490 490 { 491 491 const RenderStyle& style = renderer->style(); … … 493 493 } 494 494 495 ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const FontCascade& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const SimpleFontData*>& fallbackFonts, TextLayout* layout = 0)495 ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const FontCascade& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const Font*>& fallbackFonts, TextLayout* layout = 0) 496 496 { 497 497 const RenderStyle& style = text->style(); … … 579 579 580 580 #if !ASSERT_DISABLED 581 HashSet<const SimpleFontData*> fallbackFonts;581 HashSet<const Font*> fallbackFonts; 582 582 float prefixWidth = hyphenWidth + textWidth(text, lastSpace, prefixLength, font, xPos, isFixedPitch, collapseWhiteSpace, fallbackFonts) + lastSpaceWordSpacing; 583 583 ASSERT(xPos + prefixWidth <= availableWidth); … … 657 657 // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure 658 658 // words with their trailing space, then subtract its width. 659 HashSet<const SimpleFontData*> fallbackFonts;659 HashSet<const Font*> fallbackFonts; 660 660 float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !textLayout ? font.width(RenderBlock::constructTextRun(&renderText, font, &space, 1, style), &fallbackFonts) + wordSpacing : 0; 661 661 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r178510 r178940 1334 1334 FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData& data) const 1335 1335 { 1336 return data.font Data->boundsForGlyph(data.glyph);1336 return data.font->boundsForGlyph(data.glyph); 1337 1337 } 1338 1338 … … 1344 1344 float RenderMathMLOperator::advanceForGlyph(const GlyphData& data) const 1345 1345 { 1346 return data.font Data->widthForGlyph(data.glyph);1346 return data.font->widthForGlyph(data.glyph); 1347 1347 } 1348 1348 … … 1522 1522 bottom.glyph = extension.glyph; 1523 1523 1524 top.font Data = &style().fontCascade().primaryFontData();1525 extension.font Data = top.fontData;1526 bottom.font Data = top.fontData;1524 top.font = &style().fontCascade().primaryFont(); 1525 extension.font = top.font; 1526 bottom.font = top.font; 1527 1527 if (middle.glyph) 1528 middle.font Data = top.fontData;1528 middle.font = top.font; 1529 1529 1530 1530 stretchyData.setGlyphAssemblyMode(top, extension, bottom, middle); … … 1539 1539 ASSERT(m_isVertical && isLargeOperatorInDisplayStyle()); 1540 1540 1541 const auto& primaryFont Data = style().fontCascade().primaryFontData();1541 const auto& primaryFont = style().fontCascade().primaryFont(); 1542 1542 GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection()); 1543 if (!primaryFont Data.mathData() || baseGlyph.fontData != &primaryFontData)1543 if (!primaryFont.mathData() || baseGlyph.font != &primaryFont) 1544 1544 return data; 1545 1545 … … 1548 1548 1549 1549 // The value of displayOperatorMinHeight is sometimes too small, so we ensure that it is at least \sqrt{2} times the size of the base glyph. 1550 float displayOperatorMinHeight = std::max(baseGlyph.font Data->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData.mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight));1551 1552 primaryFont Data.mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);1550 float displayOperatorMinHeight = std::max(baseGlyph.font->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFont.mathData()->getMathConstant(primaryFont, OpenTypeMathData::DisplayOperatorMinHeight)); 1551 1552 primaryFont.mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts); 1553 1553 1554 1554 // We choose the first size variant that is larger than the expected displayOperatorMinHeight and otherwise fallback to the largest variant. … … 1556 1556 GlyphData sizeVariant; 1557 1557 sizeVariant.glyph = variant; 1558 sizeVariant.font Data = &primaryFontData;1558 sizeVariant.font = &primaryFont; 1559 1559 data.setSizeVariantMode(sizeVariant); 1560 1560 if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight) … … 1571 1571 StretchyData assemblyData; 1572 1572 1573 const auto& primaryFont Data = style().fontCascade().primaryFontData();1573 const auto& primaryFont = style().fontCascade().primaryFont(); 1574 1574 GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection()); 1575 1575 1576 if (primaryFont Data.mathData() && baseGlyph.fontData == &primaryFontData) {1576 if (primaryFont.mathData() && baseGlyph.font == &primaryFont) { 1577 1577 Vector<Glyph> sizeVariants; 1578 1578 Vector<OpenTypeMathData::AssemblyPart> assemblyParts; 1579 primaryFont Data.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);1579 primaryFont.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts); 1580 1580 // We verify the size variants. 1581 1581 for (auto& variant : sizeVariants) { 1582 1582 GlyphData sizeVariant; 1583 1583 sizeVariant.glyph = variant; 1584 sizeVariant.font Data = &primaryFontData;1584 sizeVariant.font = &primaryFont; 1585 1585 if (maximumGlyphWidth) 1586 1586 *maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(sizeVariant)); … … 1802 1802 1803 1803 GlyphBuffer buffer; 1804 buffer.add(data.glyph, data.font Data, advanceForGlyph(data));1805 info.context->drawGlyphs(style().fontCascade(), *data.font Data, buffer, 0, 1, origin);1804 buffer.add(data.glyph, data.font, advanceForGlyph(data)); 1805 info.context->drawGlyphs(style().fontCascade(), *data.font, buffer, 0, 1, origin); 1806 1806 1807 1807 return glyphPaintRect; … … 1895 1895 ASSERT(m_stretchyData.variant().glyph); 1896 1896 GlyphBuffer buffer; 1897 buffer.add(m_stretchyData.variant().glyph, m_stretchyData.variant().font Data, advanceForGlyph(m_stretchyData.variant()));1897 buffer.add(m_stretchyData.variant().glyph, m_stretchyData.variant().font, advanceForGlyph(m_stretchyData.variant())); 1898 1898 LayoutPoint operatorTopLeft = ceiledIntPoint(paintOffset + location()); 1899 1899 FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant()); 1900 1900 LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y()); 1901 info.context->drawGlyphs(style().fontCascade(), *m_stretchyData.variant().font Data, buffer, 0, 1, operatorOrigin);1901 info.context->drawGlyphs(style().fontCascade(), *m_stretchyData.variant().font, buffer, 0, 1, operatorOrigin); 1902 1902 return; 1903 1903 } … … 1981 1981 LayoutUnit RenderMathMLOperator::trailingSpaceError() 1982 1982 { 1983 const auto& primaryFont Data = style().fontCascade().primaryFontData();1984 if (!primaryFont Data.mathData())1983 const auto& primaryFont = style().fontCascade().primaryFont(); 1984 if (!primaryFont.mathData()) 1985 1985 return 0; 1986 1986 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r177259 r178940 29 29 #if ENABLE(MATHML) 30 30 31 #include "Font.h" 31 32 #include "GlyphPage.h" 32 33 #include "MathMLElement.h" 33 34 #include "OpenTypeMathData.h" 34 35 #include "RenderMathMLToken.h" 35 #include "SimpleFontData.h"36 36 37 37 namespace WebCore { -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp
r178510 r178940 64 64 void RenderMathMLRadicalOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline) 65 65 { 66 if (!style().fontCascade().primaryFont Data().mathData()) {66 if (!style().fontCascade().primaryFont().mathData()) { 67 67 // If we do not have an OpenType MATH font, we always make the radical depth a bit larger than the target. 68 68 depthBelowBaseline += gRadicalBottomPointLower; … … 84 84 ASSERT(preferredLogicalWidthsDirty()); 85 85 86 if (style().fontCascade().primaryFont Data().mathData()) {86 if (style().fontCascade().primaryFont().mathData()) { 87 87 RenderMathMLOperator::computePreferredLogicalWidths(); 88 88 return; … … 97 97 void RenderMathMLRadicalOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const 98 98 { 99 if (style().fontCascade().primaryFont Data().mathData()) {99 if (style().fontCascade().primaryFont().mathData()) { 100 100 RenderMathMLOperator::computeLogicalHeight(logicalHeight, logicalTop, computedValues); 101 101 return; … … 112 112 return; 113 113 114 if (style().fontCascade().primaryFont Data().mathData()) {114 if (style().fontCascade().primaryFont().mathData()) { 115 115 RenderMathMLOperator::paint(info, paintOffset); 116 116 return; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
r178510 r178940 209 209 m_degreeBottomRaisePercent = 0.6f; 210 210 211 const auto& primaryFont Data = style().fontCascade().primaryFontData();212 if (auto* mathData = style().fontCascade().primaryFont Data().mathData()) {211 const auto& primaryFont = style().fontCascade().primaryFont(); 212 if (auto* mathData = style().fontCascade().primaryFont().mathData()) { 213 213 // FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737). 214 m_verticalGap = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalVerticalGap);215 m_ruleThickness = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalRuleThickness);216 m_extraAscender = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalExtraAscender);214 m_verticalGap = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalVerticalGap); 215 m_ruleThickness = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalRuleThickness); 216 m_extraAscender = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalExtraAscender); 217 217 218 218 if (!isRenderMathMLSquareRoot()) { 219 kernBeforeDegree = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalKernBeforeDegree);220 kernAfterDegree = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalKernAfterDegree);221 m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFont Data, OpenTypeMathData::RadicalDegreeBottomRaisePercent);219 kernBeforeDegree = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalKernBeforeDegree); 220 kernAfterDegree = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalKernAfterDegree); 221 m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalDegreeBottomRaisePercent); 222 222 } 223 223 } -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r178510 r178940 1185 1185 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinus, 1)); 1186 1186 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphen, 1)); 1187 return fontCascade().primaryFont Data().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;1187 return fontCascade().primaryFont().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString; 1188 1188 } 1189 1189 -
trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp
r178250 r178940 29 29 30 30 #include "FloatQuad.h" 31 #include "Font.h" 31 32 #include "GraphicsContext.h" 32 33 #include "HitTestRequest.h" … … 46 47 #include "SVGTransformList.h" 47 48 #include "SVGURIReference.h" 48 #include "SimpleFontData.h"49 49 #include "TransformState.h" 50 50 #include "VisiblePosition.h" -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r178510 r178940 420 420 , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */); 421 421 422 if (style->fontCascade().primaryFont Data().isSVGFont())422 if (style->fontCascade().primaryFont().isSVGFont()) 423 423 run.setRenderingContext(SVGTextRunRenderingContext::create(renderer())); 424 424 -
trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp
r178510 r178940 42 42 { 43 43 #if ENABLE(SVG_FONTS) 44 const SimpleFontData& fontData = m_font.primaryFontData();45 if (!font Data.isSVGFont()) {44 const Font& font = m_font.primaryFont(); 45 if (!font.isSVGFont()) { 46 46 m_lastGlyph.isValid = false; 47 47 return 0; 48 48 } 49 49 50 ASSERT(font Data.isCustomFont());51 ASSERT(font Data.isSVGFont());50 ASSERT(font.isCustomFont()); 51 ASSERT(font.isSVGFont()); 52 52 53 auto* svgFontData = static_cast<const SVGFontData*>(font Data.svgData());53 auto* svgFontData = static_cast<const SVGFontData*>(font.svgData()); 54 54 SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement(); 55 55 ASSERT(svgFontFace); -
trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp
r178510 r178940 71 71 , isOverride(style.unicodeBidi()) /* directionalOverride */); 72 72 73 if (style.fontCascade().primaryFont Data().isSVGFont())73 if (style.fontCascade().primaryFont().isSVGFont()) 74 74 run.setRenderingContext(SVGTextRunRenderingContext::create(text)); 75 75 … … 92 92 SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText& text, unsigned position, unsigned length, float width, const String& glyphName) 93 93 { 94 bool needsContext = text.style().fontCascade().primaryFont Data().isSVGFont();94 bool needsContext = text.style().fontCascade().primaryFont().isSVGFont(); 95 95 float scalingFactor = text.scalingFactor(); 96 96 ASSERT(scalingFactor); -
trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
r178510 r178940 38 38 namespace WebCore { 39 39 40 static inline const SVGFontData* svgFontAndFontFaceElementForFontData(const SimpleFontData* fontData, SVGFontFaceElement*& fontFace, SVGFontElement*& font)41 { 42 ASSERT(font Data);43 ASSERT(font Data->isCustomFont());44 ASSERT(font Data->isSVGFont());45 46 auto* svgFontData = static_cast<const SVGFontData*>(font Data->svgData());47 48 fontFace= svgFontData->svgFontFaceElement();49 ASSERT( fontFace);50 51 font = fontFace->associatedFontElement();40 static inline const SVGFontData* svgFontAndFontFaceElementForFontData(const Font* font, SVGFontFaceElement*& svgFontFaceElement, SVGFontElement*& svgFontElement) 41 { 42 ASSERT(font); 43 ASSERT(font->isCustomFont()); 44 ASSERT(font->isSVGFont()); 45 46 auto* svgFontData = static_cast<const SVGFontData*>(font->svgData()); 47 48 svgFontFaceElement = svgFontData->svgFontFaceElement(); 49 ASSERT(svgFontFaceElement); 50 51 svgFontElement = svgFontFaceElement->associatedFontElement(); 52 52 return svgFontData; 53 53 } … … 62 62 } 63 63 64 bool SVGTextRunRenderingContext::applySVGKerning(const SimpleFontData* fontData, WidthIterator& iterator, GlyphBuffer* glyphBuffer, int from) const64 bool SVGTextRunRenderingContext::applySVGKerning(const Font* font, WidthIterator& iterator, GlyphBuffer* glyphBuffer, int from) const 65 65 { 66 66 ASSERT(glyphBuffer); … … 69 69 SVGFontFaceElement* fontFaceElement = 0; 70 70 71 svgFontAndFontFaceElementForFontData(font Data, fontFaceElement, fontElement);71 svgFontAndFontFaceElementForFontData(font, fontFaceElement, fontElement); 72 72 if (!fontElement || !fontFaceElement) 73 73 return false; … … 76 76 return true; 77 77 78 float scale = scaleEmToUnits(font Data->platformData().size(), fontFaceElement->unitsPerEm());78 float scale = scaleEmToUnits(font->platformData().size(), fontFaceElement->unitsPerEm()); 79 79 80 80 String lastGlyphName; … … 206 206 207 207 ++m_index; 208 if (m_index >= m_stoppingPoint || !m_glyphBuffer.font DataAt(m_index)->isSVGFont())208 if (m_index >= m_stoppingPoint || !m_glyphBuffer.fontAt(m_index)->isSVGFont()) 209 209 break; 210 210 m_glyph = m_glyphBuffer.glyphAt(m_index); … … 245 245 }; 246 246 247 std::unique_ptr<GlyphToPathTranslator> SVGTextRunRenderingContext::createGlyphToPathTranslator(const SimpleFontData& fontData, const TextRun* textRun, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const247 std::unique_ptr<GlyphToPathTranslator> SVGTextRunRenderingContext::createGlyphToPathTranslator(const Font& font, const TextRun* textRun, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const 248 248 { 249 249 SVGFontElement* fontElement = nullptr; 250 250 SVGFontFaceElement* fontFaceElement = nullptr; 251 251 252 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(&font Data, fontFaceElement, fontElement);252 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(&font, fontFaceElement, fontElement); 253 253 if (!fontElement || !fontFaceElement) 254 254 return std::make_unique<DummyGlyphToPathTranslator>(); … … 258 258 bool isVerticalText = style.svgStyle().isVerticalWritingMode(); 259 259 260 float scale = scaleEmToUnits(font Data.platformData().size(), fontFaceElement->unitsPerEm());260 float scale = scaleEmToUnits(font.platformData().size(), fontFaceElement->unitsPerEm()); 261 261 262 262 return std::make_unique<SVGGlyphToPathTranslator>(textRun, glyphBuffer, point, *svgFontData, *fontElement, from, numGlyphs, scale, isVerticalText); 263 263 } 264 264 265 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const265 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const 266 266 { 267 267 auto activePaintingResource = this->activePaintingResource(); … … 279 279 280 280 RenderSVGResourceMode resourceMode = context->textDrawingMode() == TextModeStroke ? ApplyToStrokeMode : ApplyToFillMode; 281 for (auto translator = createGlyphToPathTranslator(*font Data, nullptr, glyphBuffer, from, numGlyphs, point); translator->containsMorePaths(); translator->advance()) {281 for (auto translator = createGlyphToPathTranslator(*font, nullptr, glyphBuffer, from, numGlyphs, point); translator->containsMorePaths(); translator->advance()) { 282 282 Path glyphPath = translator->path(); 283 283 if (activePaintingResource->applyResource(elementRenderer, style, context, resourceMode)) { … … 293 293 static GlyphData missingGlyphForFont(const FontCascade& font) 294 294 { 295 const SimpleFontData& primaryFontData = font.primaryFontData();296 if (!primaryFont Data.isSVGFont())295 const Font& primaryFont = font.primaryFont(); 296 if (!primaryFont.isSVGFont()) 297 297 return GlyphData(); 298 298 SVGFontElement* fontElement; 299 299 SVGFontFaceElement* fontFaceElement; 300 svgFontAndFontFaceElementForFontData(&primaryFont Data, fontFaceElement, fontElement);301 return GlyphData(fontElement->missingGlyph(), &primaryFont Data);300 svgFontAndFontFaceElementForFontData(&primaryFont, fontFaceElement, fontElement); 301 return GlyphData(fontElement->missingGlyph(), &primaryFont); 302 302 } 303 303 … … 308 308 return missingGlyphForFont(font); 309 309 310 ASSERT(glyphData.font Data);310 ASSERT(glyphData.font); 311 311 312 312 // Characters enclosed by an <altGlyph> element, may not be registered in the GlyphPage. 313 if (!glyphData.font Data->isSVGFont()) {313 if (!glyphData.font->isSVGFont()) { 314 314 auto& elementRenderer = is<RenderElement>(renderer()) ? downcast<RenderElement>(renderer()) : *renderer().parent(); 315 315 if (Element* parentRendererElement = elementRenderer.element()) { 316 316 if (is<SVGAltGlyphElement>(*parentRendererElement)) 317 glyphData.font Data = &font.primaryFontData();317 glyphData.font = &font.primaryFont(); 318 318 } 319 319 } 320 320 321 if (!glyphData.font Data->isSVGFont())321 if (!glyphData.font->isSVGFont()) 322 322 return glyphData; 323 323 324 324 SVGFontElement* fontElement = nullptr; 325 325 SVGFontFaceElement* fontFaceElement = nullptr; 326 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(glyphData.font Data, fontFaceElement, fontElement);326 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(glyphData.font, fontFaceElement, fontElement); 327 327 if (!svgFontData) 328 328 return glyphData; -
trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h
r178510 r178940 44 44 45 45 virtual GlyphData glyphDataForCharacter(const FontCascade&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) override; 46 virtual void drawSVGGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const override;46 virtual void drawSVGGlyphs(GraphicsContext*, const Font*, const GlyphBuffer&, int from, int to, const FloatPoint&) const override; 47 47 virtual float floatWidthUsingSVGFont(const FontCascade&, const TextRun&, int& charsConsumed, String& glyphName) const override; 48 virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const override;48 virtual bool applySVGKerning(const Font*, WidthIterator&, GlyphBuffer*, int from) const override; 49 49 #endif 50 50 … … 61 61 62 62 #if ENABLE(SVG_FONTS) 63 virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const SimpleFontData&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const override;63 virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const Font&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const override; 64 64 #endif 65 65 -
trunk/Source/WebCore/svg/SVGFontData.cpp
r178510 r178940 58 58 } 59 59 60 void SVGFontData::initializeFont Data(SimpleFontData* fontData, float fontSize)61 { 62 ASSERT(font Data);60 void SVGFontData::initializeFont(Font* font, float fontSize) 61 { 62 ASSERT(font); 63 63 64 64 SVGFontFaceElement* svgFontFaceElement = this->svgFontFaceElement(); 65 65 ASSERT(svgFontFaceElement); 66 66 67 font Data->setZeroWidthSpaceGlyph(0);68 font Data->determinePitch();67 font->setZeroWidthSpaceGlyph(0); 68 font->determinePitch(); 69 69 70 70 unsigned unitsPerEm = svgFontFaceElement->unitsPerEm(); … … 75 75 float lineGap = 0.1f * fontSize; 76 76 77 const GlyphPage* glyphPageZero = font Data->glyphPage(0);77 const GlyphPage* glyphPageZero = font->glyphPage(0); 78 78 79 79 if (!xHeight && glyphPageZero) { 80 80 // Fallback if x_heightAttr is not specified for the font element. 81 81 Glyph letterXGlyph = glyphPageZero->glyphDataForCharacter('x').glyph; 82 xHeight = letterXGlyph ? font Data->widthForGlyph(letterXGlyph) : 2 * ascent / 3;83 } 84 85 FontMetrics& fontMetrics = font Data->fontMetrics();82 xHeight = letterXGlyph ? font->widthForGlyph(letterXGlyph) : 2 * ascent / 3; 83 } 84 85 FontMetrics& fontMetrics = font->fontMetrics(); 86 86 fontMetrics.setUnitsPerEm(unitsPerEm); 87 87 fontMetrics.setAscent(ascent); … … 92 92 93 93 if (!glyphPageZero) { 94 font Data->setSpaceGlyph(0);95 font Data->setSpaceWidths(0);96 font Data->setAvgCharWidth(0);97 font Data->setMaxCharWidth(ascent);94 font->setSpaceGlyph(0); 95 font->setSpaceWidths(0); 96 font->setAvgCharWidth(0); 97 font->setMaxCharWidth(ascent); 98 98 return; 99 99 } … … 101 101 // Calculate space width. 102 102 Glyph spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph; 103 font Data->setSpaceGlyph(spaceGlyph);104 font Data->setSpaceWidths(fontData->widthForGlyph(spaceGlyph));103 font->setSpaceGlyph(spaceGlyph); 104 font->setSpaceWidths(font->widthForGlyph(spaceGlyph)); 105 105 106 106 // Estimate average character width. 107 107 Glyph numeralZeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph; 108 font Data->setAvgCharWidth(numeralZeroGlyph ? fontData->widthForGlyph(numeralZeroGlyph) : fontData->spaceWidth());108 font->setAvgCharWidth(numeralZeroGlyph ? font->widthForGlyph(numeralZeroGlyph) : font->spaceWidth()); 109 109 110 110 // Estimate maximum character width. 111 111 Glyph letterWGlyph = glyphPageZero->glyphDataForCharacter('W').glyph; 112 font Data->setMaxCharWidth(letterWGlyph ? fontData->widthForGlyph(letterWGlyph) : ascent);112 font->setMaxCharWidth(letterWGlyph ? font->widthForGlyph(letterWGlyph) : ascent); 113 113 } 114 114 … … 209 209 } 210 210 211 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) const212 { 213 ASSERT(font Data->isCustomFont());214 ASSERT(font Data->isSVGFont());211 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* font) const 212 { 213 ASSERT(font->isCustomFont()); 214 ASSERT(font->isSVGFont()); 215 215 216 216 SVGFontFaceElement* fontFaceElement = this->svgFontFaceElement(); … … 221 221 222 222 if (bufferLength == length) 223 return fillBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font Data);223 return fillBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font); 224 224 225 225 ASSERT(bufferLength == 2 * length); 226 return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font Data);227 } 228 229 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontData) const226 return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font); 227 } 228 229 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const Font* font) const 230 230 { 231 231 bool haveGlyphs = false; … … 244 244 // only possible within the context of a string (eg. arabic form matching). 245 245 haveGlyphs = true; 246 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font Data);246 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font); 247 247 glyphs.clear(); 248 248 } … … 251 251 } 252 252 253 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontData) const253 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const Font* font) const 254 254 { 255 255 bool haveGlyphs = false; … … 269 269 // only possible within the context of a string (eg. arabic form matching). 270 270 haveGlyphs = true; 271 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font Data);271 pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font); 272 272 glyphs.clear(); 273 273 } -
trunk/Source/WebCore/svg/SVGFontData.h
r177975 r178940 22 22 23 23 #if ENABLE(SVG_FONTS) 24 #include " SimpleFontData.h"24 #include "Font.h" 25 25 26 26 namespace WebCore { … … 29 29 class SVGFontFaceElement; 30 30 31 class SVGFontData : public SimpleFontData::SVGData {31 class SVGFontData : public Font::SVGData { 32 32 public: 33 33 explicit SVGFontData(SVGFontFaceElement*); 34 34 virtual ~SVGFontData() { } 35 35 36 virtual void initializeFont Data(SimpleFontData*, float fontSize) override;36 virtual void initializeFont(Font*, float fontSize) override; 37 37 virtual float widthForSVGGlyph(Glyph, float fontSize) const override; 38 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const override;38 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font*) const override; 39 39 40 40 bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const; … … 51 51 52 52 private: 53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) const; 54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const Font*) const; 55 55 56 56 bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, TypesettingFeatures) const = delete; -
trunk/Source/WebCore/svg/SVGFontElement.h
r178048 r178940 77 77 float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; 78 78 79 // Used by SimpleFontData/WidthIterator.79 // Used by Font/WidthIterator. 80 80 SVGGlyph svgGlyphForGlyph(Glyph); 81 81 Glyph missingGlyph(); -
trunk/Source/WebKit/ios/Misc/EmojiFallbackFontSelector.cpp
r178394 r178940 28 28 #include "EmojiFallbackFontSelector.h" 29 29 30 #include <WebCore/Font.h> 30 31 #include <WebCore/FontCache.h> 31 #include <WebCore/SimpleFontData.h>32 32 #include <wtf/Assertions.h> 33 33 #include <wtf/text/AtomicString.h> … … 35 35 using namespace WebCore; 36 36 37 PassRefPtr< SimpleFontData> EmojiFallbackFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t)37 PassRefPtr<Font> EmojiFallbackFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t) 38 38 { 39 39 DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, appleColorEmoji, ("Apple Color Emoji")); 40 RefPtr< SimpleFontData> fontData = fontCache().fontForFamily(fontDescription, appleColorEmoji);40 RefPtr<Font> fontData = fontCache().fontForFamily(fontDescription, appleColorEmoji); 41 41 if (!fontData) { 42 42 LOG_ERROR("Failed to get \"Apple Color Emoji\" from the font cache. Using the last resort fallback font instead."); -
trunk/Source/WebKit/ios/Misc/EmojiFallbackFontSelector.h
r178394 r178940 36 36 virtual WebCore::FontRanges fontRangesForFamily(const WebCore::FontDescription&, const AtomicString&) override { ASSERT_NOT_REACHED(); return WebCore::FontRanges(); } 37 37 virtual bool resolvesFamilyFor(const WebCore::FontDescription&) const override { ASSERT_NOT_REACHED(); return false; } 38 virtual size_t fallbackFont DataCount() override { return 1; };39 virtual PassRefPtr<WebCore:: SimpleFontData> fallbackFontDataAt(const WebCore::FontDescription&, size_t) override;38 virtual size_t fallbackFontCount() override { return 1; }; 39 virtual PassRefPtr<WebCore::Font> fallbackFontAt(const WebCore::FontDescription&, size_t) override; 40 40 41 41 virtual void registerForInvalidationCallbacks(WebCore::FontSelectorClient*) override { } -
trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm
r177876 r178940 148 148 + (size_t)cachedFontDataCount 149 149 { 150 return fontCache().font DataCount();150 return fontCache().fontCount(); 151 151 } 152 152 153 153 + (size_t)cachedFontDataInactiveCount 154 154 { 155 return fontCache().inactiveFont DataCount();155 return fontCache().inactiveFontCount(); 156 156 } 157 157 -
trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm
r178510 r178940 29 29 #import <WebCore/ChromeClient.h> 30 30 #import <WebCore/EventHandler.h> 31 #import <WebCore/Font.h> 31 32 #import <WebCore/Frame.h> 32 33 #import <WebCore/FrameView.h> 33 34 #import <WebCore/Page.h> 34 35 #import <WebCore/PopupMenuClient.h> 35 #import <WebCore/SimpleFontData.h>36 36 #import <WebCore/WebCoreSystemInterface.h> 37 37 … … 82 82 RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]); 83 83 if (style.font() != FontCascade()) { 84 NSFont *font = style.font().primaryFont Data().getNSFont();84 NSFont *font = style.font().primaryFont().getNSFont(); 85 85 if (!font) { 86 CGFloat size = style.font().primaryFont Data().platformData().size();86 CGFloat size = style.font().primaryFont().platformData().size(); 87 87 font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size]; 88 88 } … … 149 149 150 150 NSPoint location; 151 NSFont* font = m_client->menuStyle().font().primaryFont Data().getNSFont();151 NSFont* font = m_client->menuStyle().font().primaryFont().getNSFont(); 152 152 153 153 // These values were borrowed from AppKit to match their placement of the menu. -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r178575 r178940 115 115 #import <WebCore/EditorClient.h> 116 116 #import <WebCore/FocusController.h> 117 #import <WebCore/Font.h> 117 118 #import <WebCore/FrameSelection.h> 118 119 #import <WebCore/HistoryController.h> 119 120 #import <WebCore/NodeTraversal.h> 120 121 #import <WebCore/RenderLayer.h> 121 #import <WebCore/SimpleFontData.h>122 122 #import <WebCore/TextResourceDecoder.h> 123 123 #import <WebCore/WAKScrollView.h> … … 1870 1870 CTFontRef font = nil; 1871 1871 if (_private->coreFrame) { 1872 const SimpleFontData* fd = _private->coreFrame->editor().fontForSelection(multipleFonts); 1872 const Font 1873 * fd = _private->coreFrame->editor().fontForSelection(multipleFonts); 1873 1874 if (fd) 1874 1875 font = fd->getCTFont(); -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r178434 r178940 93 93 #import <WebCore/FloatRect.h> 94 94 #import <WebCore/FocusController.h> 95 #import <WebCore/Font.h> 95 96 #import <WebCore/FontCache.h> 96 97 #import <WebCore/Frame.h> … … 113 114 #import <WebCore/RuntimeApplicationChecks.h> 114 115 #import <WebCore/SharedBuffer.h> 115 #import <WebCore/SimpleFontData.h>116 116 #import <WebCore/StyleProperties.h> 117 117 #import <WebCore/Text.h> … … 4879 4879 fontDescription.setWeight(bold ? FontWeight900 : FontWeight500); 4880 4880 fontDescription.setSpecifiedSize(pointSize); 4881 RefPtr< SimpleFontData> simpleFontData= fontCache().fontForFamily(fontDescription, familyName);4882 return [ simpleFontData->platformData().nsFont() fontName];4881 RefPtr<Font> font = fontCache().fontForFamily(fontDescription, familyName); 4882 return [font->platformData().nsFont() fontName]; 4883 4883 } 4884 4884 … … 5443 5443 NSFont *font = nil; 5444 5444 if (Frame* coreFrame = core([self _frame])) { 5445 if (const SimpleFontData* fd = coreFrame->editor().fontForSelection(multipleFonts))5445 if (const Font* fd = coreFrame->editor().fontForSelection(multipleFonts)) 5446 5446 font = fd->getNSFont(); 5447 5447 } -
trunk/Source/WebKit/win/DOMCoreClasses.cpp
r178525 r178940 38 38 #include <WebCore/DragImage.h> 39 39 #include <WebCore/Element.h> 40 #include <WebCore/Font.h> 40 41 #include <WebCore/FontCascade.h> 41 42 #include <WebCore/Frame.h> … … 49 50 #include <WebCore/RenderElement.h> 50 51 #include <WebCore/RenderTreeAsText.h> 51 #include <WebCore/SimpleFontData.h>52 52 53 53 #include <initguid.h> -
trunk/Source/WebKit/win/WebCoreStatistics.cpp
r177876 r178940 216 216 if (!count) 217 217 return E_POINTER; 218 *count = (UINT) fontCache().font DataCount();218 *count = (UINT) fontCache().fontCount(); 219 219 return S_OK; 220 220 } … … 225 225 if (!count) 226 226 return E_POINTER; 227 *count = (UINT) fontCache().inactiveFont DataCount();227 *count = (UINT) fontCache().inactiveFontCount(); 228 228 return S_OK; 229 229 } -
trunk/Source/WebKit/win/WebView.cpp
r178849 r178940 97 97 #include <WebCore/FloatQuad.h> 98 98 #include <WebCore/FocusController.h> 99 #include <WebCore/Font.h> 99 100 #include <WebCore/FrameLoader.h> 100 101 #include <WebCore/FrameSelection.h> … … 149 150 #include <WebCore/SecurityPolicy.h> 150 151 #include <WebCore/Settings.h> 151 #include <WebCore/SimpleFontData.h>152 152 #include <WebCore/SystemInfo.h> 153 153 #include <WebCore/WindowMessageBroadcaster.h> … … 5506 5506 HRESULT WebView::setShouldApplyMacFontAscentHack(BOOL b) 5507 5507 { 5508 SimpleFontData::setShouldApplyMacAscentHack(b);5508 Font::setShouldApplyMacAscentHack(b); 5509 5509 return S_OK; 5510 5510 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
r177955 r178940 40 40 #if USE(APPKIT) 41 41 // FIXME: font will be nil here for custom fonts, we should fix that. 42 NSFont *font = m_popupClient->menuStyle().font().primaryFont Data().getNSFont();42 NSFont *font = m_popupClient->menuStyle().font().primaryFont().getNSFont(); 43 43 if (!font) 44 44 return; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r178889 r178940 805 805 Node* nodeToRemove; 806 806 if (RenderStyle* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) { 807 CTFontRef font = style->fontCascade().primaryFont Data().getCTFont();807 CTFontRef font = style->fontCascade().primaryFont().getCTFont(); 808 808 CTFontSymbolicTraits traits = font ? CTFontGetSymbolicTraits(font) : 0; 809 809 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r178820 r178940 1791 1791 bool multipleFonts = false; 1792 1792 CTFontRef font = nil; 1793 if ( const SimpleFontData* fontData= frame.editor().fontForSelection(multipleFonts))1794 font = fontData->getCTFont();1793 if (auto* coreFont = frame.editor().fontForSelection(multipleFonts)) 1794 font = coreFont->getCTFont(); 1795 1795 1796 1796 CGFloat fontSize = CTFontGetSize(font); -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r178634 r178940 928 928 929 929 // Gather font statistics. 930 data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().font DataCount());931 data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFont DataCount());930 data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().fontCount()); 931 data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFontCount()); 932 932 933 933 // Gather glyph page statistics.
Note:
See TracChangeset
for help on using the changeset viewer.