Changeset 178940 in webkit


Ignore:
Timestamp:
Jan 22, 2015, 1:57:04 PM (11 years ago)
Author:
Antti Koivisto
Message:

Rename SimpleFontData to Font
https://bugs.webkit.org/show_bug.cgi?id=140496

Reviewed by Zalan Bujtas.

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

Location:
trunk/Source
Files:
118 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r178715 r178940  
    20552055    platform/graphics/FloatRoundedRect.cpp
    20562056    platform/graphics/FloatSize.cpp
     2057    platform/graphics/Font.cpp
    20572058    platform/graphics/FontCache.cpp
    20582059    platform/graphics/FontCascade.cpp
     
    20902091    platform/graphics/SVGGlyph.cpp
    20912092    platform/graphics/ShadowBlur.cpp
    2092     platform/graphics/SimpleFontData.cpp
    20932093    platform/graphics/StringTruncator.cpp
    20942094    platform/graphics/SurrogatePairAwareTextIterator.cpp
  • trunk/Source/WebCore/ChangeLog

    r178939 r178940  
     12015-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
    1112015-01-22  Zalan Bujtas  <zalan@apple.com>
    212
  • trunk/Source/WebCore/WebCore.exp.in

    r178820 r178940  
    470470__ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
    471471__ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
    472 __ZN7WebCore14SimpleFontDataD1Ev
    473472__ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE
    474473__ZN7WebCore14TileController14setTilesOpaqueEb
     
    11801179__ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURL18CFURLComponentType
    11811180__ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
     1181__ZN7WebCore4FontD1Ev
    11821182__ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
    11831183__ZN7WebCore4IconD1Ev
     
    14931493__ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE
    14941494__ZN7WebCore9FontCache10invalidateEv
    1495 __ZN7WebCore9FontCache13fontDataCountEv
    14961495__ZN7WebCore9FontCache13fontForFamilyERKNS_15FontDescriptionERKN3WTF12AtomicStringEb
    1497 __ZN7WebCore9FontCache21inactiveFontDataCountEv
     1496__ZN7WebCore9FontCache17inactiveFontCountEv
    14981497__ZN7WebCore9FontCache21purgeInactiveFontDataEi
    14991498__ZN7WebCore9FontCache29purgeInactiveFontDataIfNeededEv
     1499__ZN7WebCore9FontCache9fontCountEv
    15001500__ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
    15011501__ZN7WebCore9FrameTree7setNameERKN3WTF12AtomicStringE
     
    16351635__ZNK7WebCore10Credential7isEmptyEv
    16361636__ZNK7WebCore10FloatPointcv7CGPointEv
    1637 __ZNK7WebCore10FontRanges20fontDataForCharacterEi
    1638 __ZNK7WebCore10FontRanges21fontDataForFirstRangeEv
     1637__ZNK7WebCore10FontRanges16fontForCharacterEi
     1638__ZNK7WebCore10FontRanges17fontForFirstRangeEv
    16391639__ZNK7WebCore10LayoutRect8containsERKS0_
    16401640__ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringENS0_18AllowedPluginTypesE
     
    16661666__ZNK7WebCore10TimeRanges5startEjRi
    16671667__ZNK7WebCore10TimeRanges6lengthEv
    1668 __ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
     1668__ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_4FontENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
    16691669__ZNK7WebCore11FontCascade8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEiiNS0_24CustomFontNotReadyActionE
    16701670__ZNK7WebCore11FontCascadeeqERKS0_
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r178761 r178940  
    80288028    <ClCompile Include="..\platform\graphics\FloatRoundedRect.cpp" />
    80298029    <ClCompile Include="..\platform\graphics\FloatSize.cpp" />
     8030    <ClCompile Include="..\platform\graphics\Font.cpp" />
    80308031    <ClCompile Include="..\platform\graphics\FontCache.cpp" />
    80318032    <ClCompile Include="..\platform\graphics\FontCascade.cpp" />
     
    80708071    <ClCompile Include="..\platform\graphics\RoundedRect.cpp" />
    80718072    <ClCompile Include="..\platform\graphics\ShadowBlur.cpp" />
    8072     <ClCompile Include="..\platform\graphics\SimpleFontData.cpp" />
    80738073    <ClCompile Include="..\platform\graphics\TextRun.cpp" />
    80748074    <ClCompile Include="..\platform\graphics\TextTrackRepresentation.cpp" />
     
    1951719517    <ClInclude Include="..\platform\graphics\FloatSize.h" />
    1951819518    <ClInclude Include="..\platform\graphics\FloatSizeHash.h" />
     19519    <ClInclude Include="..\platform\graphics\Font.h" />
    1951919520    <ClInclude Include="..\platform\graphics\FontCache.h" />
    1952019521    <ClInclude Include="..\platform\graphics\FontCascade.h" />
     
    1956919570    <ClInclude Include="..\platform\graphics\RoundedRect.h" />
    1957019571    <ClInclude Include="..\platform\graphics\ShadowBlur.h" />
    19571     <ClInclude Include="..\platform\graphics\SimpleFontData.h" />
    1957219572    <ClInclude Include="..\platform\graphics\TextRun.h" />
    1957319573    <ClInclude Include="..\platform\graphics\TextTrackRepresentation.h" />
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r178927 r178940  
    47094709                B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA510D006CD600EF6F26 /* FontCache.cpp */; };
    47104710                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, ); }; };
    47134713                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
    47144714                B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */; };
     
    1209312093                B2C3DA510D006CD600EF6F26 /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; };
    1209412094                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>"; };
    1209712097                B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; };
    1209812098                B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontGlyphs.cpp; sourceTree = "<group>"; };
     
    2057320573                                0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */,
    2057420574                                0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
    20575                                 B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
    20576                                 B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
     20575                                B2C3DA530D006CD600EF6F26 /* Font.cpp */,
     20576                                B2C3DA540D006CD600EF6F26 /* Font.h */,
    2057720577                                CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */,
    2057820578                                CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */,
     
    2603526035                                97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */,
    2603626036                                93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
    26037                                 B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
     26037                                B2C3DA650D006CD600EF6F26 /* Font.h in Headers */,
    2603826038                                E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */,
    2603926039                                E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */,
     
    2946729467                                E45390460EAFD637003695C8 /* SharedTimerIOS.mm in Sources */,
    2946829468                                93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */,
    29469                                 B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,
     29469                                B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */,
    2947029470                                163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
    2947129471                                37E65950163B10C200EB4574 /* SimpleFontDataIOS.mm in Sources */,
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r178510 r178940  
    17591759   
    17601760    // set basic font info
    1761     AXAttributeStringSetFont(attrString, style.fontCascade().primaryFontData().getCTFont(), range);
     1761    AXAttributeStringSetFont(attrString, style.fontCascade().primaryFont().getCTFont(), range);
    17621762               
    17631763    int decor = style.textDecorationsInEffect();
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm

    r178510 r178940  
    4747#import "ColorMac.h"
    4848#import "ContextMenuController.h"
     49#import "Font.h"
    4950#import "FontCascade.h"
    5051#import "Frame.h"
     
    6465#import "RenderWidget.h"
    6566#import "ScrollView.h"
    66 #import "SimpleFontData.h"
    6767#import "TextCheckerClient.h"
    6868#import "TextCheckingHelper.h"
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r178510 r178940  
    4848#import "ContextMenuController.h"
    4949#import "Editor.h"
     50#import "Font.h"
    5051#import "FontCascade.h"
    5152#import "FrameLoaderClient.h"
     
    6566#import "RenderWidget.h"
    6667#import "ScrollView.h"
    67 #import "SimpleFontData.h"
    6868#import "TextCheckerClient.h"
    6969#import "TextCheckingHelper.h"
     
    849849   
    850850    // set basic font info
    851     AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFontData().getNSFont(), range);
     851    AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont().getNSFont(), range);
    852852   
    853853    // set basic colors
  • trunk/Source/WebCore/bindings/objc/DOM.mm

    r178510 r178940  
    670670    if (!renderer)
    671671        return nil;
    672     return renderer->style().fontCascade().primaryFontData().getNSFont();
     672    return renderer->style().fontCascade().primaryFont().getNSFont();
    673673}
    674674#else
     
    678678    if (!renderer)
    679679        return nil;
    680     return renderer->style().fontCascade().primaryFontData().getCTFont();
     680    return renderer->style().fontCascade().primaryFont().getCTFont();
    681681}
    682682#endif
  • trunk/Source/WebCore/css/CSSFontFace.cpp

    r171886 r178940  
    3131#include "CSSSegmentedFontFace.h"
    3232#include "Document.h"
     33#include "Font.h"
    3334#include "FontDescription.h"
    3435#include "FontLoader.h"
    3536#include "RuntimeEnabledFeatures.h"
    36 #include "SimpleFontData.h"
    3737
    3838namespace WebCore {
     
    109109}
    110110
    111 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
     111RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
    112112{
    113113    m_activeSource = 0;
     
    125125    size_t size = m_sources.size();
    126126    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)) {
    128128            m_activeSource = m_sources[i].get();
    129129#if ENABLE(FONT_LOAD_EVENTS)
  • trunk/Source/WebCore/css/CSSFontFace.h

    r165676 r178940  
    4141class CSSSegmentedFontFace;
    4242class FontDescription;
    43 class SimpleFontData;
     43class Font;
    4444
    4545class CSSFontFace : public RefCounted<CSSFontFace> {
     
    6666    void fontLoaded(CSSFontFaceSource*);
    6767
    68     PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
     68    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic);
    6969
    7070    struct UnicodeRange {
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r178292 r178940  
    3333#include "Document.h"
    3434#include "ElementIterator.h"
     35#include "Font.h"
    3536#include "FontCache.h"
    3637#include "FontDescription.h"
    37 #include "SimpleFontData.h"
    3838
    3939#if ENABLE(SVG_OTF_CONVERTER)
     
    7575void CSSFontFaceSource::pruneTable()
    7676{
    77     if (m_fontDataTable.isEmpty())
     77    if (m_fontTable.isEmpty())
    7878        return;
    7979
    80     m_fontDataTable.clear();
     80    m_fontTable.clear();
    8181}
    8282
     
    102102}
    103103
    104 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
     104RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
    105105{
    106106    // If the font hasn't loaded or an error occurred, then we've got nothing.
     
    113113#endif
    114114    ) {
    115         // We're local. Just return a SimpleFontData from the normal cache.
     115        // We're local. Just return a Font from the normal cache.
    116116        // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
    117117        return fontCache().fontForFamily(fontDescription, m_string, true);
    118118    }
    119119
    120     // See if we have a mapping in our FontData cache.
    121120    unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3
    122121                       | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
    123122
    124     RefPtr<SimpleFontData> fontData = m_fontDataTable.add(hashKey, nullptr).iterator->value;
    125     if (fontData)
    126         return fontData.release();
     123    RefPtr<Font> font = m_fontTable.add(hashKey, nullptr).iterator->value;
     124    if (font)
     125        return font.release();
    127126
    128127    // If we are still loading, then we let the system pick a font.
     
    137136                return nullptr;
    138137
    139             fontData = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);
     138            font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);
    140139        } else {
    141140#if ENABLE(SVG_FONTS)
     
    153152                    return nullptr;
    154153                std::unique_ptr<FontCustomPlatformData> customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
    155                 fontData = 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);
    156155#else
    157                 fontData = 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);
    158157#endif
    159158            }
     
    165164        fontSelector->beginLoadingFontSoon(m_font.get());
    166165
    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);
    169168        return WTF::move(placeholderFontCopyInLoadingState);
    170169    }
    171170
    172     return fontData.release();
     171    return font.release();
    173172}
    174173
  • trunk/Source/WebCore/css/CSSFontFaceSource.h

    r178292 r178940  
    4343class CSSFontFace;
    4444class CSSFontSelector;
     45class Font;
    4546class FontDescription;
    46 class SimpleFontData;
    4747
    4848class CSSFontFaceSource final : public CachedFontClient {
     
    6060    virtual void fontLoaded(CachedFont*) override;
    6161
    62     PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
     62    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
    6363
    6464    void pruneTable();
     
    8282    CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
    8383    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.
    8585
    8686#if ENABLE(SVG_OTF_CONVERTER)
  • trunk/Source/WebCore/css/CSSFontSelector.cpp

    r178388 r178940  
    4141#include "CachedResourceLoader.h"
    4242#include "Document.h"
     43#include "Font.h"
    4344#include "FontCache.h"
    4445#include "Frame.h"
     
    4748#include "SVGNames.h"
    4849#include "Settings.h"
    49 #include "SimpleFontData.h"
    5050#include "StyleProperties.h"
    5151#include "StyleResolver.h"
     
    613613}
    614614
    615 size_t CSSFontSelector::fallbackFontDataCount()
     615size_t CSSFontSelector::fallbackFontCount()
    616616{
    617617    if (!m_document)
     
    624624}
    625625
    626 PassRefPtr<SimpleFontData> CSSFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t index)
     626PassRefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t index)
    627627{
    628628    ASSERT_UNUSED(index, !index);
  • trunk/Source/WebCore/css/CSSFontSelector.h

    r178388 r178940  
    2828
    2929#include "CachedResourceHandle.h"
     30#include "Font.h"
    3031#include "FontSelector.h"
    31 #include "SimpleFontData.h"
    3232#include "Timer.h"
    3333#include <memory>
     
    6060
    6161    virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) override;
    62     virtual size_t fallbackFontDataCount() 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;
    6464    CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family);
    6565
  • trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp

    r178388 r178940  
    3131#include "CSSFontSelector.h"
    3232#include "Document.h"
     33#include "Font.h"
    3334#include "FontDescription.h"
    3435#include "RuntimeEnabledFeatures.h"
    35 #include "SimpleFontData.h"
    3636
    3737namespace WebCore {
     
    9191}
    9292
    93 static void appendFontDataWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<SimpleFontData>&& fontData, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)
     93static void appendFontWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<Font>&& font, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)
    9494{
    95     if (fontData->isLoading()) {
    96         ranges.appendRange(FontRanges::Range(0, 0, WTF::move(fontData)));
     95    if (font->isLoading()) {
     96        ranges.appendRange(FontRanges::Range(0, 0, WTF::move(font)));
    9797        return;
    9898    }
     
    100100    unsigned numRanges = unicodeRanges.size();
    101101    if (!numRanges) {
    102         ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(fontData)));
     102        ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(font)));
    103103        return;
    104104    }
    105105
    106106    for (unsigned j = 0; j < numRanges; ++j)
    107         ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), fontData.copyRef()));
     107        ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), font.copyRef()));
    108108}
    109109
     
    129129            bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
    130130            bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
    131             if (RefPtr<SimpleFontData> faceFontData = face->getFontData(fontDescription, syntheticBold, syntheticItalic))
    132                 appendFontDataWithInvalidUnicodeRangeIfLoading(fontRanges, faceFontData.releaseNonNull(), face->ranges());
     131            if (RefPtr<Font> faceFont = face->font(fontDescription, syntheticBold, syntheticItalic))
     132                appendFontWithInvalidUnicodeRangeIfLoading(fontRanges, faceFont.releaseNonNull(), face->ranges());
    133133        }
    134134    }
  • trunk/Source/WebCore/editing/Editor.h

    r177739 r178940  
    6565class Pasteboard;
    6666class SharedBuffer;
    67 class SimpleFontData;
     67class Font;
    6868class SpellCheckRequest;
    6969class SpellChecker;
     
    423423    WEBCORE_EXPORT static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove);
    424424    WEBCORE_EXPORT bool insertParagraphSeparatorInQuotedContent();
    425     WEBCORE_EXPORT const SimpleFontData* fontForSelection(bool&) const;
     425    WEBCORE_EXPORT const Font* fontForSelection(bool&) const;
    426426    WEBCORE_EXPORT NSDictionary *fontAttributesForSelectionStart() const;
    427427    WEBCORE_EXPORT String stringSelectionForPasteboard();
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r178510 r178940  
    11151115    if (!renderer)
    11161116        return nil;
    1117     return renderer->style().fontCascade().primaryFontData().getNSFont();
     1117    return renderer->style().fontCascade().primaryFont().getNSFont();
    11181118}
    11191119#else
     
    11231123    if (!renderer)
    11241124        return nil;
    1125     return (PlatformFont *)renderer->style().fontCascade().primaryFontData().getCTFont();
     1125    return (PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont();
    11261126}
    11271127#endif
     
    25952595        if (style.textDecorationsInEffect() & TextDecorationLineThrough)
    25962596            [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
    2597         if (NSFont *font = style.fontCascade().primaryFontData().getNSFont())
     2597        if (NSFont *font = style.fontCascade().primaryFont().getNSFont())
    25982598            [attrs.get() setObject:font forKey:NSFontAttributeName];
    25992599        else
    2600             [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFontData().platformData().size()] forKey:NSFontAttributeName];
     2600            [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont().platformData().size()] forKey:NSFontAttributeName];
    26012601        if (style.visitedDependentColor(CSSPropertyColor).alpha())
    26022602            [attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
  • trunk/Source/WebCore/editing/ios/EditorIOS.mm

    r178510 r178940  
    204204}
    205205
    206 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
     206const Font* Editor::fontForSelection(bool& hasMultipleFonts) const
    207207{
    208208    hasMultipleFonts = false;
     
    212212        RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
    213213
    214         const SimpleFontData* result = nullptr;
     214        const Font* result = nullptr;
    215215        if (style)
    216             result = &style->fontCascade().primaryFontData();
     216            result = &style->fontCascade().primaryFont();
    217217
    218218        if (nodeToRemove) {
     
    225225    }
    226226
    227     const SimpleFontData* font = 0;
     227    const Font* font = 0;
    228228    RefPtr<Range> range = m_frame.selection().toNormalizedRange();
    229229    if (Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode()) {
     
    236236                continue;
    237237            // 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();
    239239            if (!font)
    240240                font = &primaryFont;
     
    258258    NSMutableDictionary* result = [NSMutableDictionary dictionary];
    259259   
    260     CTFontRef font = style->fontCascade().primaryFontData().getCTFont();
     260    CTFontRef font = style->fontCascade().primaryFont().getCTFont();
    261261    if (font)
    262262        [result setObject:(id)font forKey:NSFontAttributeName];
  • trunk/Source/WebCore/editing/mac/EditorMac.mm

    r178510 r178940  
    106106}
    107107
    108 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
     108const Font* Editor::fontForSelection(bool& hasMultipleFonts) const
    109109{
    110110    hasMultipleFonts = false;
     
    114114        RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
    115115
    116         const SimpleFontData* result = nullptr;
     116        const Font* result = nullptr;
    117117        if (style)
    118             result = &style->fontCascade().primaryFontData();
     118            result = &style->fontCascade().primaryFont();
    119119
    120120        if (nodeToRemove)
     
    124124    }
    125125
    126     const SimpleFontData* font = 0;
     126    const Font* font = 0;
    127127    RefPtr<Range> range = m_frame.selection().toNormalizedRange();
    128128    Node* startNode = adjustedSelectionStartForStyleComputation(m_frame.selection().selection()).deprecatedNode();
     
    136136                continue;
    137137            // 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();
    139139            if (!font)
    140140                font = &primaryFont;
     
    161161        [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
    162162
    163     if (style->fontCascade().primaryFontData().getNSFont())
    164         [result setObject:style->fontCascade().primaryFontData().getNSFont() forKey:NSFontAttributeName];
     163    if (style->fontCascade().primaryFont().getNSFont())
     164        [result setObject:style->fontCascade().primaryFont().getNSFont() forKey:NSFontAttributeName];
    165165
    166166    if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
  • trunk/Source/WebCore/loader/cache/CachedFont.cpp

    r178628 r178940  
    100100bool CachedFont::ensureCustomFontData(SharedBuffer* data)
    101101{
    102     if (!m_fontData && !errorOccurred() && !isLoading() && data) {
     102    if (!m_fontCustomPlatformData && !errorOccurred() && !isLoading() && data) {
    103103        RefPtr<SharedBuffer> buffer(data);
    104104
     
    113113#endif
    114114
    115         m_fontData = buffer ? createFontCustomPlatformData(*buffer) : nullptr;
    116         m_hasCreatedFontDataWrappingResource = m_fontData && (buffer == m_data);
    117         if (!m_fontData)
     115        m_fontCustomPlatformData = buffer ? createFontCustomPlatformData(*buffer) : nullptr;
     116        m_hasCreatedFontDataWrappingResource = m_fontCustomPlatformData && (buffer == m_data);
     117        if (!m_fontCustomPlatformData)
    118118            setStatus(DecodeError);
    119119    }
    120120
    121     return m_fontData.get();
     121    return m_fontCustomPlatformData.get();
    122122}
    123123
    124 PassRefPtr<SimpleFontData> CachedFont::getFontData(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
     124RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
    125125{
    126     return SimpleFontData::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
     126    return Font::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
    127127        fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
    128128}
     
    130130FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
    131131{
    132     ASSERT(m_fontData);
    133     return m_fontData->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);
    134134}
    135135
    136136void CachedFont::allClientsRemoved()
    137137{
    138     m_fontData = nullptr;
     138    m_fontCustomPlatformData = nullptr;
    139139}
    140140
  • trunk/Source/WebCore/loader/cache/CachedFont.h

    r178628 r178940  
    2929#include "CachedResource.h"
    3030#include "CachedResourceClient.h"
     31#include "Font.h"
    3132#include "FontOrientation.h"
    3233#include "FontRenderingMode.h"
    3334#include "FontWidthVariant.h"
    34 #include "SimpleFontData.h"
    3535
    3636namespace WebCore {
     
    5353    virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI);
    5454
    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);
    5656
    5757protected:
     
    7171    virtual void allClientsRemoved() override;
    7272
    73     std::unique_ptr<FontCustomPlatformData> m_fontData;
     73    std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData;
    7474    bool m_loadInitiated;
    7575    bool m_hasCreatedFontDataWrappingResource;
  • trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp

    r178628 r178940  
    5252}
    5353
    54 PassRefPtr<SimpleFontData> CachedSVGFont::getFontData(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
     54RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
    5555{
    5656#if ENABLE(SVG_OTF_CONVERTER)
    5757    if (!externalSVG || firstFontFace(remoteURI))
    58         return CachedFont::getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
     58        return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
    5959#else
    6060    if (!externalSVG)
    61         return CachedFont::getFontData(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
     61        return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
    6262
    6363    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);
    6565#endif
    6666    return nullptr;
  • trunk/Source/WebCore/loader/cache/CachedSVGFont.h

    r178628 r178940  
    4141    virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override;
    4242   
    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;
    4444
    4545private:
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r178650 r178940  
    2929
    3030#include "config.h"
    31 #include "SimpleFontData.h"
     31#include "Font.h"
    3232
    3333#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
     
    5151const float emphasisMarkFontSizeMultiplier = 0.5f;
    5252
    53 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback)
     53Font::Font(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback)
    5454    : m_maxCharWidth(-1)
    5555    , m_avgCharWidth(-1)
     
    7777}
    7878
    79 SimpleFontData::SimpleFontData(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
     79Font::Font(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
    8080    : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic))
    8181    , m_svgData(WTF::move(svgData))
     
    9494#endif
    9595{
    96     m_svgData->initializeFontData(this, fontSize);
     96    m_svgData->initializeFont(this, fontSize);
    9797}
    9898
    9999// Estimates of avgCharWidth and maxCharWidth for platforms that don't support accessing these values from the font.
    100 void SimpleFontData::initCharWidths()
     100void Font::initCharWidths()
    101101{
    102102    auto* glyphPageZero = glyphPage(0);
     
    118118}
    119119
    120 void SimpleFontData::platformGlyphInit()
     120void Font::platformGlyphInit()
    121121{
    122122    auto* glyphPageZero = glyphPage(0);
     
    137137    // Nasty hack to determine if we should round or ceil space widths.
    138138    // 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.
    140140    m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
    141141    float width = widthForGlyph(m_spaceGlyph);
     
    148148    // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE.
    149149    // 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()
    151151    if (m_zeroWidthSpaceGlyph == m_spaceGlyph)
    152152        m_zeroWidthSpaceGlyph = 0;
    153153}
    154154
    155 SimpleFontData::~SimpleFontData()
     155Font::~Font()
    156156{
    157157    removeFromSystemFallbackCache();
    158158}
    159159
    160 static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     160static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* font)
    161161{
    162162#if ENABLE(SVG_FONTS)
    163     if (auto* svgData = fontData->svgData())
    164         return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, fontData);
    165 #endif
    166     bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, fontData);
     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);
    167167#if ENABLE(OPENTYPE_VERTICAL)
    168     if (hasGlyphs && fontData->verticalData())
    169         fontData->verticalData()->substituteWithVerticalGlyphs(fontData, &pageToFill, offset, length);
     168    if (hasGlyphs && font->verticalData())
     169        font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill, offset, length);
    170170#endif
    171171    return hasGlyphs;
    172172}
    173173
    174 static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const SimpleFontData* fontData)
     174static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font* font)
    175175{
    176176#if PLATFORM(IOS)
    177177    // 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()
    179179    // in <rdar://problem/12096835>.
    180     if (pageNumber == 6 && fontData->shouldNotBeUsedForArabic())
     180    if (pageNumber == 6 && font->shouldNotBeUsedForArabic())
    181181        return nullptr;
    182182#endif
     
    191191            buffer[i] = start + i;
    192192
    193         if (start == 0) {
     193        if (!start) {
    194194            // Control characters must not render at all.
    195195            for (unsigned i = 0; i < 0x20; ++i)
     
    236236    // for only 128 out of 256 characters.
    237237    RefPtr<GlyphPage> glyphPage;
    238     if (GlyphPage::mayUseMixedFontDataWhenFilling(buffer, bufferLength, fontData))
    239         glyphPage = GlyphPage::createForMixedFontData();
     238    if (GlyphPage::mayUseMixedFontsWhenFilling(buffer, bufferLength, font))
     239        glyphPage = GlyphPage::createForMixedFonts();
    240240    else
    241         glyphPage = GlyphPage::createForSingleFontData(fontData);
    242 
    243     bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, fontData);
     241        glyphPage = GlyphPage::createForSingleFont(font);
     242
     243    bool haveGlyphs = fillGlyphPage(*glyphPage, 0, GlyphPage::size, buffer, bufferLength, font);
    244244    if (!haveGlyphs)
    245245        return nullptr;
     
    249249}
    250250
    251 const GlyphPage* SimpleFontData::glyphPage(unsigned pageNumber) const
    252 {
    253     if (pageNumber == 0) {
     251const GlyphPage* Font::glyphPage(unsigned pageNumber) const
     252{
     253    if (!pageNumber) {
    254254        if (!m_glyphPageZero)
    255255            m_glyphPageZero = createAndFillGlyphPage(0, this);
     
    263263}
    264264
    265 Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
     265Glyph Font::glyphForCharacter(UChar32 character) const
    266266{
    267267    auto* page = glyphPage(character / GlyphPage::size);
     
    271271}
    272272
    273 GlyphData SimpleFontData::glyphDataForCharacter(UChar32 character) const
     273GlyphData Font::glyphDataForCharacter(UChar32 character) const
    274274{
    275275    auto* page = glyphPage(character / GlyphPage::size);
     
    279279}
    280280
    281 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() const
     281PassRefPtr<Font> Font::verticalRightOrientationFont() const
    282282{
    283283    if (!m_derivedFontData)
     
    291291}
    292292
    293 PassRefPtr<SimpleFontData> SimpleFontData::uprightOrientationFontData() const
     293PassRefPtr<Font> Font::uprightOrientationFont() const
    294294{
    295295    if (!m_derivedFontData)
     
    300300}
    301301
    302 PassRefPtr<SimpleFontData> SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
     302PassRefPtr<Font> Font::smallCapsFont(const FontDescription& fontDescription) const
    303303{
    304304    if (!m_derivedFontData)
    305305        m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
    306306    if (!m_derivedFontData->smallCaps)
    307         m_derivedFontData->smallCaps = createScaledFontData(fontDescription, smallCapsFontSizeMultiplier);
     307        m_derivedFontData->smallCaps = createScaledFont(fontDescription, smallCapsFontSizeMultiplier);
    308308
    309309    return m_derivedFontData->smallCaps;
    310310}
    311311
    312 PassRefPtr<SimpleFontData> SimpleFontData::emphasisMarkFontData(const FontDescription& fontDescription) const
     312PassRefPtr<Font> Font::emphasisMarkFont(const FontDescription& fontDescription) const
    313313{
    314314    if (!m_derivedFontData)
    315315        m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
    316316    if (!m_derivedFontData->emphasisMark)
    317         m_derivedFontData->emphasisMark = createScaledFontData(fontDescription, emphasisMarkFontSizeMultiplier);
     317        m_derivedFontData->emphasisMark = createScaledFont(fontDescription, emphasisMarkFontSizeMultiplier);
    318318
    319319    return m_derivedFontData->emphasisMark;
    320320}
    321321
    322 PassRefPtr<SimpleFontData> SimpleFontData::brokenIdeographFontData() const
     322PassRefPtr<Font> Font::brokenIdeographFont() const
    323323{
    324324    if (!m_derivedFontData)
     
    331331}
    332332
    333 PassRefPtr<SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const
     333PassRefPtr<Font> Font::nonSyntheticItalicFont() const
    334334{
    335335    if (!m_derivedFontData)
     
    346346
    347347#ifndef NDEBUG
    348 String SimpleFontData::description() const
     348String Font::description() const
    349349{
    350350    if (isSVGFont())
     
    357357#endif
    358358
    359 const OpenTypeMathData* SimpleFontData::mathData() const
     359const OpenTypeMathData* Font::mathData() const
    360360{
    361361    if (m_isLoading)
     
    369369}
    370370
    371 SimpleFontData::DerivedFontData::~DerivedFontData()
    372 {
    373 }
    374 
    375 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
     371Font::DerivedFontData::~DerivedFontData()
     372{
     373}
     374
     375PassRefPtr<Font> Font::createScaledFont(const FontDescription& fontDescription, float scaleFactor) const
    376376{
    377377    if (isSVGFont())
    378378        return nullptr;
    379379
    380     return platformCreateScaledFontData(fontDescription, scaleFactor);
    381 }
    382 
    383 bool SimpleFontData::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
     380    return platformCreateScaledFont(fontDescription, scaleFactor);
     381}
     382
     383bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
    384384{
    385385    // We need to handle transforms on SVG fonts internally, since they are rendered internally.
     
    397397}
    398398
    399 // FontDatas 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.
     400typedef HashMap<std::pair<UChar32, unsigned>, Font*> CharacterFallbackMap;
     401typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache;
    402402
    403403static SystemFallbackCache& systemFallbackCache()
     
    407407}
    408408
    409 RefPtr<SimpleFontData> SimpleFontData::systemFallbackFontDataForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const
     409RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const
    410410{
    411411    auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap());
     
    414414    auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr);
    415415
    416     SimpleFontData*& fallbackFontData = characterAddResult.iterator->value;
    417 
    418     if (!fallbackFontData) {
     416    Font*& fallbackFont = characterAddResult.iterator->value;
     417
     418    if (!fallbackFont) {
    419419        UChar codeUnits[2];
    420420        int codeUnitsLength;
     
    428428        }
    429429
    430         fallbackFontData = fontCache().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
    431         if (fallbackFontData)
    432             fallbackFontData->m_isUsedInSystemFallbackCache = true;
    433     }
    434 
    435     return fallbackFontData;
    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
     438void Font::removeFromSystemFallbackCache()
    439439{
    440440    systemFallbackCache().remove(this);
  • trunk/Source/WebCore/platform/graphics/Font.h

    r178650 r178940  
    2222 */
    2323
    24 #ifndef SimpleFontData_h
    25 #define SimpleFontData_h
    26 
     24#ifndef Font_h
     25#define Font_h
     26
     27#include "FloatRect.h"
    2728#include "FontBaseline.h"
    2829#include "FontMetrics.h"
    2930#include "FontPlatformData.h"
    30 #include "FloatRect.h"
    3131#include "GlyphBuffer.h"
    3232#include "GlyphMetricsMap.h"
     
    6565struct WidthIterator;
    6666
    67 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
     67enum FontVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
    6868enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
    6969
    70 class SimpleFontData : public RefCounted<SimpleFontData> {
     70class Font : public RefCounted<Font> {
    7171public:
    7272    class SVGData {
     
    7575        virtual ~SVGData() { }
    7676
    77         virtual void initializeFontData(SimpleFontData*, float fontSize) = 0;
     77        virtual void initializeFont(Font*, float fontSize) = 0;
    7878        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;
    8080    };
    8181
    8282    // 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)
    8484    {
    85         return adoptRef(*new SimpleFontData(platformData, isCustomFont, isLoading, isTextOrientationFallback));
     85        return adoptRef(*new Font(platformData, isCustomFont, isLoading, isTextOrientationFallback));
    8686    }
    8787
    8888    // 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)
    9090    {
    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); }
    9797
    9898    const FontPlatformData& platformData() const { return m_platformData; }
     
    102102#endif
    103103
    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) const
     104    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
    110110    {
    111111        switch (variant) {
    112112        case SmallCapsVariant:
    113             return smallCapsFontData(description);
     113            return smallCapsFont(description);
    114114        case EmphasisMarkVariant:
    115             return emphasisMarkFontData(description);
     115            return emphasisMarkFont(description);
    116116        case BrokenIdeographVariant:
    117             return brokenIdeographFontData();
     117            return brokenIdeographFont();
    118118        case AutoVariant:
    119119        case NormalVariant:
     
    121121        }
    122122        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;
    128128
    129129    bool hasVerticalGlyphs() const { return m_hasVerticalGlyphs; }
     
    141141
    142142    FloatRect boundsForGlyph(Glyph) const;
    143     float widthForGlyph(Glyph glyph) const;
     143    float widthForGlyph(Glyph) const;
    144144    FloatRect platformBoundsForGlyph(Glyph) const;
    145145    float platformWidthForGlyph(Glyph) const;
     
    168168    Glyph glyphForCharacter(UChar32) const;
    169169
    170     RefPtr<SimpleFontData> systemFallbackFontDataForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;
     170    RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;
    171171
    172172    const GlyphPage* glyphPage(unsigned pageNumber) const;
     
    186186
    187187#if USE(APPKIT)
    188     const SimpleFontData* compositeFontReferenceFontData(NSFont *key) const;
     188    const Font* compositeFontReferenceFont(NSFont *key) const;
    189189    NSFont* getNSFont() const { return m_platformData.nsFont(); }
    190190#endif
     
    214214
    215215private:
    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);
    219219
    220220    void platformInit();
     
    225225    void initCharWidths();
    226226
    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;
    229229
    230230    void removeFromSystemFallbackCache();
     
    233233    void initGDIFont();
    234234    void platformCommonDestroy();
    235     FloatRect boundsForGDIGlyph(Glyph glyph) const;
    236     float widthForGDIGlyph(Glyph glyph) const;
     235    FloatRect boundsForGDIGlyph(Glyph) const;
     236    float widthForGDIGlyph(Glyph) const;
    237237#endif
    238238
    239239#if USE(CG)
    240     bool canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const;
     240    bool canUseFastGlyphAdvanceGetter(Glyph, CGSize& advance, bool& populatedAdvance) const;
    241241    CGFontRenderingStyle renderingStyle() const;
    242242    bool advanceForColorBitmapFont(Glyph, CGSize& result) const; // Returns true if the font is a color bitmap font
     
    256256
    257257    bool m_treatAsFixedPitch;
    258     bool m_isCustomFont;  // Whether or not we are custom font loaded via @font-face
     258    bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face
    259259    bool m_isLoading; // Whether or not this custom font is still in the act of loading.
    260260
     
    285285
    286286        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;
    293293#if USE(APPKIT)
    294         HashMap<NSFont*, RefPtr<SimpleFontData>> compositeFontReferences;
     294        HashMap<NSFont*, RefPtr<Font>> compositeFontReferences;
    295295#endif
    296296    };
     
    320320};
    321321
    322 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const
     322ALWAYS_INLINE FloatRect Font::boundsForGlyph(Glyph glyph) const
    323323{
    324324    if (isZeroWidthSpaceGlyph(glyph))
     
    339339}
    340340
    341 ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const
     341ALWAYS_INLINE float Font::widthForGlyph(Glyph glyph) const
    342342{
    343343    if (isZeroWidthSpaceGlyph(glyph))
     
    367367} // namespace WebCore
    368368
    369 #endif // SimpleFontData_h
     369#endif // Font_h
  • trunk/Source/WebCore/platform/graphics/FontCache.cpp

    r178853 r178940  
    5353
    5454// FIXME: We may be able to simplify this code using C++11 threading primitives, including std::call_once().
    55 static pthread_mutex_t fontDataLock;
     55static pthread_mutex_t fontLock;
    5656
    5757static void initFontCacheLockOnce()
     
    6060    pthread_mutexattr_init(&mutexAttribute);
    6161    pthread_mutexattr_settype(&mutexAttribute, PTHREAD_MUTEX_RECURSIVE);
    62     pthread_mutex_init(&fontDataLock, &mutexAttribute);
     62    pthread_mutex_init(&fontLock, &mutexAttribute);
    6363    pthread_mutexattr_destroy(&mutexAttribute);
    6464}
     
    7272    {
    7373        pthread_once(&initFontLockControl, initFontCacheLockOnce);
    74         int lockcode = pthread_mutex_lock(&fontDataLock);
    75         ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontDataLock 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);   
    7676    }
    7777    ~FontLocker()
    7878    {
    79         int lockcode = pthread_mutex_unlock(&fontDataLock);
    80         ASSERT_WITH_MESSAGE_UNUSED(lockcode, !lockcode, "fontDataLock 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);
    8181    }
    8282};
     
    360360};
    361361
    362 typedef HashMap<FontPlatformData, RefPtr<SimpleFontData>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
     362typedef HashMap<FontPlatformData, RefPtr<Font>, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
    363363
    364364static FontDataCache& cachedFonts()
     
    380380const int cTargetUnderMemoryPressureInactiveFontData = 30;
    381381
    382 RefPtr<SimpleFontData> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
     382RefPtr<Font> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
    383383{
    384384    if (!m_purgeTimer.isActive())
     
    392392}
    393393
    394 Ref<SimpleFontData> FontCache::fontForPlatformData(const FontPlatformData& platformData)
     394Ref<Font> FontCache::fontForPlatformData(const FontPlatformData& platformData)
    395395{
    396396#if PLATFORM(IOS)
     
    400400    auto addResult = cachedFonts().add(platformData, nullptr);
    401401    if (addResult.isNewEntry)
    402         addResult.iterator->value = SimpleFontData::create(platformData);
     402        addResult.iterator->value = Font::create(platformData);
    403403
    404404    return *addResult.iterator->value;
     
    417417    if (cachedFonts().size() < inactiveFontDataLimit)
    418418        return;
    419     int inactiveCount = inactiveFontDataCount();
     419    int inactiveCount = inactiveFontCount();
    420420    if (inactiveCount <= inactiveFontDataLimit)
    421421        return;
     
    435435
    436436    while (purgeCount) {
    437         Vector<RefPtr<SimpleFontData>, 20> fontsToDelete;
     437        Vector<RefPtr<Font>, 20> fontsToDelete;
    438438        for (auto& font : cachedFonts().values()) {
    439439            if (!font->hasOneRef())
     
    467467                verticalData->m_inFontCache = false;
    468468        }
    469         for (auto& fontData : cachedFonts().values()) {
    470             auto* verticalData = const_cast<OpenTypeVerticalData*>(fontData->verticalData());
     469        for (auto& font : cachedFonts().values()) {
     470            auto* verticalData = const_cast<OpenTypeVerticalData*>(font->verticalData());
    471471            if (verticalData)
    472472                verticalData->m_inFontCache = true;
     
    484484}
    485485
    486 size_t FontCache::fontDataCount()
     486size_t FontCache::fontCount()
    487487{
    488488    return cachedFonts().size();
    489489}
    490490
    491 size_t FontCache::inactiveFontDataCount()
     491size_t FontCache::inactiveFontCount()
    492492{
    493493#if PLATFORM(IOS)
     
    552552
    553553#if !PLATFORM(COCOA)
    554 RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription&)
     554RefPtr<Font> FontCache::similarFont(const FontDescription&)
    555555{
    556556    return nullptr;
  • trunk/Source/WebCore/platform/graphics/FontCache.h

    r178510 r178940  
    5656class FontSelector;
    5757class OpenTypeVerticalData;
    58 class SimpleFontData;
     58class Font;
    5959
    6060#if PLATFORM(WIN)
     
    112112
    113113    // 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);
    115115
    116116    // Also implemented by the platform.
     
    129129    void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
    130130
    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&);
    135135
    136136    void addClient(FontSelector*);
     
    140140    WEBCORE_EXPORT void invalidate();
    141141
    142     WEBCORE_EXPORT size_t fontDataCount();
    143     WEBCORE_EXPORT size_t inactiveFontDataCount();
     142    WEBCORE_EXPORT size_t fontCount();
     143    WEBCORE_EXPORT size_t inactiveFontCount();
    144144    WEBCORE_EXPORT void purgeInactiveFontData(int count = INT_MAX);
    145145
    146146#if PLATFORM(WIN)
    147     RefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
     147    RefPtr<Font> fontFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
    148148#endif
    149149
     
    174174#if PLATFORM(IOS)
    175175    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);
    177177#endif
    178178    std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family);
     
    183183    friend class ComplexTextController;
    184184#endif
    185     friend class SimpleFontData;
     185    friend class Font;
    186186};
    187187
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r178853 r178940  
    125125
    126126// FIXME: We should make this constructor platform-independent.
    127 FontCascade::FontCascade(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
    128     : m_glyphs(FontGlyphs::createForPlatformFont(fontData))
     127FontCascade::FontCascade(const FontPlatformData& font, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
     128    : m_glyphs(FontGlyphs::createForPlatformFont(font))
    129129    , m_letterSpacing(0)
    130130    , m_wordSpacing(0)
     
    135135    m_fontDescription.setFontSmoothing(fontSmoothingMode);
    136136#if PLATFORM(IOS)
    137     m_fontDescription.setSpecifiedSize(CTFontGetSize(fontData.font()));
    138     m_fontDescription.setComputedSize(CTFontGetSize(fontData.font()));
    139     m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitItalic);
    140     m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.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);
    141141#endif
    142142}
     
    144144// FIXME: We should make this constructor platform-independent.
    145145#if PLATFORM(IOS)
    146 FontCascade::FontCascade(const FontPlatformData& fontData, PassRefPtr<FontSelector> fontSelector)
    147     : m_glyphs(FontGlyphs::createForPlatformFont(fontData))
     146FontCascade::FontCascade(const FontPlatformData& font, PassRefPtr<FontSelector> fontSelector)
     147    : m_glyphs(FontGlyphs::createForPlatformFont(font))
    148148    , m_letterSpacing(0)
    149149    , m_wordSpacing(0)
    150150    , m_typesettingFeatures(computeTypesettingFeatures())
    151151{
    152     CTFontRef primaryFont = fontData.font();
     152    CTFontRef primaryFont = font.font();
    153153    m_fontDescription.setSpecifiedSize(CTFontGetSize(primaryFont));
    154154    m_fontDescription.setComputedSize(CTFontGetSize(primaryFont));
    155155    m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitItalic);
    156156    m_fontDescription.setWeight((CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
    157     m_fontDescription.setUsePrinterFont(fontData.isPrinterFont());
     157    m_fontDescription.setUsePrinterFont(font.isPrinterFont());
    158158    m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get());
    159159}
     
    372372}
    373373
    374 float FontCascade::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     374float FontCascade::width(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    375375{
    376376    CodePath codePathToUse = codePath(run);
     
    390390        return *cacheEntry;
    391391
    392     HashSet<const SimpleFontData*> localFallbackFonts;
     392    HashSet<const Font*> localFallbackFonts;
    393393    if (!fallbackFonts)
    394394        fallbackFonts = &localFallbackFonts;
     
    417417}
    418418
    419 GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant) const
     419GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontVariant variant) const
    420420{
    421421    if (variant == AutoVariant) {
    422         if (m_fontDescription.smallCaps() && !primaryFontData().isSVGFont()) {
     422        if (m_fontDescription.smallCaps() && !primaryFont().isSVGFont()) {
    423423            UChar32 upperC = u_toupper(c);
    424424            if (upperC != c) {
     
    447447}
    448448
    449 float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const SimpleFontData*>*)
     449float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*)
    450450{
    451451    ASSERT_NOT_REACHED();
     
    506506#if PLATFORM(MAC) || PLATFORM(IOS)
    507507    // Internal fonts on OS X and iOS also have an invalid entry in the table for avgCharWidth.
    508     if (primaryFontDataIsSystemFont())
     508    if (primaryFontIsSystemFont())
    509509        return false;
    510510#endif
     
    526526    bool success = hasValidAverageCharWidth();
    527527    if (success)
    528         width = roundf(primaryFontData().avgCharWidth()); // FIXME: primaryFontData() might not correspond to firstFamily().
     528        width = roundf(primaryFont().avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily().
    529529    return success;
    530530}
     
    11741174        return 0;
    11751175
    1176     const SimpleFontData* markFontData = markGlyphData.fontData;
     1176    const Font* markFontData = markGlyphData.font;
    11771177    ASSERT(markFontData);
    11781178    if (!markFontData)
     
    11881188        return 0;
    11891189
    1190     const SimpleFontData* markFontData = markGlyphData.fontData;
     1190    const Font* markFontData = markGlyphData.font;
    11911191    ASSERT(markFontData);
    11921192    if (!markFontData)
     
    12021202        return 0;
    12031203
    1204     const SimpleFontData* markFontData = markGlyphData.fontData;
     1204    const Font* markFontData = markGlyphData.font;
    12051205    ASSERT(markFontData);
    12061206    if (!markFontData)
     
    12741274
    12751275    // 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);
    12771277    FloatSize offset = glyphBuffer.offsetAt(0);
    12781278    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
     
    12851285#endif
    12861286    while (nextGlyph < glyphBuffer.size()) {
    1287         const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
     1287        const Font* nextFontData = glyphBuffer.fontAt(nextGlyph);
    12881288        FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
    12891289
     
    13181318}
    13191319
    1320 inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)
     1320inline static float offsetToMiddleOfGlyph(const Font* fontData, Glyph glyph)
    13211321{
    13221322    if (fontData->platformData().orientation() == Horizontal) {
     
    13301330inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
    13311331{
    1332     return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
     1332    return offsetToMiddleOfGlyph(glyphBuffer.fontAt(i), glyphBuffer.glyphAt(i));
    13331333}
    13341334
     
    13391339        return;
    13401340
    1341     const SimpleFontData* markFontData = markGlyphData.fontData;
     1341    const Font* markFontData = markGlyphData.font;
    13421342    ASSERT(markFontData);
    13431343    if (!markFontData)
     
    13621362}
    13631363
    1364 float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     1364float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    13651365{
    13661366    WidthIterator it(this, run, fallbackFonts, glyphOverflow);
  • trunk/Source/WebCore/platform/graphics/FontCascade.h

    r178853 r178940  
    2727
    2828#include "DashArray.h"
     29#include "Font.h"
    2930#include "FontDescription.h"
    3031#include "FontGlyphs.h"
    3132#include "Path.h"
    32 #include "SimpleFontData.h"
    3333#include "TextDirection.h"
    3434#include "TypesettingFeatures.h"
     
    135135    enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
    136136    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;
    138138    void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1) const;
    139139
    140140    DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const;
    141141
    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;
    143143    float width(const TextRun&, int& charsConsumed, String& glyphName) const;
    144144
    145145    PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWhiteSpace) const;
    146146    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);
    148148
    149149    int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const;
     
    173173    bool isPlatformFont() const { return m_glyphs->isForPlatformFont(); }
    174174
    175     const FontMetrics& fontMetrics() const { return primaryFontData().fontMetrics(); }
    176     float spaceWidth() const { return primaryFontData().spaceWidth() + m_letterSpacing; }
    177     float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const;
    178     float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFontData(), 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); }
    179179    bool hasValidAverageCharWidth() const;
    180180    bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success
     
    184184    int emphasisMarkHeight(const AtomicString&) const;
    185185
    186     const SimpleFontData& primaryFontData() const;
     186    const Font& primaryFont() const;
    187187    const FontRanges& fallbackRangesAt(unsigned) const;
    188     GlyphData glyphDataForCharacter(UChar32, bool mirror, FontDataVariant = AutoVariant) const;
     188    GlyphData glyphDataForCharacter(UChar32, bool mirror, FontVariant = AutoVariant) const;
    189189   
    190190#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;
    192192#endif
    193193
     
    208208    static CodePath characterRangeCodePath(const UChar*, unsigned len);
    209209
    210     bool primaryFontDataIsSystemFont() const;
     210    bool primaryFontIsSystemFont() const;
    211211
    212212private:
     
    219219    void drawGlyphBuffer(GraphicsContext*, const TextRun&, const GlyphBuffer&, FloatPoint&) const;
    220220    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;
    222222    int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const;
    223223    void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, int from, int to) const;
     
    232232    float drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    233233    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;
    235235    int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
    236236    void adjustSelectionRectForComplexText(const TextRun&, LayoutRect& selectionRect, int from, int to) const;
     
    353353}
    354354
    355 inline const SimpleFontData& FontCascade::primaryFontData() const
     355inline const Font& FontCascade::primaryFont() const
    356356{
    357357    ASSERT(m_glyphs);
    358     return m_glyphs->primarySimpleFontData(m_fontDescription);
     358    return m_glyphs->primaryFont(m_fontDescription);
    359359}
    360360
     
    376376}
    377377
    378 inline float FontCascade::tabWidth(const SimpleFontData& fontData, unsigned tabSize, float position) const
     378inline float FontCascade::tabWidth(const Font& font, unsigned tabSize, float position) const
    379379{
    380380    if (!tabSize)
    381381        return letterSpacing();
    382     float tabWidth = tabSize * fontData.spaceWidth() + letterSpacing();
     382    float tabWidth = tabSize * font.spaceWidth() + letterSpacing();
    383383    float tabDeltaWidth = tabWidth - fmodf(position, tabWidth);
    384     return (tabDeltaWidth < fontData.spaceWidth() / 2) ? tabWidth : tabDeltaWidth;
     384    return (tabDeltaWidth < font.spaceWidth() / 2) ? tabWidth : tabDeltaWidth;
    385385}
    386386
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp

    r178853 r178940  
    3838
    3939FontGlyphs::FontGlyphs(PassRefPtr<FontSelector> fontSelector)
    40     : m_cachedPrimarySimpleFontData(0)
     40    : m_cachedPrimaryFont(0)
    4141    , m_fontSelector(fontSelector)
    4242    , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)
     
    4646
    4747FontGlyphs::FontGlyphs(const FontPlatformData& platformData)
    48     : m_cachedPrimarySimpleFontData(0)
     48    : m_cachedPrimaryFont(0)
    4949    , m_fontSelector(0)
    5050    , m_fontSelectorVersion(0)
     
    6464    unsigned numRanges = primaryRanges.size();
    6565    if (numRanges == 1)
    66         m_pitch = primaryRanges.rangeAt(0).fontData().pitch();
     66        m_pitch = primaryRanges.rangeAt(0).font().pitch();
    6767    else
    6868        m_pitch = VariablePitch;
     
    9797    // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the
    9898    // Geeza Pro font.
    99     return FontRanges(fontCache().similarFontPlatformData(description));
     99    return FontRanges(fontCache().similarFont(description));
    100100}
    101101
     
    127127
    128128        unsigned fontSelectorFallbackIndex = m_lastRealizedFallbackIndex - description.familyCount();
    129         if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontDataCount())
     129        if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontCount())
    130130            return fontRanges;
    131131        ++m_lastRealizedFallbackIndex;
    132         fontRanges = FontRanges(m_fontSelector->fallbackFontDataAt(description, fontSelectorFallbackIndex));
     132        fontRanges = FontRanges(m_fontSelector->fallbackFontAt(description, fontSelectorFallbackIndex));
    133133    }
    134134
     
    222222static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 character, GlyphData& data)
    223223{
    224     GlyphData nonItalicData = data.fontData->nonSyntheticItalicFontData()->glyphDataForCharacter(character);
    225     if (nonItalicData.fontData)
     224    GlyphData nonItalicData = data.font->nonSyntheticItalicFont()->glyphDataForCharacter(character);
     225    if (nonItalicData.font)
    226226        return nonItalicData;
    227227    return data;
     
    232232{
    233233    if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) {
    234         GlyphData uprightData = data.fontData->uprightOrientationFontData()->glyphDataForCharacter(character);
     234        GlyphData uprightData = data.font->uprightOrientationFont()->glyphDataForCharacter(character);
    235235        // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
    236236        if (data.glyph == uprightData.glyph)
     
    238238        // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that
    239239        // glyph, so we fall back to the upright data and use the horizontal glyph.
    240         if (uprightData.fontData)
     240        if (uprightData.font)
    241241            return uprightData;
    242242    } else if (orientation == NonCJKGlyphOrientationVerticalRight) {
    243         GlyphData verticalRightData = data.fontData->verticalRightOrientationFontData()->glyphDataForCharacter(character);
     243        GlyphData verticalRightData = data.font->verticalRightOrientationFont()->glyphDataForCharacter(character);
    244244        // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked
    245245        // into it.
     
    247247            return data;
    248248        // The glyphs are identical, meaning that we should just use the horizontal glyph.
    249         if (verticalRightData.fontData)
     249        if (verticalRightData.font)
    250250            return verticalRightData;
    251251    }
     
    253253}
    254254
    255 GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontDataVariant variant)
     255GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontVariant variant)
    256256{
    257257    // System fallback is character-dependent.
    258258    auto& primaryRanges = realizeFallbackRangesAt(description, 0);
    259     auto* originalFontData = primaryRanges.fontDataForCharacter(c);
    260     if (!originalFontData)
    261         originalFontData = &primaryRanges.fontDataForFirstRange();
    262 
    263     RefPtr<SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont);
    264     if (!systemFallbackFontData)
     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)
    265265        return GlyphData();
    266266
    267     if (systemFallbackFontData->platformData().orientation() == Vertical && !systemFallbackFontData->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))
     267    if (systemFallbackFont->platformData().orientation() == Vertical && !systemFallbackFont->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))
    268268        variant = BrokenIdeographVariant;
    269269
    270270    GlyphData fallbackGlyphData;
    271271    if (variant == NormalVariant)
    272         fallbackGlyphData = systemFallbackFontData->glyphDataForCharacter(c);
     272        fallbackGlyphData = systemFallbackFont->glyphDataForCharacter(c);
    273273    else
    274         fallbackGlyphData = systemFallbackFontData->variantFontData(description, variant)->glyphDataForCharacter(c);
    275 
    276     if (variant == NormalVariant && fallbackGlyphData.fontData) {
    277         if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.fontData->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())
    278278            fallbackGlyphData = glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), fallbackGlyphData);
    279279    }
     
    281281    // Keep the system fallback fonts we use alive.
    282282    if (fallbackGlyphData.glyph)
    283         m_systemFallbackFontDataSet.add(systemFallbackFontData.release());
     283        m_systemFallbackFontSet.add(systemFallbackFont.release());
    284284
    285285    return fallbackGlyphData;
    286286}
    287287
    288 GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontDataVariant variant, unsigned fallbackIndex)
     288GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontVariant variant, unsigned fallbackIndex)
    289289{
    290290    while (true) {
     
    292292        if (fontRanges.isNull())
    293293            break;
    294         auto* fontData = fontRanges.fontDataForCharacter(c);
    295         GlyphData data = fontData ? fontData->glyphDataForCharacter(c) : GlyphData();
    296         if (data.fontData) {
    297             // The variantFontData function 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.
    298298            // But if it does, we will just render the capital letter big.
    299             RefPtr<SimpleFontData> variantFontData = data.fontData->variantFontData(description, variant);
    300             if (!variantFontData)
     299            RefPtr<Font> variantFont = data.font->variantFont(description, variant);
     300            if (!variantFont)
    301301                return data;
    302302
    303             return variantFontData->glyphDataForCharacter(c);
     303            return variantFont->glyphDataForCharacter(c);
    304304        }
    305305    }
     
    316316        if (fontRanges.isNull())
    317317            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;
    320320        if (!page)
    321321            continue;
    322322        GlyphData data = page->glyphDataForCharacter(c);
    323         if (data.fontData) {
    324             if (data.fontData->platformData().orientation() == Vertical && !data.fontData->isTextOrientationFallback()) {
     323        if (data.font) {
     324            if (data.font->platformData().orientation() == Vertical && !data.font->isTextOrientationFallback()) {
    325325                if (!FontCascade::isCJKIdeographOrSymbol(c))
    326326                    return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data);
    327327
    328                 if (!data.fontData->hasVerticalGlyphs()) {
     328                if (!data.font->hasVerticalGlyphs()) {
    329329                    // Use the broken ideograph font data. The broken ideograph font will use the horizontal width of glyphs
    330330                    // to make sure you get a square (even for broken glyphs like symbols used for punctuation).
     
    332332                }
    333333#if PLATFORM(COCOA)
    334                 if (data.fontData->platformData().syntheticOblique())
     334                if (data.font->platformData().syntheticOblique())
    335335                    return glyphDataForCJKCharacterWithoutSyntheticItalic(c, data);
    336336#endif
     
    346346static RefPtr<GlyphPage> glyphPageFromFontRanges(unsigned pageNumber, const FontRanges& fontRanges)
    347347{
    348     const SimpleFontData* simpleFontData = nullptr;
     348    const Font* font = nullptr;
    349349    UChar32 pageRangeFrom = pageNumber * GlyphPage::size;
    350350    UChar32 pageRangeTo = pageRangeFrom + GlyphPage::size - 1;
     
    353353        if (range.to()) {
    354354            if (range.from() <= pageRangeFrom && pageRangeTo <= range.to())
    355                 simpleFontData = &range.fontData();
     355                font = &range.font();
    356356            break;
    357357        }
    358358    }
    359     if (!simpleFontData)
     359    if (!font)
    360360        return nullptr;
    361361
    362     if (simpleFontData->platformData().orientation() == Vertical)
     362    if (font->platformData().orientation() == Vertical)
    363363        return nullptr;
    364364
    365     return const_cast<GlyphPage*>(simpleFontData->glyphPage(pageNumber));
    366 }
    367 
    368 GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontDataVariant variant)
     365    return const_cast<GlyphPage*>(font->glyphPage(pageNumber));
     366}
     367
     368GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontVariant variant)
    369369{
    370370    ASSERT(isMainThread());
     
    383383    if (!glyphData.glyph) {
    384384        if (!cachedPage)
    385             cachedPage = GlyphPage::createForMixedFontData();
     385            cachedPage = GlyphPage::createForMixedFonts();
    386386        else if (cachedPage->isImmutable())
    387             cachedPage = GlyphPage::createCopyForMixedFontData(*cachedPage);
     387            cachedPage = GlyphPage::createCopyForMixedFonts(*cachedPage);
    388388
    389389        glyphData = glyphDataForNormalVariant(c, description);
    390         cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.fontData);
     390        cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font);
    391391    }
    392392    return glyphData;
     
    395395void FontGlyphs::pruneSystemFallbacks()
    396396{
    397     if (m_systemFallbackFontDataSet.isEmpty())
     397    if (m_systemFallbackFontSet.isEmpty())
    398398        return;
    399399    // Mutable glyph pages may reference fallback fonts.
     
    403403        return !keyAndValue.value->isImmutable();
    404404    });
    405     m_systemFallbackFontDataSet.clear();
    406 }
    407 
    408 }
     405    m_systemFallbackFontSet.clear();
     406}
     407
     408}
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.h

    r178853 r178940  
    2222#define FontGlyphs_h
    2323
     24#include "Font.h"
    2425#include "FontRanges.h"
    2526#include "FontSelector.h"
    2627#include "GlyphPage.h"
    27 #include "SimpleFontData.h"
    2828#include "WidthCache.h"
    2929#include <wtf/Forward.h>
     
    5252    bool isForPlatformFont() const { return m_isForPlatformFont; }
    5353
    54     GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontDataVariant);
     54    GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontVariant);
    5555
    5656    bool isFixedPitch(const FontDescription&);
     
    6767    const WidthCache& widthCache() const { return m_widthCache; }
    6868
    69     const SimpleFontData& primarySimpleFontData(const FontDescription&);
     69    const Font& primaryFont(const FontDescription&);
    7070    WEBCORE_EXPORT const FontRanges& realizeFallbackRangesAt(const FontDescription&, unsigned fallbackIndex);
    7171
     
    7676    FontGlyphs(const FontPlatformData&);
    7777
    78     GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontDataVariant);
     78    GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontVariant);
    7979    GlyphData glyphDataForNormalVariant(UChar32, const FontDescription&);
    80     GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontDataVariant, unsigned fallbackIndex);
     80    GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontVariant, unsigned fallbackIndex);
    8181
    8282    Vector<FontRanges, 1> m_realizedFallbackRanges;
     
    8686    HashMap<int, RefPtr<GlyphPage>> m_cachedPages;
    8787
    88     HashSet<RefPtr<SimpleFontData>> m_systemFallbackFontDataSet;
     88    HashSet<RefPtr<Font>> m_systemFallbackFontSet;
    8989
    90     const SimpleFontData* m_cachedPrimarySimpleFontData;
     90    const Font* m_cachedPrimaryFont;
    9191    RefPtr<FontSelector> m_fontSelector;
    9292
     
    106106};
    107107
    108 inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescription& description)
     108inline const Font& FontGlyphs::primaryFont(const FontDescription& description)
    109109{
    110110    ASSERT(isMainThread());
    111     if (!m_cachedPrimarySimpleFontData) {
     111    if (!m_cachedPrimaryFont) {
    112112        auto& primaryRanges = realizeFallbackRangesAt(description, 0);
    113         m_cachedPrimarySimpleFontData = primaryRanges.fontDataForCharacter(' ');
    114         if (!m_cachedPrimarySimpleFontData)
    115             m_cachedPrimarySimpleFontData = &primaryRanges.fontDataForFirstRange();
     113        m_cachedPrimaryFont = primaryRanges.fontForCharacter(' ');
     114        if (!m_cachedPrimaryFont)
     115            m_cachedPrimaryFont = &primaryRanges.fontForFirstRange();
    116116    }
    117     return *m_cachedPrimarySimpleFontData;
     117    return *m_cachedPrimaryFont;
    118118}
    119119
  • trunk/Source/WebCore/platform/graphics/FontMetrics.h

    r176298 r178940  
    134134
    135135private:
    136     friend class SimpleFontData;
     136    friend class Font;
    137137
    138138    void reset()
  • trunk/Source/WebCore/platform/graphics/FontRanges.cpp

    r178388 r178940  
    2727#include "FontRanges.h"
    2828
    29 #include "SimpleFontData.h"
     29#include "Font.h"
    3030#include <wtf/Assertions.h>
    3131#include <wtf/text/WTFString.h>
     
    3737}
    3838
    39 FontRanges::FontRanges(RefPtr<SimpleFontData>&& fontData)
     39FontRanges::FontRanges(RefPtr<Font>&& font)
    4040{
    41     if (fontData)
    42         m_ranges.append(Range { 0, 0x7FFFFFFF, fontData.releaseNonNull() });
     41    if (font)
     42        m_ranges.append(Range { 0, 0x7FFFFFFF, font.releaseNonNull() });
    4343}
    4444
     
    4747}
    4848
    49 const SimpleFontData* FontRanges::fontDataForCharacter(UChar32 c) const
     49const Font* FontRanges::fontForCharacter(UChar32 c) const
    5050{
    5151    for (auto& range : m_ranges) {
    5252        if (range.from() <= c && c <= range.to())
    53             return &range.fontData();
     53            return &range.font();
    5454    }
    5555    return nullptr;
    5656}
    5757
    58 const SimpleFontData& FontRanges::fontDataForFirstRange() const
     58const Font& FontRanges::fontForFirstRange() const
    5959{
    60     return m_ranges[0].fontData();
     60    return m_ranges[0].font();
    6161}
    6262
     
    6464{
    6565    for (auto& range : m_ranges) {
    66         if (range.fontData().isLoading())
     66        if (range.font().isLoading())
    6767            return true;
    6868    }
  • trunk/Source/WebCore/platform/graphics/FontRanges.h

    r178388 r178940  
    2727#define FontRanges_h
    2828
    29 #include "SimpleFontData.h"
     29#include "Font.h"
    3030#include <wtf/TypeCasts.h>
    3131#include <wtf/Vector.h>
     
    3636public:
    3737    struct Range {
    38         Range(UChar32 from, UChar32 to, Ref<SimpleFontData>&& fontData)
     38        Range(UChar32 from, UChar32 to, Ref<Font>&& font)
    3939            : m_from(from)
    4040            , m_to(to)
    41             , m_fontData(WTF::move(fontData))
     41            , m_font(WTF::move(font))
    4242        {
    4343        }
     
    4545        UChar32 from() const { return m_from; }
    4646        UChar32 to() const { return m_to; }
    47         const SimpleFontData& fontData() const { return *m_fontData; }
     47        const Font& font() const { return *m_font; }
    4848
    4949    private:
    5050        UChar32 m_from;
    5151        UChar32 m_to;
    52         RefPtr<SimpleFontData> m_fontData;
     52        RefPtr<Font> m_font;
    5353    };
    5454
    5555    FontRanges();
    56     explicit FontRanges(RefPtr<SimpleFontData>&&);
     56    explicit FontRanges(RefPtr<Font>&&);
    5757    ~FontRanges();
    5858
     
    6363    const Range& rangeAt(unsigned i) const { return m_ranges[i]; }
    6464
    65     const SimpleFontData* fontDataForCharacter(UChar32) const;
    66     const SimpleFontData& fontDataForFirstRange() const;
     65    const Font* fontForCharacter(UChar32) const;
     66    const Font& fontForFirstRange() const;
    6767    bool isLoading() const;
    6868
  • trunk/Source/WebCore/platform/graphics/FontSelector.h

    r178388 r178940  
    4242
    4343    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;
    4545
    46     virtual size_t fallbackFontDataCount() = 0;
     46    virtual size_t fallbackFontCount() = 0;
    4747    virtual bool resolvesFamilyFor(const FontDescription&) const = 0;
    4848
  • trunk/Source/WebCore/platform/graphics/GlyphBuffer.h

    r174269 r178940  
    4646namespace WebCore {
    4747
    48 class SimpleFontData;
     48class Font;
    4949
    5050#if USE(CAIRO)
     
    7777class GlyphBuffer {
    7878public:
    79     bool isEmpty() const { return m_fontData.isEmpty(); }
    80     int size() const { return m_fontData.size(); }
     79    bool isEmpty() const { return m_font.isEmpty(); }
     80    int size() const { return m_font.size(); }
    8181   
    8282    void clear()
    8383    {
    84         m_fontData.clear();
     84        m_font.clear();
    8585        m_glyphs.clear();
    8686        m_advances.clear();
     
    9797    const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
    9898
    99     const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }
     99    const Font* fontAt(int index) const { return m_font[index]; }
    100100
    101101    void setInitialAdvance(GlyphBufferAdvance initialAdvance) { m_initialAdvance = initialAdvance; }
     
    127127   
    128128    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_fontData.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);
    132132
    133133#if USE(CAIRO)
     
    160160   
    161161#if !USE(WINGDI)
    162     void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset)
    163     {
    164         m_fontData.append(font);
     162    void add(Glyph glyph, const Font* font, GlyphBufferAdvance advance, unsigned offsetInString = noOffset)
     163    {
     164        m_font.append(font);
    165165#if USE(CAIRO)
    166166        cairo_glyph_t cairoGlyph;
     
    206206    void swap(int index1, int index2)
    207207    {
    208         const SimpleFontData* f = m_fontData[index1];
    209         m_fontData[index1] = m_fontData[index2];
    210         m_fontData[index2] = f;
     208        const Font* f = m_font[index1];
     209        m_font[index1] = m_font[index2];
     210        m_font[index2] = f;
    211211
    212212        GlyphBufferGlyph g = m_glyphs[index1];
     
    225225    }
    226226
    227     Vector<const SimpleFontData*, 2048> m_fontData;
     227    Vector<const Font*, 2048> m_font;
    228228    Vector<GlyphBufferGlyph, 2048> m_glyphs;
    229229    Vector<GlyphBufferAdvance, 2048> m_advances;
  • trunk/Source/WebCore/platform/graphics/GlyphPage.h

    r177876 r178940  
    4040namespace WebCore {
    4141
    42 class SimpleFontData;
     42class Font;
    4343
    44 // Holds the glyph index and the corresponding SimpleFontData information for a given
     44// Holds the glyph index and the corresponding Font information for a given
    4545// character.
    4646struct GlyphData {
    47     GlyphData(Glyph g = 0, const SimpleFontData* f = 0)
     47    GlyphData(Glyph g = 0, const Font* f = 0)
    4848        : glyph(g)
    49         , fontData(f)
     49        , font(f)
    5050    {
    5151    }
    5252    Glyph glyph;
    53     const SimpleFontData* fontData;
     53    const Font* font;
    5454};
    5555
     
    6767class GlyphPage : public RefCounted<GlyphPage> {
    6868public:
    69     static PassRefPtr<GlyphPage> createForMixedFontData()
     69    static PassRefPtr<GlyphPage> createForMixedFonts()
    7070    {
    71         void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(SimpleFontData*) * GlyphPage::size);
     71        void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(Font*) * GlyphPage::size);
    7272        return adoptRef(new (NotNull, slot) GlyphPage(nullptr));
    7373    }
    7474
    75     static PassRefPtr<GlyphPage> createCopyForMixedFontData(const GlyphPage& original)
     75    static PassRefPtr<GlyphPage> createCopyForMixedFonts(const GlyphPage& original)
    7676    {
    77         RefPtr<GlyphPage> page = createForMixedFontData();
     77        RefPtr<GlyphPage> page = createForMixedFonts();
    7878        for (unsigned i = 0; i < GlyphPage::size; ++i)
    7979            page->setGlyphDataForIndex(i, original.glyphDataForIndex(i));
     
    8181    }
    8282
    83     static PassRefPtr<GlyphPage> createForSingleFontData(const SimpleFontData* fontData)
     83    static PassRefPtr<GlyphPage> createForSingleFont(const Font* font)
    8484    {
    85         ASSERT(fontData);
    86         return adoptRef(new GlyphPage(fontData));
     85        ASSERT(font);
     86        return adoptRef(new GlyphPage(font));
    8787    }
    8888
     
    112112        if (hasPerGlyphFontData())
    113113            return GlyphData(glyph, m_perGlyphFontData[index]);
    114         return GlyphData(glyph, glyph ? m_fontDataForAllGlyphs : 0);
     114        return GlyphData(glyph, glyph ? m_fontForAllGlyphs : 0);
    115115    }
    116116
     
    121121    }
    122122
    123     ALWAYS_INLINE const SimpleFontData* fontDataForCharacter(UChar32 c) const
     123    ALWAYS_INLINE const Font* fontForCharacter(UChar32 c) const
    124124    {
    125125        unsigned index = indexForCharacter(c);
    126126        if (hasPerGlyphFontData())
    127127            return m_perGlyphFontData[index];
    128         return m_glyphs[index] ? m_fontDataForAllGlyphs : 0;
     128        return m_glyphs[index] ? m_fontForAllGlyphs : 0;
    129129    }
    130130
    131     void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)
     131    void setGlyphDataForCharacter(UChar32 c, Glyph g, const Font* f)
    132132    {
    133133        setGlyphDataForIndex(indexForCharacter(c), g, f);
    134134    }
    135135
    136     void setGlyphDataForIndex(unsigned index, Glyph glyph, const SimpleFontData* fontData)
     136    void setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font)
    137137    {
    138138        ASSERT_WITH_SECURITY_IMPLICATION(index < size);
     
    141141        m_glyphs[index] = glyph;
    142142
    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.
    144144        if (hasPerGlyphFontData()) {
    145             m_perGlyphFontData[index] = glyph ? fontData : 0;
     145            m_perGlyphFontData[index] = glyph ? font : 0;
    146146            return;
    147147        }
    148148
    149         // A single-font GlyphPage already assigned m_fontDataForAllGlyphs in the constructor.
    150         ASSERT(!glyph || fontData == m_fontDataForAllGlyphs);
     149        // A single-font GlyphPage already assigned m_fontForAllGlyphs in the constructor.
     150        ASSERT(!glyph || font == m_fontForAllGlyphs);
    151151    }
    152152
    153153    void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData)
    154154    {
    155         setGlyphDataForIndex(index, glyphData.glyph, glyphData.fontData);
     155        setGlyphDataForIndex(index, glyphData.glyph, glyphData.font);
    156156    }
    157157
    158158    // 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*);
    160160#if PLATFORM(COCOA)
    161     static bool mayUseMixedFontDataWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
     161    static bool mayUseMixedFontsWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const Font*);
    162162#else
    163     static bool mayUseMixedFontDataWhenFilling(const UChar*, unsigned, const SimpleFontData*) { return false; }
     163    static bool mayUseMixedFontsWhenFilling(const UChar*, unsigned, const Font*) { return false; }
    164164#endif
    165165
    166166private:
    167     explicit GlyphPage(const SimpleFontData* fontDataForAllGlyphs)
    168         : m_fontDataForAllGlyphs(fontDataForAllGlyphs)
     167    explicit GlyphPage(const Font* fontForAllGlyphs)
     168        : m_fontForAllGlyphs(fontForAllGlyphs)
    169169    {
    170170        memset(m_glyphs, 0, sizeof(m_glyphs));
    171171        if (hasPerGlyphFontData())
    172             memset(m_perGlyphFontData, 0, sizeof(SimpleFontData*) * GlyphPage::size);
     172            memset(m_perGlyphFontData, 0, sizeof(Font*) * GlyphPage::size);
    173173        ++s_count;
    174174    }
    175175
    176     bool hasPerGlyphFontData() const { return !m_fontDataForAllGlyphs; }
     176    bool hasPerGlyphFontData() const { return !m_fontForAllGlyphs; }
    177177
    178     const SimpleFontData* m_fontDataForAllGlyphs;
     178    const Font* m_fontForAllGlyphs;
    179179    Glyph m_glyphs[size];
    180180
    181181    bool m_isImmutable { false };
    182     // NOTE: This array has (GlyphPage::size) elements if m_fontDataForAllGlyphs 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];
    184184
    185185    static unsigned s_count;
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r178510 r178940  
    449449#endif // !PLATFORM(IOS)
    450450
    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);
     451void 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);
    457457}
    458458
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r178510 r178940  
    6565#if USE(WINGDI)
    6666    class SharedBitmap;
    67     class SimpleFontData;
     67    class Font;
    6868    class GlyphBuffer;
    6969#endif
     
    361361        float drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
    362362#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&);
    364364        void drawEmphasisMarks(const FontCascade&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
    365365#if !PLATFORM(IOS)
     
    480480        void resetAffineTransform();
    481481        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&);
    483483        void drawFrameControl(const IntRect& rect, unsigned type, unsigned state);
    484484        void drawFocusRect(const IntRect& rect);
  • trunk/Source/WebCore/platform/graphics/TextRun.h

    r178510 r178940  
    3737class GlyphBuffer;
    3838class GlyphToPathTranslator;
    39 class SimpleFontData;
     39class Font;
    4040
    4141struct GlyphData;
     
    199199#if ENABLE(SVG_FONTS)
    200200        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;
    202202        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;
    205205#endif
    206206    };
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r178510 r178940  
    2323#include "WidthIterator.h"
    2424
     25#include "Font.h"
    2526#include "FontCascade.h"
    2627#include "GlyphBuffer.h"
    2728#include "Latin1TextIterator.h"
    28 #include "SimpleFontData.h"
    2929#include "SurrogatePairAwareTextIterator.h"
    3030#include <wtf/MathExtras.h>
     
    3535namespace WebCore {
    3636
    37 WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
     37WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
    3838    : m_font(font)
    3939    , m_run(run)
     
    101101typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
    102102
    103 static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)
     103static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)
    104104{
    105105    ASSERT(typesettingFeatures & (Kerning | Ligatures));
     
    124124#else
    125125    // We need to handle transforms on SVG fonts internally, since they are rendered internally.
    126     if (fontData->isSVGFont()) {
     126    if (font->isSVGFont()) {
    127127        // SVG font ligatures are handled during glyph selection, only kerning remaining.
    128128        if (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {
    129129            // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point.
    130130            // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely.
    131             iterator.run().renderingContext()->applySVGKerning(fontData, iterator, glyphBuffer, lastGlyphCount);
     131            iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount);
    132132        }
    133133    } else
    134134#endif
    135         fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
     135        font->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
    136136
    137137    if (!ltr)
     
    167167    FloatRect bounds;
    168168
    169     const SimpleFontData& primaryFontData = m_font->primaryFontData();
    170     const SimpleFontData* lastFontData = &primaryFontData;
     169    const Font& primaryFont = m_font->primaryFont();
     170    const Font* lastFontData = &primaryFont;
    171171    int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0;
    172172
     
    184184            continue;
    185185        }
    186         const SimpleFontData* fontData = glyphData.fontData;
    187         ASSERT(fontData);
     186        const Font* font = glyphData.font;
     187        ASSERT(font);
    188188
    189189        // Now that we have a glyph and font data, get its width.
    190190        float width;
    191191        if (character == '\t' && m_run.allowTabs())
    192             width = m_font->tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
     192            width = m_font->tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
    193193        else {
    194             width = fontData->widthForGlyph(glyph);
     194            width = font->widthForGlyph(glyph);
    195195
    196196            // SVG uses horizontalGlyphStretch(), when textLength is used to stretch/squeeze text.
     
    201201            // Second, in fixed-pitch fonts we ensure that all characters that
    202202            // match the width of the space character have the same width as the space character.
    203             if (m_run.applyWordRounding() && width == fontData->spaceWidth() && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph()))
    204                 width = fontData->adjustedSpaceWidth();
    205         }
    206 
    207         if (fontData != 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) {
    208208            if (shouldApplyFontTransforms()) {
    209209                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, charactersTreatedAsSpace);
     
    211211            }
    212212
    213             lastFontData = fontData;
    214             if (m_fallbackFonts && fontData != &primaryFontData) {
     213            lastFontData = font;
     214            if (m_fallbackFonts && font != &primaryFont) {
    215215                // FIXME: This does a little extra work that could be avoided if
    216216                // glyphDataForCharacter() returned whether it chose to use a small caps font.
    217217                if (!m_font->isSmallCaps() || character == u_toupper(character))
    218                     m_fallbackFonts->add(fontData);
     218                    m_fallbackFonts->add(font);
    219219                else {
    220220                    const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(u_toupper(character), rtl);
    221                     if (uppercaseGlyphData.fontData != &primaryFontData)
    222                         m_fallbackFonts->add(uppercaseGlyphData.fontData);
     221                    if (uppercaseGlyphData.font != &primaryFont)
     222                        m_fallbackFonts->add(uppercaseGlyphData.font);
    223223                }
    224224            }
     
    244244                            if (glyphBuffer->isEmpty()) {
    245245                                if (m_forTextEmphasis)
    246                                     glyphBuffer->add(fontData->zeroWidthSpaceGlyph(), fontData, m_expansionPerOpportunity, currentCharacter);
     246                                    glyphBuffer->add(font->zeroWidthSpaceGlyph(), font, m_expansionPerOpportunity, currentCharacter);
    247247                                else
    248                                     glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity, currentCharacter);
     248                                    glyphBuffer->add(font->spaceGlyph(), font, expansionAtThisOpportunity, currentCharacter);
    249249                            } else
    250250                                glyphBuffer->expandLastAdvance(expansionAtThisOpportunity);
     
    275275
    276276        if (m_accountForGlyphBounds) {
    277             bounds = fontData->boundsForGlyph(glyph);
     277            bounds = font->boundsForGlyph(glyph);
    278278            if (!currentCharacter)
    279279                m_firstGlyphOverflow = std::max<float>(0, -bounds.x());
     
    315315
    316316        if (glyphBuffer)
    317             glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter);
     317            glyphBuffer->add(glyph, font, (rtl ? oldWidth + lastRoundingWidth : width), currentCharacter);
    318318
    319319        lastRoundingWidth = width - oldWidth;
  • trunk/Source/WebCore/platform/graphics/WidthIterator.h

    r178510 r178940  
    3333class FontCascade;
    3434class GlyphBuffer;
    35 class SimpleFontData;
     35class Font;
    3636class TextRun;
    3737struct GlyphData;
     
    4040    WTF_MAKE_FAST_ALLOCATED;
    4141public:
    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);
    4343
    4444    unsigned advance(int to, GlyphBuffer*);
     
    9595
    9696    TypesettingFeatures m_typesettingFeatures;
    97     HashSet<const SimpleFontData*>* m_fallbackFonts;
     97    HashSet<const Font*>* m_fallbackFonts;
    9898    bool m_accountForGlyphBounds;
    9999    float m_maxGlyphBoundingBoxY;
  • trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp

    r178510 r178940  
    3434#include "AffineTransform.h"
    3535#include "CairoUtilities.h"
     36#include "Font.h"
    3637#include "GlyphBuffer.h"
    3738#include "Gradient.h"
     
    4243#include "PlatformPathCairo.h"
    4344#include "ShadowBlur.h"
    44 #include "SimpleFontData.h"
    4545
    4646namespace WebCore {
    4747
    48 static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
     48static void drawGlyphsToContext(cairo_t* context, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs)
    4949{
    5050    cairo_matrix_t originalTransform;
     
    6565}
    6666
    67 static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
     67static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const Font* font, GlyphBufferGlyph* glyphs, int numGlyphs)
    6868{
    6969    ShadowBlur& shadow = graphicsContext->platformContext()->shadowBlur();
     
    9696}
    9797
    98 void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
     98void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer,
    9999    int from, int numGlyphs, const FloatPoint& point) const
    100100{
     
    217217        , m_textRun(textRun)
    218218        , m_glyphBuffer(glyphBuffer)
    219         , m_fontData(glyphBuffer.fontDataAt(m_index))
     219        , m_fontData(glyphBuffer.fontAt(m_index))
    220220        , m_translation(AffineTransform().translate(textOrigin.x(), textOrigin.y()))
    221221    {
     
    236236    const TextRun& m_textRun;
    237237    const GlyphBuffer& m_glyphBuffer;
    238     const SimpleFontData* m_fontData;
     238    const Font* m_fontData;
    239239    AffineTransform m_translation;
    240240};
     
    287287        if (m_index >= m_glyphBuffer.size())
    288288            break;
    289         m_fontData = m_glyphBuffer.fontDataAt(m_index);
     289        m_fontData = m_glyphBuffer.fontAt(m_index);
    290290    } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
    291291}
     
    308308
    309309    // 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);
    311311    std::unique_ptr<GlyphToPathTranslator> translator;
    312312    bool isSVG = false;
     
    327327        float centerOfLine = lineExtents.y() + (lineExtents.height() / 2);
    328328        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);
    330330        if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) {
    331331            // 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  
    2828#include "FontCascade.h"
    2929
     30#include "Font.h"
    3031#include "GraphicsContext.h"
    3132#include "HarfBuzzShaper.h"
     
    3435#include "NotImplemented.h"
    3536#include "PlatformContextCairo.h"
    36 #include "SimpleFontData.h"
    3737#include <cairo.h>
    3838
     
    8484}
    8585
    86 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
     86float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>*, GlyphOverflow*) const
    8787{
    8888    HarfBuzzShaper shaper(this, run);
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r174931 r178940  
    4242#include "FloatRect.h"
    4343#include "FloatRoundedRect.h"
     44#include "Font.h"
    4445#include "GraphicsContextPlatformPrivateCairo.h"
    4546#include "IntRect.h"
     
    5253#include "RefPtrCairo.h"
    5354#include "ShadowBlur.h"
    54 #include "SimpleFontData.h"
    5555#include "TransformationMatrix.h"
    5656#include <cairo.h>
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r178578 r178940  
    2828#import "CoreTextSPI.h"
    2929#import "DashArray.h"
     30#import "Font.h"
    3031#import "GlyphBuffer.h"
    3132#import "GraphicsContext.h"
    3233#import "LayoutRect.h"
    3334#import "Logging.h"
    34 #import "SimpleFontData.h"
    3535#import "WebCoreSystemInterface.h"
    3636#if USE(APPKIT)
     
    9292}
    9393
    94 static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
     94static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
    9595{
    9696#if ENABLE(LETTERPRESS)
     
    132132}
    133133
    134 static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
     134static void showGlyphsWithAdvances(const FloatPoint& point, const Font* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
    135135{
    136136    if (!count)
     
    198198#endif
    199199
    200 void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
     200void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
    201201{
    202202    const FontPlatformData& platformData = font->platformData();
     
    469469        , m_textRun(textRun)
    470470        , m_glyphBuffer(glyphBuffer)
    471         , m_fontData(glyphBuffer.fontDataAt(m_index))
     471        , m_fontData(glyphBuffer.fontAt(m_index))
    472472        , m_translation(CGAffineTransformScale(CGAffineTransformMakeTranslation(textOrigin.x(), textOrigin.y()), 1, -1))
    473473    {
     
    488488    const TextRun& m_textRun;
    489489    const GlyphBuffer& m_glyphBuffer;
    490     const SimpleFontData* m_fontData;
     490    const Font* m_fontData;
    491491    CGAffineTransform m_translation;
    492492};
     
    525525        if (m_index >= m_glyphBuffer.size())
    526526            break;
    527         m_fontData = m_glyphBuffer.fontDataAt(m_index);
     527        m_fontData = m_glyphBuffer.fontAt(m_index);
    528528    } while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
    529529}
     
    546546   
    547547    // 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);
    549549    std::unique_ptr<GlyphToPathTranslator> translator;
    550550    bool isSVG = false;
     
    562562    for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) {
    563563        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 (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) {
     564        const Font* localFont = glyphBuffer.fontAt(index);
     565        if (!localFont || (!isSVG && localFont->isSVGFont()) || (isSVG && localFont != fontData)) {
    566566            // The advances will get all messed up if we do anything other than bail here.
    567567            result.clear();
     
    593593#endif
    594594
    595 bool FontCascade::primaryFontDataIsSystemFont() const
     595bool FontCascade::primaryFontIsSystemFont() const
    596596{
    597597#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090
    598     const auto& fontData = primaryFontData();
     598    const auto& fontData = primaryFont();
    599599    return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
    600600#else
     
    672672}
    673673
    674 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     674float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    675675{
    676676    ComplexTextController controller(this, run, true, fallbackFonts);
     
    690690}
    691691
    692 const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
     692const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length, FontVariant variant) const
    693693{
    694694    UChar32 baseCharacter;
     
    702702
    703703    if (length == baseCharacterLength)
    704         return baseCharacterGlyphData.fontData;
    705 
    706     bool triedBaseCharacterFontData = false;
     704        return baseCharacterGlyphData.font;
     705
     706    bool triedBaseCharacterFont = false;
    707707
    708708    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)
    711711            continue;
    712712#if PLATFORM(IOS)
    713         if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && simpleFontData->shouldNotBeUsedForArabic())
     713        if (baseCharacter >= 0x0600 && baseCharacter <= 0x06ff && font->shouldNotBeUsedForArabic())
    714714            continue;
    715715#endif
    716716        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()) {
    719719                    variant = BrokenIdeographVariant;
    720                     simpleFontData = simpleFontData->brokenIdeographFontData().get();
     720                    font = font->brokenIdeographFont().get();
    721721                } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
    722                     SimpleFontData* verticalRightFontData = simpleFontData->verticalRightOrientationFontData().get();
    723                     Glyph verticalRightGlyph = verticalRightFontData->glyphForCharacter(baseCharacter);
     722                    Font* verticalRightFont = font->verticalRightOrientationFont().get();
     723                    Glyph verticalRightGlyph = verticalRightFont->glyphForCharacter(baseCharacter);
    724724                    if (verticalRightGlyph == baseCharacterGlyphData.glyph)
    725                         simpleFontData = verticalRightFontData;
     725                        font = verticalRightFont;
    726726                } else {
    727                     SimpleFontData* uprightFontData = simpleFontData->uprightOrientationFontData().get();
    728                     Glyph uprightGlyph = uprightFontData->glyphForCharacter(baseCharacter);
     727                    Font* uprightFont = font->uprightOrientationFont().get();
     728                    Glyph uprightGlyph = uprightFont->glyphForCharacter(baseCharacter);
    729729                    if (uprightGlyph != baseCharacterGlyphData.glyph)
    730                         simpleFontData = uprightFontData;
     730                        font = uprightFont;
    731731                }
    732732            }
    733733        } else {
    734             if (const SimpleFontData* variantFontData = simpleFontData->variantFontData(m_fontDescription, variant).get())
    735                 simpleFontData = variantFontData;
    736         }
    737 
    738         if (simpleFontData == baseCharacterGlyphData.fontData)
    739             triedBaseCharacterFontData = true;
    740 
    741         if (simpleFontData->canRenderCombiningCharacterSequence(characters, length))
    742             return simpleFontData;
    743     }
    744 
    745     if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCharacterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, length))
    746         return baseCharacterGlyphData.fontData;
    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  
    2323#include "FontCache.h"
    2424
     25#include "Font.h"
    2526#include "OwnPtrCairo.h"
    2627#include "RefPtrCairo.h"
    27 #include "SimpleFontData.h"
    2828#include "UTF16UChar32Iterator.h"
    2929#include <cairo-ft.h>
     
    8181}
    8282
    83 RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
     83RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
    8484{
    8585    RefPtr<FcPattern> pattern = adoptRef(createFontConfigPatternForCharacters(characters, length));
     
    100100}
    101101
    102 Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
     102Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
    103103{
    104104    // We want to return a fallback font here, otherwise the logic preventing FontConfig
  • trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp

    r177876 r178940  
    3232#include "GlyphPage.h"
    3333
    34 #include "SimpleFontData.h"
     34#include "Font.h"
    3535#include "UTF16UChar32Iterator.h"
    3636#include <cairo-ft.h>
     
    4040namespace WebCore {
    4141
    42 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     42bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
    4343{
    4444    cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont();
  • trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp

    r178510 r178940  
    3232
    3333#include "config.h"
    34 #include "SimpleFontData.h"
     34#include "Font.h"
    3535
    3636#include "FloatConversion.h"
     
    5252namespace WebCore {
    5353
    54 void SimpleFontData::platformInit()
     54void Font::platformInit()
    5555{
    5656    if (!m_platformData.m_size)
     
    9494}
    9595
    96 void SimpleFontData::platformCharWidthInit()
     96void Font::platformCharWidthInit()
    9797{
    9898    m_avgCharWidth = 0.f;
     
    101101}
    102102
    103 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
     103PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
    104104{
    105105    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()),
    107107        scaleFactor * fontDescription.computedSize(),
    108108        m_platformData.syntheticBold(),
     
    112112}
    113113
    114 void SimpleFontData::determinePitch()
     114void Font::determinePitch()
    115115{
    116116    m_treatAsFixedPitch = m_platformData.isFixedPitch();
    117117}
    118118
    119 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     119FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
    120120{
    121121    if (!m_platformData.size())
     
    132132}
    133133
    134 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
     134float Font::platformWidthForGlyph(Glyph glyph) const
    135135{
    136136    if (!m_platformData.size())
     
    148148
    149149#if USE(HARFBUZZ)
    150 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
     150bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
    151151{
    152152    if (!m_combiningCharacterSequenceSupport)
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp

    r176945 r178940  
    3333#include "HarfBuzzFace.h"
    3434
     35#include "Font.h"
    3536#include "FontPlatformData.h"
    3637#include "GlyphBuffer.h"
    3738#include "HarfBuzzShaper.h"
    38 #include "SimpleFontData.h"
    3939#include "TextEncoding.h"
    4040#include <cairo-ft.h>
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp

    r178166 r178940  
    3232#include "HarfBuzzFace.h"
    3333
     34#include "Font.h"
    3435#include "FontPlatformData.h"
    3536#include "HarfBuzzShaper.h"
    36 #include "SimpleFontData.h"
    3737#include <ApplicationServices/ApplicationServices.h>
    3838#include <hb.h>
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp

    r178510 r178940  
    7373}
    7474
    75 HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)
     75HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const Font* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script)
    7676    : m_fontData(fontData)
    7777    , m_startIndex(startIndex)
     
    402402        return false;
    403403
    404     const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
     404    const Font* nextFontData = m_font->glyphDataForCharacter(character, false).font;
    405405    UErrorCode errorCode = U_ZERO_ERROR;
    406406    UScriptCode nextScript = uscript_getScript(character, &errorCode);
     
    410410    do {
    411411        const UChar* currentCharacterPosition = iterator.characters();
    412         const SimpleFontData* currentFontData = nextFontData;
     412        const Font* currentFontData = nextFontData;
    413413        if (!currentFontData)
    414             currentFontData = &m_font->primaryFontData();
     414            currentFontData = &m_font->primaryFont();
    415415        UScriptCode currentScript = nextScript;
    416416
     
    436436                    continue;
    437437                }
    438                 nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
     438                nextFontData = m_font->glyphDataForCharacter(character, false).font;
    439439            } else
    440                 nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
     440                nextFontData = m_font->glyphDataForCharacter(character, false).font;
    441441
    442442            nextScript = uscript_getScript(character, &errorCode);
     
    468468        unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i;
    469469        HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get();
    470         const SimpleFontData* currentFontData = currentRun->fontData();
     470        const Font* currentFontData = currentRun->fontData();
    471471        if (currentFontData->isSVGFont())
    472472            return false;
     
    486486        if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) {
    487487            String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()).upper();
    488             currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
     488            currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).font;
    489489            const UChar* characters = StringView(upperText).upconvertedCharacters();
    490490            hb_buffer_add_utf16(harfBuzzBuffer.get(), reinterpret_cast<const uint16_t*>(characters), currentRun->numCharacters(), 0, currentRun->numCharacters());
     
    515515void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb_buffer_t* harfBuzzBuffer)
    516516{
    517     const SimpleFontData* currentFontData = currentRun->fontData();
     517    const Font* currentFontData = currentRun->fontData();
    518518    hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfBuzzBuffer, 0);
    519519    hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfBuzzBuffer, 0);
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h

    r178510 r178940  
    4545namespace WebCore {
    4646
     47class Font;
    4748class FontCascade;
    48 class SimpleFontData;
    4949
    5050class HarfBuzzShaper {
     
    6767    class HarfBuzzRun {
    6868    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);
    7070
    7171        void applyShapeResult(hb_buffer_t*);
     
    7676        float xPositionForOffset(unsigned offset);
    7777
    78         const SimpleFontData* fontData() { return m_fontData; }
     78        const Font* fontData() { return m_fontData; }
    7979        unsigned startIndex() const { return m_startIndex; }
    8080        unsigned numCharacters() const { return m_numCharacters; }
     
    8989
    9090    private:
    91         const SimpleFontData* m_fontData;
     91        const Font* m_fontData;
    9292        unsigned m_startIndex;
    9393        size_t m_numCharacters;
  • trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm

    r178510 r178940  
    7474}
    7575
    76 PassRefPtr<SimpleFontData> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, const UChar* characters, int length)
     76PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const Font* originalFontData, const UChar* characters, int length)
    7777{
    7878    const FontPlatformData& platformData = originalFontData->platformData();
     
    195195}
    196196
    197 RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
     197RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
    198198{
    199199    // Unlike OS X, our fallback font on iPhone is Arial Unicode, which doesn't have some apple-specific glyphs like F8FF.
     
    221221        languageSpecificFont = languageSpecificFallbackFont(c);
    222222
    223     RefPtr<SimpleFontData> simpleFontData;
     223    RefPtr<Font> font;
    224224
    225225    switch (languageSpecificFont) {
     
    299299        }
    300300
    301         simpleFontData = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false);
     301        font = fontForFamily(description, isFontWeightBold(description.weight()) ? *cjkBold[preferredCJKFont] : *cjkPlain[preferredCJKFont], false);
    302302        bool useSecondaryFont = true;
    303         if (simpleFontData) {
     303        if (font) {
    304304            CGGlyph glyphs[2];
    305305            // CGFontGetGlyphsForUnichars takes UTF-16 buffer. Should only be 1 codepoint but since we may pass in two UTF-16 characters,
    306306            // 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);
    308308
    309309            useSecondaryFont = (glyphs[0] == 0);
     
    311311
    312312        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);
    314314        break;
    315315    }
     
    317317        static NeverDestroyed<AtomicString> koreanPlain("AppleSDGothicNeo-Medium", AtomicString::ConstructFromLiteral);
    318318        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);
    320320        break;
    321321    }
     
    323323        static NeverDestroyed<AtomicString> cyrillicPlain("HelveticaNeue", AtomicString::ConstructFromLiteral);
    324324        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);
    326326        break;
    327327    }
     
    329329        static NeverDestroyed<AtomicString> arabicPlain("GeezaPro", AtomicString::ConstructFromLiteral);
    330330        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);
    332332        break;
    333333    }
     
    335335        static NeverDestroyed<AtomicString> hebrewPlain("ArialHebrew", AtomicString::ConstructFromLiteral);
    336336        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);
    338338        break;
    339339    }
     
    391391            AtomicString* indicFontString = isFontWeightBold(description.weight()) ? indicUnicodePageFontsBold[indicPageOrderIndex] : indicUnicodePageFonts[indicPageOrderIndex];
    392392            if (indicFontString)
    393                 simpleFontData = fontForFamily(description, *indicFontString, false);
     393                font = fontForFamily(description, *indicFontString, false);
    394394        }
    395395        break;
     
    398398        static NeverDestroyed<AtomicString> thaiPlain("Thonburi", AtomicString::ConstructFromLiteral);
    399399        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);
    401401        break;
    402402    }
     
    404404        static NeverDestroyed<AtomicString> tibetanPlain("Kailasa", AtomicString::ConstructFromLiteral);
    405405        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);
    407407        break;
    408408    }
     
    410410        static NeverDestroyed<AtomicString> casPlain("EuphemiaUCAS", AtomicString::ConstructFromLiteral);
    411411        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);
    413413        break;
    414414    }
    415415    case LanguageSpecificFont::Khmer: {
    416416        static NeverDestroyed<AtomicString> khmer("KhmerSangamMN", AtomicString::ConstructFromLiteral);
    417         simpleFontData = fontForFamily(description, khmer, false);
     417        font = fontForFamily(description, khmer, false);
    418418        break;
    419419    }
    420420    case LanguageSpecificFont::Lao: {
    421421        static NeverDestroyed<AtomicString> lao("LaoSangamMN", AtomicString::ConstructFromLiteral);
    422         simpleFontData = fontForFamily(description, lao, false);
     422        font = fontForFamily(description, lao, false);
    423423        break;
    424424    }
     
    431431        }
    432432        if (useEmojiFont)
    433             simpleFontData = fontForFamily(description, appleColorEmoji, false);
     433            font = fontForFamily(description, appleColorEmoji, false);
    434434        else {
    435435            RetainPtr<CTFontRef> fallbackFont = adoptCF(CTFontCreateForCharacters(originalFontData->getCTFont(), characters, length, nullptr));
    436436            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();
    445445
    446446    return lastResortFallbackFont(description);
    447447}
    448448
    449 RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)
     449RefPtr<Font> FontCache::similarFont(const FontDescription& description)
    450450{
    451451    // Attempt to find an appropriate font using a match based on the presence of keywords in
    452452    // the requested names. For example, we'll match any name that contains "Arabic" to Geeza Pro.
    453     RefPtr<SimpleFontData> simpleFontData;
     453    RefPtr<Font> font;
    454454    for (unsigned i = 0; i < description.familyCount(); ++i) {
    455455        const AtomicString& family = description.familyAt(i);
     
    462462        static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
    463463        if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo)) {
    464             simpleFontData = fontForFamily(description, courier);
     464            font = fontForFamily(description, courier);
    465465            continue;
    466466        }
     
    470470        static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
    471471        if (equalIgnoringCase(family, lucidaGrande)) {
    472             simpleFontData = fontForFamily(description, verdana);
     472            font = fontForFamily(description, verdana);
    473473            continue;
    474474        }
     
    480480        static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral);
    481481        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) {
    483483            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
     491Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
    491492{
    492493    static NeverDestroyed<AtomicString> fallbackFontFamily(".PhoneFallback", AtomicString::ConstructFromLiteral);
  • trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm

    r178510 r178940  
    2626
    2727#import "config.h"
    28 #import "SimpleFontData.h"
     28#import "Font.h"
    2929
    3030#import "BlockExceptions.h"
     
    6868}
    6969
    70 void SimpleFontData::platformInit()
     70void Font::platformInit()
    7171{
    7272    m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size()  / 24.0f) : 0.f;
     
    129129}
    130130
    131 void SimpleFontData::platformCharWidthInit()
     131void Font::platformCharWidthInit()
    132132{
    133133    m_avgCharWidth = 0;
     
    138138}
    139139
    140 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription&, float scaleFactor) const
     140PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
    141141{
    142142    if (isCustomFont()) {
    143143        FontPlatformData scaledFontData(m_platformData);
    144144        scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
    145         return SimpleFontData::create(scaledFontData, true, false);
     145        return Font::create(scaledFontData, true, false);
    146146    }
    147147
     
    168168}
    169169
    170 void SimpleFontData::determinePitch()
     170void Font::determinePitch()
    171171{
    172172    CTFontRef ctFont = m_platformData.font();
     
    185185}
    186186
    187 CGFontRenderingStyle SimpleFontData::renderingStyle() const
     187CGFontRenderingStyle Font::renderingStyle() const
    188188{
    189189    return kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
    190190}
    191191
    192 bool SimpleFontData::advanceForColorBitmapFont(Glyph, CGSize&) const
     192bool Font::advanceForColorBitmapFont(Glyph, CGSize&) const
    193193{
    194194    return false;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r178510 r178940  
    5757    }
    5858
    59     float width(unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
     59    float width(unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
    6060    {
    6161        m_controller->advance(from, 0, ByWholeGlyphs, fallbackFonts);
     
    9797}
    9898
    99 float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
     99float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
    100100{
    101101    return layout.width(from, len, fallbackFonts);
     
    116116}
    117117
    118 ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const SimpleFontData*>* fallbackFonts, bool forTextEmphasis)
     118ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
    119119    : m_font(*font)
    120120    , m_run(run)
     
    292292        return;
    293293
    294     // We break up glyph run generation for the string by FontData.
     294    // We break up glyph run generation for the string by Font.
    295295    const UChar* cp;
    296296
     
    309309    const UChar* end = cp + m_end;
    310310
    311     const SimpleFontData* fontData;
     311    const Font* font;
    312312    bool isMissingGlyph;
    313     const SimpleFontData* nextFontData;
     313    const Font* nextFont;
    314314    bool nextIsMissingGlyph;
    315315
     
    333333
    334334    nextIsMissingGlyph = false;
    335     nextFontData = m_font.fontDataForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
    336     if (!nextFontData)
     335    nextFont = m_font.fontForCombiningCharacterSequence(sequenceStart, curr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
     336    if (!nextFont)
    337337        nextIsMissingGlyph = true;
    338338
    339339    while (curr < end) {
    340         fontData = nextFontData;
     340        font = nextFont;
    341341        isMissingGlyph = nextIsMissingGlyph;
    342342        isSmallCaps = nextIsSmallCaps;
     
    359359        nextIsMissingGlyph = false;
    360360        if (baseCharacter == zeroWidthJoiner)
    361             nextFontData = fontData;
     361            nextFont = font;
    362362        else {
    363             nextFontData = m_font.fontDataForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
    364             if (!nextFontData)
     363            nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
     364            if (!nextFont)
    365365                nextIsMissingGlyph = true;
    366366        }
    367367
    368         if (nextFontData != fontData || nextIsMissingGlyph != isMissingGlyph) {
     368        if (nextFont != font || nextIsMissingGlyph != isMissingGlyph) {
    369369            int itemStart = static_cast<int>(indexOfFontTransition);
    370370            int itemLength = index - indexOfFontTransition;
    371             collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? fontData : 0);
     371            collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !isMissingGlyph ? font : 0);
    372372            indexOfFontTransition = index;
    373373        }
     
    377377    if (itemLength) {
    378378        int itemStart = indexOfFontTransition;
    379         collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFontData : 0);
     379        collectComplexTextRunsForCharacters((nextIsSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, !nextIsMissingGlyph ? nextFont : 0);
    380380    }
    381381
     
    470470}
    471471
    472 void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const SimpleFontData*>* fallbackFonts)
     472void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const Font*>* fallbackFonts)
    473473{
    474474    if (static_cast<int>(offset) > m_end)
     
    495495        unsigned g = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun;
    496496        unsigned k = leftmostGlyph + g;
    497         if (fallbackFonts && &complexTextRun.fontData() != &m_font.primaryFontData())
    498             fallbackFonts->add(&complexTextRun.fontData());
     497        if (fallbackFonts && &complexTextRun.font() != &m_font.primaryFont())
     498            fallbackFonts->add(&complexTextRun.font());
    499499
    500500        // We must store the initial advance for the first glyph we are going to draw.
     
    521521
    522522            if (glyphBuffer && !m_characterInCurrentGlyph)
    523                 glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
     523                glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
    524524
    525525            unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
     
    567567        ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
    568568        unsigned glyphCount = complexTextRun.glyphCount();
    569         const SimpleFontData& fontData = complexTextRun.fontData();
     569        const Font& font = complexTextRun.font();
    570570#if PLATFORM(IOS)
    571         bool isEmoji = fontData.platformData().m_isEmoji;
     571        bool isEmoji = font.platformData().m_isEmoji;
    572572#endif
    573573
     
    589589
    590590        bool lastRun = r + 1 == runCount;
    591         bool roundsAdvances = !m_font.isPrinterFont() && fontData.platformData().roundsGlyphAdvances();
    592         float spaceWidth = fontData.spaceWidth() - fontData.syntheticBoldOffset();
     591        bool roundsAdvances = !m_font.isPrinterFont() && font.platformData().roundsGlyphAdvances();
     592        float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
    593593        CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
    594594        const UChar* cp = complexTextRun.characters();
     
    617617
    618618            bool treatAsSpace = FontCascade::treatAsSpace(ch);
    619             CGGlyph glyph = treatAsSpace ? fontData.spaceGlyph() : glyphs[i];
     619            CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
    620620            CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
    621621#if PLATFORM(IOS)
    622622            if (isEmoji && advance.width)
    623                 advance.width = fontData.widthForGlyph(glyph);
     623                advance.width = font.widthForGlyph(glyph);
    624624#endif
    625625
    626626            if (ch == '\t' && m_run.allowTabs())
    627                 advance.width = m_font.tabWidth(fontData, 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);
    628628            else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
    629629                advance.width = 0;
    630                 glyph = fontData.spaceGlyph();
     630                glyph = font.spaceGlyph();
    631631            }
    632632
     
    635635                advance.width = roundedAdvanceWidth;
    636636
    637             advance.width += fontData.syntheticBoldOffset();
     637            advance.width += font.syntheticBoldOffset();
    638638
    639639 
     
    642642            // Second, in fixed-pitch fonts we ensure that all glyphs that
    643643            // match the width of the space glyph have the same width as the space glyph.
    644             if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData.pitch() == FixedPitch || glyph == fontData.spaceGlyph()))
    645                 advance.width = fontData.adjustedSpaceWidth();
     644            if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (font.pitch() == FixedPitch || glyph == font.spaceGlyph()))
     645                advance.width = font.adjustedSpaceWidth();
    646646
    647647            if (hasExtraSpacing) {
     
    718718            m_adjustedGlyphs.append(glyph);
    719719           
    720             FloatRect glyphBounds = fontData.boundsForGlyph(glyph);
     720            FloatRect glyphBounds = font.boundsForGlyph(glyph);
    721721            glyphBounds.move(glyphOrigin.x, glyphOrigin.y);
    722722            m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x());
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r178510 r178940  
    4242
    4343class FontCascade;
    44 class SimpleFontData;
     44class Font;
    4545class TextRun;
    4646
     
    5151class ComplexTextController {
    5252public:
    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);
    5454
    5555    // 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);
    5757
    5858    // Compute the character offset for a given x coordinate.
     
    7474    class ComplexTextRun : public RefCounted<ComplexTextRun> {
    7575    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)
    7777        {
    78             return adoptRef(*new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange));
     78            return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, runRange));
    7979        }
    8080
    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)
    8282        {
    83             return adoptRef(*new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr));
     83            return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr));
    8484        }
    8585
    8686        unsigned glyphCount() const { return m_glyphCount; }
    87         const SimpleFontData& fontData() const { return m_fontData; }
     87        const Font& font() const { return m_font; }
    8888        const UChar* characters() const { return m_characters; }
    8989        unsigned stringLocation() const { return m_stringLocation; }
     
    101101
    102102    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);
    105105
    106106        unsigned m_glyphCount;
    107         const SimpleFontData& m_fontData;
     107        const Font& m_font;
    108108        const UChar* m_characters;
    109109        unsigned m_stringLocation;
     
    128128    void collectComplexTextRuns();
    129129
    130     void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
     130    void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const Font*);
    131131    void adjustGlyphsAndAdvances();
    132132
     
    170170    bool m_afterExpansion;
    171171
    172     HashSet<const SimpleFontData*>* m_fallbackFonts;
     172    HashSet<const Font*>* m_fallbackFonts;
    173173
    174174    float m_minGlyphBoundingBoxX;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

    r178510 r178940  
    6262
    6363    // By the time a WebCascadeList is used, the FontCascade has already been asked to realize all of its
    64     // FontData, so this loop does not hit the FontCache.
     64    // Fonts, so this loop does not hit the FontCache.
    6565    while (!_font->fallbackRangesAt(_count).isNull())
    6666        _count++;
     
    8383        _fontDescriptors.grow(index + 1);
    8484
    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());
    8989    _fontDescriptors[index] = adoptCF(fontDescriptor);
    9090    return (id)fontDescriptor;
     
    9595namespace WebCore {
    9696
    97 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
    98     : m_fontData(fontData)
     97ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
     98    : m_font(font)
    9999    , m_characters(characters)
    100100    , m_stringLocation(stringLocation)
     
    131131// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
    132132// 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_fontData(fontData)
     133ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
     134    : m_font(font)
    135135    , m_characters(characters)
    136136    , m_stringLocation(stringLocation)
     
    164164    m_glyphsVector.fill(0, m_glyphCount);
    165165    m_glyphs = m_glyphsVector.data();
    166     m_advancesVector.fill(CGSizeMake(m_fontData.widthForGlyph(0), 0), m_glyphCount);
     166    m_advancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
    167167    m_advances = m_advancesVector.data();
    168168}
     
    185185}
    186186
    187 void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
    188 {
    189     if (!fontData) {
     187void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const Font* font)
     188{
     189    if (!font) {
    190190        // Create a run of missing glyphs from the primary font.
    191         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation, length, m_run.ltr()));
     191        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr()));
    192192        return;
    193193    }
     
    197197    UChar32 baseCharacter = 0;
    198198    RetainPtr<CFDictionaryRef> stringAttributes;
    199     if (fontData == SimpleFontData::systemFallback()) {
     199    if (font == Font::systemFallback()) {
    200200        // FIXME: This code path does not support small caps.
    201201        isSystemFallback = true;
    202202
    203203        U16_GET(cp, 0, 0, length, baseCharacter);
    204         fontData = m_font.fallbackRangesAt(0).fontDataForCharacter(baseCharacter);
    205         if (!fontData)
    206             fontData = &m_font.fallbackRangesAt(0).fontDataForFirstRange();
     204        font = m_font.fallbackRangesAt(0).fontForCharacter(baseCharacter);
     205        if (!font)
     206            font = &m_font.fallbackRangesAt(0).fontForFirstRange();
    207207
    208208        RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
    209209
    210         stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation())));
     210        stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation())));
    211211        static const void* attributeKeys[] = { kCTFontCascadeListAttribute };
    212212        const void* values[] = { cascadeList.get() };
    213213        RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
    214214        RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
    215         RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(fontData->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
     215        RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(font->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
    216216        CFDictionarySetValue(const_cast<CFMutableDictionaryRef>(stringAttributes.get()), kCTFontAttributeName, fontWithCascadeList.get());
    217217    } else
    218         stringAttributes = fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation());
     218        stringAttributes = font->getCFStringAttributes(m_font.typesettingFeatures(), font->platformData().orientation());
    219219
    220220    RetainPtr<CTLineRef> line;
     
    249249        ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID());
    250250        CFRange runRange = CTRunGetStringRange(ctRun);
    251         const SimpleFontData* runFontData = fontData;
     251        const Font* runFont = font;
    252252        if (isSystemFallback) {
    253253            CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun);
    254             CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName));
    255             ASSERT(CFGetTypeID(runFont) == CTFontGetTypeID());
    256             RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(runFont);
    257             if (!CFEqual(runFontEqualityObject.get(), fontData->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())) {
    258258                // Begin trying to see if runFont matches any of the fonts in the fallback list.
    259259
    260260                for (unsigned i = 0; !m_font.fallbackRangesAt(i).isNull(); ++i) {
    261                     runFontData = m_font.fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
    262                     if (!runFontData)
     261                    runFont = m_font.fallbackRangesAt(i).fontForCharacter(baseCharacter);
     262                    if (!runFont)
    263263                        continue;
    264                     RetainPtr<CFTypeRef> runFontEqualityObject = runFontData->platformData().objectForEqualityCheck();
     264                    RetainPtr<CFTypeRef> runFontEqualityObject = runFont->platformData().objectForEqualityCheck();
    265265                    if (CFEqual(runFontEqualityObject.get(), runFontEqualityObject.get()))
    266266                        break;
    267                     runFontData = 0;
     267                    runFont = nullptr;
    268268                }
    269269                // If there is no matching font, look up by name in the font cache.
    270                 if (!runFontData) {
     270                if (!runFont) {
    271271                    // Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through
    272272                    // the font cache and ultimately through NSFontManager in order to get an NSFont with the right
    273273                    // NSFontRenderingMode.
    274                     RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runFont));
     274                    RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runCTFont));
    275275                    if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
    276                         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), 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()));
    277277                        continue;
    278278                    }
    279                     runFontData = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
     279                    runFont = fontCache().fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
    280280#if !PLATFORM(IOS)
    281281                    // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
    282282                    // using the font as returned, even though it may not have the best NSFontRenderingMode.
    283                     if (!runFontData) {
    284                         FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont());
    285                         runFontData = &fontCache().fontForPlatformData(runFontPlatformData).get();
     283                    if (!runFont) {
     284                        FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont), m_font.fontDescription().usePrinterFont());
     285                        runFont = &fontCache().fontForPlatformData(runFontPlatformData).get();
    286286                    }
    287287#else
    288288                    // FIXME: Just assert for now, until we can devise a better fix that works with iOS.
    289                     ASSERT(runFontData);
     289                    ASSERT(runFont);
    290290#endif
    291291                }
    292                 if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
    293                     m_fallbackFonts->add(runFontData);
     292                if (m_fallbackFonts && runFont != &m_font.primaryFont())
     293                    m_fallbackFonts->add(runFont);
    294294            }
    295295        }
    296         if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
    297             m_fallbackFonts->add(fontData);
    298 
    299         m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFontData, 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));
    300300    }
    301301}
  • trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm

    r178510 r178940  
    3434
    3535#import "CoreGraphicsSPI.h"
     36#import "Font.h"
    3637#import "FontCascade.h"
    37 #import "SimpleFontData.h"
    3838#import "FontPlatformData.h"
    3939#import "NSFontSPI.h"
     
    338338}
    339339
    340 RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool isPlatformFont, const UChar* characters, int length)
     340RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length)
    341341{
    342342    UChar32 character;
     
    406406}
    407407
    408 RefPtr<SimpleFontData> FontCache::similarFontPlatformData(const FontDescription& description)
     408RefPtr<Font> FontCache::similarFont(const FontDescription& description)
    409409{
    410410    // Attempt to find an appropriate font using a match based on
    411411    // the presence of keywords in the the requested names.  For example, we'll
    412412    // match any name that contains "Arabic" to Geeza Pro.
    413     RefPtr<SimpleFontData> simpleFontData;
     413    RefPtr<Font> font;
    414414    for (unsigned i = 0; i < description.familyCount(); ++i) {
    415415        const AtomicString& family = description.familyAt(i);
     
    418418        static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
    419419        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) {
    421421            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
     428Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
    428429{
    429430    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times", AtomicString::ConstructFromLiteral));
     
    431432    // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
    432433    // 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;
    436437
    437438    // The Times fallback will almost always work, but in the highly unusual case where
  • trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp

    r178510 r178940  
    3232#include "CoreGraphicsSPI.h"
    3333#include "CoreTextSPI.h"
     34#include "Font.h"
    3435#include "FontCascade.h"
    35 #include "SimpleFontData.h"
    3636#include "WebCoreSystemInterface.h"
    3737#if !PLATFORM(IOS)
     
    4141namespace WebCore {
    4242
    43 static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     43static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData)
    4444{
    4545    if (fontData->platformData().isCompositeFontReference())
     
    5656}
    5757
    58 bool GlyphPage::mayUseMixedFontDataWhenFilling(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     58bool GlyphPage::mayUseMixedFontsWhenFilling(const UChar* buffer, unsigned bufferLength, const Font* fontData)
    5959{
    6060#if USE(APPKIT)
     
    6969}
    7070
    71 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     71bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
    7272{
    7373    bool haveGlyphs = false;
     
    164164#if USE(APPKIT)
    165165                } else {
    166                     const SimpleFontData* runSimple = fontData->compositeFontReferenceFontData((NSFont *)runFont);
     166                    const Font* runSimple = fontData->compositeFontReferenceFont((NSFont *)runFont);
    167167                    if (runSimple) {
    168168                        for (CFIndex i = 0; i < glyphCount; ++i) {
  • trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp

    r161589 r178940  
    2626
    2727#include "config.h"
    28 #include "SimpleFontData.h"
     28#include "Font.h"
    2929
    3030#if !PLATFORM(IOS)
     
    3636namespace WebCore {
    3737
    38 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
     38CFDictionaryRef Font::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
    3939{
    4040    unsigned key = typesettingFeatures + 1;
  • trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm

    r178573 r178940  
    2626
    2727#import "config.h"
    28 #import "SimpleFontData.h"
     28#import "Font.h"
    2929
    3030#import "BlockExceptions.h"
     
    7272}
    7373
    74 static bool initFontData(SimpleFontData* fontData)
     74static bool initFontData(Font* fontData)
    7575{
    7676    if (!fontData->platformData().cgFont())
     
    8686}
    8787
    88 const SimpleFontData* SimpleFontData::compositeFontReferenceFontData(NSFont *key) const
     88const Font* Font::compositeFontReferenceFont(NSFont *key) const
    8989{
    9090    if (!key || CFEqual(adoptCF(CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort")))
     
    104104
    105105        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());
    107107    }
    108108    return addResult.iterator->value.get();
    109109}
    110110
    111 void SimpleFontData::platformInit()
     111void Font::platformInit()
    112112{
    113113    m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f;
     
    227227            xHeight = scaleEmToUnits(CGFontGetXHeight(m_platformData.cgFont()), unitsPerEm) * pointSize;
    228228    } else
    229         xHeight = verticalRightOrientationFontData()->fontMetrics().xHeight();
     229        xHeight = verticalRightOrientationFont()->fontMetrics().xHeight();
    230230
    231231    m_fontMetrics.setUnitsPerEm(unitsPerEm);
     
    242242}
    243243
    244 void SimpleFontData::platformCharWidthInit()
     244void Font::platformCharWidthInit()
    245245{
    246246    m_avgCharWidth = 0;
     
    270270#endif // USE(APPKIT)
    271271
    272 void SimpleFontData::platformDestroy()
     272void Font::platformDestroy()
    273273{
    274274}
    275275
    276276#if !PLATFORM(IOS)
    277 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
     277PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
    278278{
    279279    if (isCustomFont()) {
    280280        FontPlatformData scaledFontData(m_platformData);
    281281        scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
    282         return SimpleFontData::create(scaledFontData, true, false);
     282        return Font::create(scaledFontData, true, false);
    283283    }
    284284
     
    311311}
    312312
    313 void SimpleFontData::determinePitch()
     313void Font::determinePitch()
    314314{
    315315    NSFont* f = m_platformData.nsFont();
     
    334334#endif // !PLATFORM(IOS)
    335335
    336 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     336FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
    337337{
    338338    FloatRect boundingBox;
     
    346346
    347347#if PLATFORM(MAC)
    348 inline CGFontRenderingStyle SimpleFontData::renderingStyle() const
     348inline CGFontRenderingStyle Font::renderingStyle() const
    349349{
    350350    CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization;
     
    365365}
    366366
    367 inline bool SimpleFontData::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const
     367inline bool Font::advanceForColorBitmapFont(Glyph glyph, CGSize& advance) const
    368368{
    369369    NSFont *font = platformData().nsFont();
     
    395395}
    396396
    397 inline bool SimpleFontData::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const
     397inline bool Font::canUseFastGlyphAdvanceGetter(Glyph glyph, CGSize& advance, bool& populatedAdvance) const
    398398{
    399399    // Fast getter doesn't take custom tracking into account
     
    411411}
    412412
    413 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
     413float Font::platformWidthForGlyph(Glyph glyph) const
    414414{
    415415    CGSize advance = CGSizeZero;
     
    447447}
    448448
    449 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
     449bool Font::canRenderCombiningCharacterSequence(const UChar* characters, size_t length) const
    450450{
    451451    ASSERT(isMainThread());
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp

    r177955 r178940  
    2727#include "OpenTypeMathData.h"
    2828
     29#include "Font.h"
    2930#include "FontPlatformData.h"
    3031#if ENABLE(OPENTYPE_MATH)
     
    3233#endif
    3334#include "SharedBuffer.h"
    34 #include "SimpleFontData.h"
    3535
    3636using namespace std;
     
    236236
    237237#if ENABLE(OPENTYPE_MATH)
    238 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& fontData)
    239 {
    240     m_mathBuffer = fontData.openTypeTable(OpenType::MATHTag);
     238OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
     239{
     240    m_mathBuffer = font.openTypeTable(OpenType::MATHTag);
    241241    const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer);
    242242    if (!math) {
     
    266266
    267267#if ENABLE(OPENTYPE_MATH)
    268 float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant constant) const
     268float OpenTypeMathData::getMathConstant(const Font& font, MathConstant constant) const
    269269{
    270270    int32_t value = 0;
     
    289289    return value * font.sizePerUnit();
    290290#else
    291 float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) const
     291float OpenTypeMathData::getMathConstant(const Font&, MathConstant) const
    292292{
    293293    ASSERT_NOT_REACHED();
     
    297297
    298298#if ENABLE(OPENTYPE_MATH)
    299 float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph glyph) const
     299float OpenTypeMathData::getItalicCorrection(const Font& font, Glyph glyph) const
    300300{
    301301    const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer);
     
    311311    return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit();
    312312#else
    313 float OpenTypeMathData::getItalicCorrection(const SimpleFontData&, Glyph) const
     313float OpenTypeMathData::getItalicCorrection(const Font&, Glyph) const
    314314{
    315315    ASSERT_NOT_REACHED();
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h

    r177955 r178940  
    3636class FontPlatformData;
    3737class SharedBuffer;
    38 class SimpleFontData;
     38class Font;
    3939
    4040class OpenTypeMathData : public RefCounted<OpenTypeMathData> {
    4141public:
    42     static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& fontData)
     42    static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& font)
    4343    {
    44         return adoptRef(new OpenTypeMathData(fontData));
     44        return adoptRef(new OpenTypeMathData(font));
    4545    }
    4646    ~OpenTypeMathData();
     
    114114    };
    115115
    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;
    118118    void getMathVariants(Glyph, bool isVertical, Vector<Glyph>& sizeVariants, Vector<AssemblyPart>& assemblyParts) const;
    119119
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp

    r166640 r178940  
    2828
    2929#include "FloatRect.h"
     30#include "Font.h"
    3031#include "GlyphPage.h"
    3132#include "OpenTypeTypes.h"
    3233#include "SharedBuffer.h"
    33 #include "SimpleFontData.h"
    3434#include <wtf/RefPtr.h>
    3535
     
    480480}
    481481
    482 float OpenTypeVerticalData::advanceHeight(const SimpleFontData* font, Glyph glyph) const
     482float OpenTypeVerticalData::advanceHeight(const Font* font, Glyph glyph) const
    483483{
    484484    size_t countHeights = m_advanceHeights.size();
     
    493493}
    494494
    495 void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const SimpleFontData* font, const Glyph* glyphs, size_t count, float* outXYArray) const
     495void OpenTypeVerticalData::getVerticalTranslationsForGlyphs(const Font* font, const Glyph* glyphs, size_t count, float* outXYArray) const
    496496{
    497497    size_t countWidths = m_advanceWidths.size();
     
    536536}
    537537
    538 void OpenTypeVerticalData::substituteWithVerticalGlyphs(const SimpleFontData* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const
     538void OpenTypeVerticalData::substituteWithVerticalGlyphs(const Font* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const
    539539{
    540540    const HashMap<Glyph, Glyph>& map = m_verticalGlyphMap;
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h

    r134871 r178940  
    3636namespace WebCore {
    3737
     38class Font;
    3839class FontPlatformData;
    3940class GlyphPage;
    40 class SimpleFontData;
    4141
    4242class OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> {
     
    4949    bool isOpenType() const { return !m_advanceWidths.isEmpty(); }
    5050    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;
    5454
    5555private:
  • trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp

    r178510 r178940  
    2929#include "AffineTransform.h"
    3030#include "FloatConversion.h"
     31#include "Font.h"
    3132#include "GlyphBuffer.h"
    3233#include "GraphicsContext.h"
    3334#include "IntRect.h"
    34 #include "SimpleFontData.h"
    3535#include "UniscribeController.h"
    3636#include "WebCoreTextRenderer.h"
     
    128128}
    129129
    130 void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
     130void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const Font* font, const GlyphBuffer& glyphBuffer,
    131131    int from, int numGlyphs, const FloatPoint& point) const
    132132{
  • trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp

    r178521 r178940  
    2929#include "config.h"
    3030#include <winsock2.h>
     31#include "Font.h"
    3132#include "FontCache.h"
    3233#include "HWndDC.h"
    33 #include "SimpleFontData.h"
    3434#include <mlang.h>
    3535#include <windows.h>
     
    200200}
    201201
    202 RefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDescription& description, const SimpleFontData* originalFontData, bool, const UChar* characters, int length)
     202RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
    203203{
    204204    UChar character = characters[0];
    205     RefPtr<SimpleFontData> fontData;
     205    RefPtr<Font> fontData;
    206206    HWndDC hdc(0);
    207207    HFONT primaryFont = originalFontData->platformData().hfont();
     
    310310}
    311311
    312 RefPtr<SimpleFontData> FontCache::fontDataFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
     312RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
    313313{
    314314    AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
    315     RefPtr<SimpleFontData> fontData = fontForFamily(fontDescription, familyName);
     315    RefPtr<Font> fontData = fontForFamily(fontDescription, familyName);
    316316    if (fontData)
    317317        outFontFamilyName = familyName;
     
    319319}
    320320
    321 Ref<SimpleFontData> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
     321Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
    322322{
    323323    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, fallbackFontName, ());
     
    338338        AtomicString("Arial", AtomicString::ConstructFromLiteral)
    339339    };
    340     RefPtr<SimpleFontData> simpleFont;
     340    RefPtr<Font> simpleFont;
    341341    for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) {
    342342        if (simpleFont = fontForFamily(fontDescription, fallbackFonts[i])) {
     
    350350        LOGFONT defaultGUILogFont;
    351351        GetObject(defaultGUIFont, sizeof(defaultGUILogFont), &defaultGUILogFont);
    352         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName))
     352        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, defaultGUILogFont, fallbackFontName))
    353353            return *simpleFont;
    354354    }
     
    358358    nonClientMetrics.cbSize = sizeof(nonClientMetrics);
    359359    if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) {
    360         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))
     360        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))
    361361            return *simpleFont;
    362         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))
     362        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))
    363363            return *simpleFont;
    364         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))
     364        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))
    365365            return *simpleFont;
    366         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))
     366        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))
    367367            return *simpleFont;
    368         if (simpleFont = fontDataFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
     368        if (simpleFont = fontFromDescriptionAndLogFont(fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
    369369            return *simpleFont;
    370370    }
  • trunk/Source/WebCore/platform/graphics/win/FontWin.cpp

    r178510 r178940  
    2727#include "FontCascade.h"
    2828
     29#include "Font.h"
    2930#include "FontGlyphs.h"
    3031#include "GlyphBuffer.h"
     
    3334#include "LayoutRect.h"
    3435#include "Logging.h"
    35 #include "SimpleFontData.h"
    3636#include "TextRun.h"
    3737#include "UniscribeController.h"
     
    121121}
    122122
    123 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     123float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    124124{
    125125    UniscribeController controller(this, run, fallbackFonts);
  • trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp

    r177876 r178940  
    3030#include "GlyphPage.h"
    3131
    32 #include "SimpleFontData.h"
     32#include "Font.h"
    3333#include <WebKitSystemInterface/WebKitSystemInterface.h>
    3434
    3535namespace WebCore {
    3636
    37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     37bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
    3838{
    3939    // 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  
    3030#include "GlyphPage.h"
    3131
     32#include "Font.h"
    3233#include "HWndDC.h"
    33 #include "SimpleFontData.h"
    3434
    3535namespace WebCore {
    3636
    37 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     37bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const Font* fontData)
    3838{
    3939    // 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  
    2828
    2929#include "config.h"
    30 #include "SimpleFontData.h"
     30#include "Font.h"
    3131
    3232#include "FloatRect.h"
     
    4949using namespace std;
    5050
    51 void SimpleFontData::platformInit()
     51void Font::platformInit()
    5252{
    5353    m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
     
    104104}
    105105
    106 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     106FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
    107107{
    108108    if (!platformData().size())
     
    123123}
    124124
    125 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
     125float Font::platformWidthForGlyph(Glyph glyph) const
    126126{
    127127    if (!platformData().size())
  • trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp

    r178510 r178940  
    2828
    2929#include "config.h"
    30 #include "SimpleFontData.h"
     30#include "Font.h"
    3131
    3232#include <windows.h>
     
    4242namespace WebCore {
    4343
    44 void SimpleFontData::platformInit()
     44void Font::platformInit()
    4545{
    4646    m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
     
    104104}
    105105
    106 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
     106FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
    107107{
    108108    if (m_platformData.useGDI())
     
    112112}
    113113   
    114 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
     114float Font::platformWidthForGlyph(Glyph glyph) const
    115115{
    116116    if (m_platformData.useGDI())
  • trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp

    r178510 r178940  
    2828
    2929#include "config.h"
    30 #include "SimpleFontData.h"
     30#include "Font.h"
    3131
    3232#include "FontCache.h"
     
    4444static bool g_shouldApplyMacAscentHack;
    4545
    46 void SimpleFontData::setShouldApplyMacAscentHack(bool b)
     46void Font::setShouldApplyMacAscentHack(bool b)
    4747{
    4848    g_shouldApplyMacAscentHack = b;
    4949}
    5050
    51 bool SimpleFontData::shouldApplyMacAscentHack()
     51bool Font::shouldApplyMacAscentHack()
    5252{
    5353    return g_shouldApplyMacAscentHack;
    5454}
    5555
    56 float SimpleFontData::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent)
     56float Font::ascentConsideringMacAscentHack(const WCHAR* faceName, float ascent, float descent)
    5757{
    5858    if (!shouldApplyMacAscentHack())
     
    7272}
    7373
    74 void SimpleFontData::initGDIFont()
     74void Font::initGDIFont()
    7575{
    7676    if (!m_platformData.size()) {
     
    107107}
    108108
    109 void SimpleFontData::platformCharWidthInit()
     109void Font::platformCharWidthInit()
    110110{
    111111    // GDI Fonts init charwidths in initGDIFont.
     
    117117}
    118118
    119 void SimpleFontData::platformDestroy()
     119void Font::platformDestroy()
    120120{
    121121    ScriptFreeCache(&m_scriptCache);
     
    123123}
    124124
    125 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
     125PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
    126126{
    127127    float scaledSize = scaleFactor * m_platformData.size();
     
    129129        FontPlatformData scaledFont(m_platformData);
    130130        scaledFont.setSize(scaledSize);
    131         return SimpleFontData::create(scaledFont, true, false);
     131        return Font::create(scaledFont, true, false);
    132132    }
    133133
     
    136136    winfont.lfHeight = -lroundf(scaledSize * (m_platformData.useGDI() ? 1 : 32));
    137137    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
     141void Font::determinePitch()
    142142{
    143143    if (isCustomFont()) {
     
    160160}
    161161
    162 FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const
     162FloatRect Font::boundsForGDIGlyph(Glyph glyph) const
    163163{
    164164    HWndDC hdc(0);
     
    176176}
    177177
    178 float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
     178float Font::widthForGDIGlyph(Glyph glyph) const
    179179{
    180180    HWndDC hdc(0);
     
    192192}
    193193
    194 SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
     194SCRIPT_FONTPROPERTIES* Font::scriptFontProperties() const
    195195{
    196196    if (!m_scriptFontProperties) {
  • trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp

    r178510 r178940  
    2626#include "config.h"
    2727#include "UniscribeController.h"
     28
     29#include "Font.h"
    2830#include "FontCascade.h"
    2931#include "HWndDC.h"
    30 #include "SimpleFontData.h"
    3132#include "TextRun.h"
    3233#include <wtf/MathExtras.h>
     
    4243// take the GlyphBuffer as an arg so that we don't have to populate the glyph buffer when
    4344// measuring.
    44 UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts)
     45UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const Font*>* fallbackFonts)
    4546    : m_font(*font)
    4647    , m_run(run)
     
    137138    const UChar* end = m_run.rtl() ? cp - 1 : cp + length;
    138139
    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;
    141142
    142143    UChar newC = 0;
     
    159160
    160161        bool forceSmallCaps = isSmallCaps && (U_GET_GC_MASK(c) & U_GC_M_MASK);
    161         nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).fontData;
     162        nextFontData = m_font.glyphDataForCharacter(*curr, false, forceSmallCaps ? SmallCapsVariant : AutoVariant).font;
    162163        if (m_font.isSmallCaps()) {
    163164            nextIsSmallCaps = forceSmallCaps || (newC = u_toupper(c)) != c;
     
    166167        }
    167168
    168         if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFontData())
     169        if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFont())
    169170            m_fallbackFonts->add(fontData);
    170171
     
    180181    int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : length - indexOfFontTransition;
    181182    if (itemLength) {
    182         if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFontData())
     183        if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFont())
    183184            m_fallbackFonts->add(nextFontData);
    184185
     
    191192}
    192193
    193 void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
     194void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const Font* fontData, GlyphBuffer* glyphBuffer)
    194195{
    195196    // ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1.  This is why there is an extra empty item
     
    233234}
    234235
    235 bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
     236bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const Font* fontData, GlyphBuffer* glyphBuffer)
    236237{
    237238    // Determine the string for this item.
     
    405406}
    406407
    407 bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,
     408bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const Font* fontData,
    408409                                Vector<WORD>& glyphs, Vector<WORD>& clusters,
    409410                                Vector<SCRIPT_VISATTR>& visualAttributes)
  • trunk/Source/WebCore/platform/graphics/win/UniscribeController.h

    r178510 r178940  
    3636class UniscribeController {
    3737public:
    38     UniscribeController(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0);
     38    UniscribeController(const FontCascade*, const TextRun&, HashSet<const Font*>* fallbackFonts = 0);
    3939
    4040    // Advance and measure/place up to the specified character.
     
    5555    void resetControlAndState();
    5656
    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*,
    6060               Vector<WORD>& glyphs, Vector<WORD>& clusters,
    6161               Vector<SCRIPT_VISATTR>& visualAttributes);
     
    6363    const FontCascade& m_font;
    6464    const TextRun& m_run;
    65     HashSet<const SimpleFontData*>* m_fallbackFonts;
     65    HashSet<const Font*>* m_fallbackFonts;
    6666    FloatPoint m_glyphOrigin;
    6767    float m_minGlyphBoundingBoxX;
  • trunk/Source/WebCore/platform/win/PopupMenuWin.cpp

    r178520 r178940  
    2727#include "Document.h"
    2828#include "FloatRect.h"
     29#include "Font.h"
    2930#include "FontSelector.h"
    3031#include "Frame.h"
     
    4344#include "Scrollbar.h"
    4445#include "ScrollbarTheme.h"
    45 #include "SimpleFontData.h"
    4646#include "TextRun.h"
    4747#include "WebCoreInstanceHandle.h"
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r178510 r178940  
    450450    const RenderStyle& lineStyle = this->lineStyle();
    451451    if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright
    452         || lineStyle.fontCascade().primaryFontData().hasVerticalGlyphs())
     452        || lineStyle.fontCascade().primaryFont().hasVerticalGlyphs())
    453453        return true;
    454454
     
    461461                return true;
    462462        } else {
    463             if (child->lineStyle().fontCascade().primaryFontData().hasVerticalGlyphs())
     463            if (child->lineStyle().fontCascade().primaryFont().hasVerticalGlyphs())
    464464                return true;
    465465           
    466             const Vector<const SimpleFontData*>* usedFonts = nullptr;
     466            const Vector<const Font*>* usedFonts = nullptr;
    467467            if (is<InlineTextBox>(*child)) {
    468468                GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(downcast<InlineTextBox>(child));
     
    471471
    472472            if (usedFonts) {
    473                 for (const SimpleFontData* fontData : *usedFonts) {
    474                     if (fontData->hasVerticalGlyphs())
     473                for (const Font* font : *usedFonts) {
     474                    if (font->hasVerticalGlyphs())
    475475                        return true;
    476476                }
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r176354 r178940  
    3232class InlineTextBox;
    3333class RenderLineBoxList;
    34 class SimpleFontData;
     34class Font;
    3535class VerticalPositionCache;
    3636
    3737struct GlyphOverflow;
    3838
    39 typedef HashMap<const InlineTextBox*, std::pair<Vector<const SimpleFontData*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap;
     39typedef HashMap<const InlineTextBox*, std::pair<Vector<const Font*>, GlyphOverflow>> GlyphOverflowAndFallbackFontsMap;
    4040
    4141class InlineFlowBox : public InlineBox {
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r178510 r178940  
    13821382    TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath());
    13831383    run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
    1384     if (font.primaryFontData().isSVGFont())
     1384    if (font.primaryFont().isSVGFont())
    13851385        run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
    13861386
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r178822 r178940  
    23262326
    23272327    // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
    2328     float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
     2328    float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth();
    23292329    if (!maxCharWidth)
    23302330        return left;
     
    23662366
    23672367    // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
    2368     float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
     2368    float maxCharWidth = lineGrid->style().fontCascade().primaryFont().maxCharWidth();
    23692369    if (!maxCharWidth)
    23702370        return right;
     
    37063706
    37073707    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
    3708     if (font.primaryFontData().isSVGFont()) {
     3708    if (font.primaryFont().isSVGFont()) {
    37093709        ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
    37103710        run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     
    37263726    }
    37273727    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
    3728     if (font.primaryFontData().isSVGFont()) {
     3728    if (font.primaryFont().isSVGFont()) {
    37293729        ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
    37303730        run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r178510 r178940  
    459459    GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
    460460{
    461     HashSet<const SimpleFontData*> fallbackFonts;
     461    HashSet<const Font*> fallbackFonts;
    462462    GlyphOverflow glyphOverflow;
    463463
     
    510510                measuredWidth += wordMeasurement.width;
    511511            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)
    514514                    fallbackFonts.add(*it);
    515515            }
     
    528528    if (!fallbackFonts.isEmpty()) {
    529529        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;
    531531        ASSERT(it->value.first.isEmpty());
    532532        copyToVector(fallbackFonts, it->value.first);
     
    540540    if (!glyphOverflow.isEmpty()) {
    541541        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;
    543543        it->value.second = glyphOverflow;
    544544        run->box()->clearKnownToHaveNoOverflow();
  • trunk/Source/WebCore/rendering/RenderCombineText.cpp

    r178510 r178940  
    5858}
    5959
    60 float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     60float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    6161{
    6262    if (m_isCombined)
  • trunk/Source/WebCore/rendering/RenderCombineText.h

    r178510 r178940  
    4747
    4848    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;
    5050    virtual const char* renderName() const override { return "RenderCombineText"; }
    5151    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
  • trunk/Source/WebCore/rendering/RenderSearchField.cpp

    r178510 r178940  
    2828#include "CSSValueKeywords.h"
    2929#include "Chrome.h"
     30#include "Font.h"
    3031#include "Frame.h"
    3132#include "FrameSelection.h"
     
    4344#include "SearchPopupMenu.h"
    4445#include "Settings.h"
    45 #include "SimpleFontData.h"
    4646#include "StyleResolver.h"
    4747#include "TextControlInnerElements.h"
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r178510 r178940  
    452452}
    453453
    454 ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
     454ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
    455455{
    456456    if (style.hasTextCombine() && is<RenderCombineText>(*this)) {
     
    631631void RenderText::computePreferredLogicalWidths(float leadWidth)
    632632{
    633     HashSet<const SimpleFontData*> fallbackFonts;
     633    HashSet<const Font*> fallbackFonts;
    634634    GlyphOverflow glyphOverflow;
    635635    computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow);
     
    644644}
    645645
    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)
     646static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const FontCascade& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const Font*>& fallbackFonts, GlyphOverflow& glyphOverflow)
    647647{
    648648    suffixStart = 0;
     
    684684}
    685685
    686 void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
     686void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow& glyphOverflow)
    687687{
    688688    ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
     
    12071207}
    12081208
    1209 float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     1209float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    12101210{
    12111211    if (from >= textLength())
     
    12191219}
    12201220
    1221 float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
     1221float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    12221222{
    12231223    ASSERT(from + len <= textLength());
  • trunk/Source/WebCore/rendering/RenderText.h

    r178510 r178940  
    9090    void positionLineBox(InlineTextBox&);
    9191
    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;
    9494
    9595    float minLogicalWidth() const;
     
    181181    virtual bool canHaveChildren() const override final { return false; }
    182182
    183     void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&);
     183    void computePreferredLogicalWidths(float leadWidth, HashSet<const Font*>& fallbackFonts, GlyphOverflow&);
    184184
    185185    bool computeCanUseSimpleFontCodePath() const;
     
    193193
    194194    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;
    196196    bool isAllASCII() const { return m_isAllASCII; }
    197197    bool computeUseBackslashAsYenSymbol() const;
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r178510 r178940  
    2828#include "CSSValueKeywords.h"
    2929#include "Chrome.h"
     30#include "Font.h"
    3031#include "Frame.h"
    3132#include "FrameSelection.h"
     
    4142#include "RenderView.h"
    4243#include "Settings.h"
    43 #include "SimpleFontData.h"
    4444#include "StyleResolver.h"
    4545#include "TextControlInnerElements.h"
     
    347347        maxCharWidth = scaleEmToUnits(4027);
    348348    else if (style().fontCascade().hasValidAverageCharWidth())
    349         maxCharWidth = roundf(style().fontCascade().primaryFontData().maxCharWidth());
     349        maxCharWidth = roundf(style().fontCascade().primaryFont().maxCharWidth());
    350350#endif
    351351
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r178510 r178940  
    581581   
    582582    RenderObject* renderer = inputElement.renderer();
    583     if (font.primaryFontData().isSVGFont() && !renderer)
     583    if (font.primaryFont().isSVGFont() && !renderer)
    584584        return;
    585585   
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r178510 r178940  
    886886    }
    887887
    888     Vector<const SimpleFontData*>* usedFonts = nullptr;
     888    Vector<const Font*>* usedFonts = nullptr;
    889889    GlyphOverflow* glyphOverflow = nullptr;
    890890    if (is<InlineTextBox>(box)) {
     
    902902    const RenderStyle& boxLineStyle = box.lineStyle();
    903903    if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) {
    904         usedFonts->append(&boxLineStyle.fontCascade().primaryFontData());
     904        usedFonts->append(&boxLineStyle.fontCascade().primaryFont());
    905905        for (size_t i = 0; i < usedFonts->size(); ++i) {
    906906            const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
  • trunk/Source/WebCore/rendering/SimpleLineLayout.cpp

    r178939 r178940  
    5353
    5454template <typename CharacterType>
    55 static bool canUseForText(const CharacterType* text, unsigned length, const SimpleFontData& fontData)
     55static bool canUseForText(const CharacterType* text, unsigned length, const Font& font)
    5656{
    5757    // FIXME: <textarea maxlength=0> generates empty text node.
     
    7676            return false;
    7777
    78         if (!fontData.glyphForCharacter(character))
     78        if (!font.glyphForCharacter(character))
    7979            return false;
    8080    }
     
    8282}
    8383
    84 static bool canUseForText(const RenderText& textRenderer, const SimpleFontData& fontData)
     84static bool canUseForText(const RenderText& textRenderer, const Font& font)
    8585{
    8686    if (textRenderer.is8Bit())
    87         return canUseForText(textRenderer.characters8(), textRenderer.textLength(), fontData);
    88     return canUseForText(textRenderer.characters16(), textRenderer.textLength(), fontData);
     87        return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font);
     88    return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font);
    8989}
    9090
     
    185185        }
    186186    }
    187     if (style.fontCascade().primaryFontData().isSVGFont())
     187    if (style.fontCascade().primaryFont().isSVGFont())
    188188        return false;
    189189    // We assume that all lines have metrics based purely on the primary font.
    190     auto& primaryFontData = style.fontCascade().primaryFontData();
    191     if (primaryFontData.isLoading())
     190    auto& primaryFont = style.fontCascade().primaryFont();
     191    if (primaryFont.isLoading())
    192192        return false;
    193193    for (const auto& textRenderer : childrenOfType<RenderText>(flow)) {
     
    197197        if (style.fontCascade().codePath(TextRun(textRenderer.text())) != FontCascade::Simple)
    198198            return false;
    199         if (!canUseForText(textRenderer, primaryFontData))
     199        if (!canUseForText(textRenderer, primaryFont))
    200200            return false;
    201201    }
  • trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h

    r178510 r178940  
    6060    int startOffset;
    6161    int endOffset;
    62     HashSet<const SimpleFontData*> fallbackFonts;
     62    HashSet<const Font*> fallbackFonts;
    6363};
    6464
     
    487487}
    488488
    489 inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const SimpleFontData*>* fallbackFonts = 0)
     489inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const Font*>* fallbackFonts = 0)
    490490{
    491491    const RenderStyle& style = renderer->style();
     
    493493}
    494494
    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)
     495ALWAYS_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)
    496496{
    497497    const RenderStyle& style = text->style();
     
    579579
    580580#if !ASSERT_DISABLED
    581     HashSet<const SimpleFontData*> fallbackFonts;
     581    HashSet<const Font*> fallbackFonts;
    582582    float prefixWidth = hyphenWidth + textWidth(text, lastSpace, prefixLength, font, xPos, isFixedPitch, collapseWhiteSpace, fallbackFonts) + lastSpaceWordSpacing;
    583583    ASSERT(xPos + prefixWidth <= availableWidth);
     
    657657    // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
    658658    // words with their trailing space, then subtract its width.
    659     HashSet<const SimpleFontData*> fallbackFonts;
     659    HashSet<const Font*> fallbackFonts;
    660660    float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !textLayout ? font.width(RenderBlock::constructTextRun(&renderText, font, &space, 1, style), &fallbackFonts) + wordSpacing : 0;
    661661
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r178510 r178940  
    13341334FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData& data) const
    13351335{
    1336     return data.fontData->boundsForGlyph(data.glyph);
     1336    return data.font->boundsForGlyph(data.glyph);
    13371337}
    13381338
     
    13441344float RenderMathMLOperator::advanceForGlyph(const GlyphData& data) const
    13451345{
    1346     return data.fontData->widthForGlyph(data.glyph);
     1346    return data.font->widthForGlyph(data.glyph);
    13471347}
    13481348
     
    15221522        bottom.glyph = extension.glyph;
    15231523
    1524     top.fontData = &style().fontCascade().primaryFontData();
    1525     extension.fontData = top.fontData;
    1526     bottom.fontData = top.fontData;
     1524    top.font = &style().fontCascade().primaryFont();
     1525    extension.font = top.font;
     1526    bottom.font = top.font;
    15271527    if (middle.glyph)
    1528         middle.fontData = top.fontData;
     1528        middle.font = top.font;
    15291529
    15301530    stretchyData.setGlyphAssemblyMode(top, extension, bottom, middle);
     
    15391539    ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
    15401540
    1541     const auto& primaryFontData = style().fontCascade().primaryFontData();
     1541    const auto& primaryFont = style().fontCascade().primaryFont();
    15421542    GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
    1543     if (!primaryFontData.mathData() || baseGlyph.fontData != &primaryFontData)
     1543    if (!primaryFont.mathData() || baseGlyph.font != &primaryFont)
    15441544        return data;
    15451545
     
    15481548
    15491549    // 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.fontData->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData.mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight));
    1551 
    1552     primaryFontData.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);
    15531553
    15541554    // We choose the first size variant that is larger than the expected displayOperatorMinHeight and otherwise fallback to the largest variant.
     
    15561556        GlyphData sizeVariant;
    15571557        sizeVariant.glyph = variant;
    1558         sizeVariant.fontData = &primaryFontData;
     1558        sizeVariant.font = &primaryFont;
    15591559        data.setSizeVariantMode(sizeVariant);
    15601560        if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight)
     
    15711571    StretchyData assemblyData;
    15721572
    1573     const auto& primaryFontData = style().fontCascade().primaryFontData();
     1573    const auto& primaryFont = style().fontCascade().primaryFont();
    15741574    GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
    15751575   
    1576     if (primaryFontData.mathData() && baseGlyph.fontData == &primaryFontData) {
     1576    if (primaryFont.mathData() && baseGlyph.font == &primaryFont) {
    15771577        Vector<Glyph> sizeVariants;
    15781578        Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
    1579         primaryFontData.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
     1579        primaryFont.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
    15801580        // We verify the size variants.
    15811581        for (auto& variant : sizeVariants) {
    15821582            GlyphData sizeVariant;
    15831583            sizeVariant.glyph = variant;
    1584             sizeVariant.fontData = &primaryFontData;
     1584            sizeVariant.font = &primaryFont;
    15851585            if (maximumGlyphWidth)
    15861586                *maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(sizeVariant));
     
    18021802
    18031803    GlyphBuffer buffer;
    1804     buffer.add(data.glyph, data.fontData, advanceForGlyph(data));
    1805     info.context->drawGlyphs(style().fontCascade(), *data.fontData, 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);
    18061806
    18071807    return glyphPaintRect;
     
    18951895        ASSERT(m_stretchyData.variant().glyph);
    18961896        GlyphBuffer buffer;
    1897         buffer.add(m_stretchyData.variant().glyph, m_stretchyData.variant().fontData, advanceForGlyph(m_stretchyData.variant()));
     1897        buffer.add(m_stretchyData.variant().glyph, m_stretchyData.variant().font, advanceForGlyph(m_stretchyData.variant()));
    18981898        LayoutPoint operatorTopLeft = ceiledIntPoint(paintOffset + location());
    18991899        FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant());
    19001900        LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y());
    1901         info.context->drawGlyphs(style().fontCascade(), *m_stretchyData.variant().fontData, buffer, 0, 1, operatorOrigin);
     1901        info.context->drawGlyphs(style().fontCascade(), *m_stretchyData.variant().font, buffer, 0, 1, operatorOrigin);
    19021902        return;
    19031903    }
     
    19811981LayoutUnit RenderMathMLOperator::trailingSpaceError()
    19821982{
    1983     const auto& primaryFontData = style().fontCascade().primaryFontData();
    1984     if (!primaryFontData.mathData())
     1983    const auto& primaryFont = style().fontCascade().primaryFont();
     1984    if (!primaryFont.mathData())
    19851985        return 0;
    19861986
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h

    r177259 r178940  
    2929#if ENABLE(MATHML)
    3030
     31#include "Font.h"
    3132#include "GlyphPage.h"
    3233#include "MathMLElement.h"
    3334#include "OpenTypeMathData.h"
    3435#include "RenderMathMLToken.h"
    35 #include "SimpleFontData.h"
    3636
    3737namespace WebCore {
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp

    r178510 r178940  
    6464void RenderMathMLRadicalOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
    6565{
    66     if (!style().fontCascade().primaryFontData().mathData()) {
     66    if (!style().fontCascade().primaryFont().mathData()) {
    6767        // If we do not have an OpenType MATH font, we always make the radical depth a bit larger than the target.
    6868        depthBelowBaseline += gRadicalBottomPointLower;
     
    8484    ASSERT(preferredLogicalWidthsDirty());
    8585
    86     if (style().fontCascade().primaryFontData().mathData()) {
     86    if (style().fontCascade().primaryFont().mathData()) {
    8787        RenderMathMLOperator::computePreferredLogicalWidths();
    8888        return;
     
    9797void RenderMathMLRadicalOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
    9898{
    99     if (style().fontCascade().primaryFontData().mathData()) {
     99    if (style().fontCascade().primaryFont().mathData()) {
    100100        RenderMathMLOperator::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
    101101        return;
     
    112112        return;
    113113
    114     if (style().fontCascade().primaryFontData().mathData()) {
     114    if (style().fontCascade().primaryFont().mathData()) {
    115115        RenderMathMLOperator::paint(info, paintOffset);
    116116        return;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

    r178510 r178940  
    209209    m_degreeBottomRaisePercent = 0.6f;
    210210
    211     const auto& primaryFontData = style().fontCascade().primaryFontData();
    212     if (auto* mathData = style().fontCascade().primaryFontData().mathData()) {
     211    const auto& primaryFont = style().fontCascade().primaryFont();
     212    if (auto* mathData = style().fontCascade().primaryFont().mathData()) {
    213213        // FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737).
    214         m_verticalGap = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap);
    215         m_ruleThickness = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness);
    216         m_extraAscender = mathData->getMathConstant(primaryFontData, 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);
    217217
    218218        if (!isRenderMathMLSquareRoot()) {
    219             kernBeforeDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree);
    220             kernAfterDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree);
    221             m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent);
     219            kernBeforeDegree = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalKernBeforeDegree);
     220            kernAfterDegree = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalKernAfterDegree);
     221            m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFont, OpenTypeMathData::RadicalDegreeBottomRaisePercent);
    222222        }
    223223    }
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r178510 r178940  
    11851185    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinus, 1));
    11861186    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphen, 1));
    1187     return fontCascade().primaryFontData().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
     1187    return fontCascade().primaryFont().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
    11881188}
    11891189
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r178250 r178940  
    2929
    3030#include "FloatQuad.h"
     31#include "Font.h"
    3132#include "GraphicsContext.h"
    3233#include "HitTestRequest.h"
     
    4647#include "SVGTransformList.h"
    4748#include "SVGURIReference.h"
    48 #include "SimpleFontData.h"
    4949#include "TransformState.h"
    5050#include "VisiblePosition.h"
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r178510 r178940  
    420420                , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);
    421421
    422     if (style->fontCascade().primaryFontData().isSVGFont())
     422    if (style->fontCascade().primaryFont().isSVGFont())
    423423        run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
    424424
  • trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp

    r178510 r178940  
    4242{
    4343#if ENABLE(SVG_FONTS)
    44     const SimpleFontData& fontData = m_font.primaryFontData();
    45     if (!fontData.isSVGFont()) {
     44    const Font& font = m_font.primaryFont();
     45    if (!font.isSVGFont()) {
    4646        m_lastGlyph.isValid = false;
    4747        return 0;
    4848    }
    4949
    50     ASSERT(fontData.isCustomFont());
    51     ASSERT(fontData.isSVGFont());
     50    ASSERT(font.isCustomFont());
     51    ASSERT(font.isSVGFont());
    5252
    53     auto* svgFontData = static_cast<const SVGFontData*>(fontData.svgData());
     53    auto* svgFontData = static_cast<const SVGFontData*>(font.svgData());
    5454    SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement();
    5555    ASSERT(svgFontFace);
  • trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp

    r178510 r178940  
    7171                , isOverride(style.unicodeBidi()) /* directionalOverride */);
    7272
    73     if (style.fontCascade().primaryFontData().isSVGFont())
     73    if (style.fontCascade().primaryFont().isSVGFont())
    7474        run.setRenderingContext(SVGTextRunRenderingContext::create(text));
    7575
     
    9292SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText& text, unsigned position, unsigned length, float width, const String& glyphName)
    9393{
    94     bool needsContext = text.style().fontCascade().primaryFontData().isSVGFont();
     94    bool needsContext = text.style().fontCascade().primaryFont().isSVGFont();
    9595    float scalingFactor = text.scalingFactor();
    9696    ASSERT(scalingFactor);
  • trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp

    r178510 r178940  
    3838namespace WebCore {
    3939
    40 static inline const SVGFontData* svgFontAndFontFaceElementForFontData(const SimpleFontData* fontData, SVGFontFaceElement*& fontFace, SVGFontElement*& font)
    41 {
    42     ASSERT(fontData);
    43     ASSERT(fontData->isCustomFont());
    44     ASSERT(fontData->isSVGFont());
    45 
    46     auto* svgFontData = static_cast<const SVGFontData*>(fontData->svgData());
    47 
    48     fontFace = svgFontData->svgFontFaceElement();
    49     ASSERT(fontFace);
    50 
    51     font = fontFace->associatedFontElement();
     40static 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();
    5252    return svgFontData;
    5353}
     
    6262}
    6363
    64 bool SVGTextRunRenderingContext::applySVGKerning(const SimpleFontData* fontData, WidthIterator& iterator, GlyphBuffer* glyphBuffer, int from) const
     64bool SVGTextRunRenderingContext::applySVGKerning(const Font* font, WidthIterator& iterator, GlyphBuffer* glyphBuffer, int from) const
    6565{
    6666    ASSERT(glyphBuffer);
     
    6969    SVGFontFaceElement* fontFaceElement = 0;
    7070
    71     svgFontAndFontFaceElementForFontData(fontData, fontFaceElement, fontElement);
     71    svgFontAndFontFaceElementForFontData(font, fontFaceElement, fontElement);
    7272    if (!fontElement || !fontFaceElement)
    7373        return false;
     
    7676        return true;
    7777
    78     float scale = scaleEmToUnits(fontData->platformData().size(), fontFaceElement->unitsPerEm());
     78    float scale = scaleEmToUnits(font->platformData().size(), fontFaceElement->unitsPerEm());
    7979
    8080    String lastGlyphName;
     
    206206
    207207        ++m_index;
    208         if (m_index >= m_stoppingPoint || !m_glyphBuffer.fontDataAt(m_index)->isSVGFont())
     208        if (m_index >= m_stoppingPoint || !m_glyphBuffer.fontAt(m_index)->isSVGFont())
    209209            break;
    210210        m_glyph = m_glyphBuffer.glyphAt(m_index);
     
    245245};
    246246
    247 std::unique_ptr<GlyphToPathTranslator> SVGTextRunRenderingContext::createGlyphToPathTranslator(const SimpleFontData& fontData, const TextRun* textRun, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
     247std::unique_ptr<GlyphToPathTranslator> SVGTextRunRenderingContext::createGlyphToPathTranslator(const Font& font, const TextRun* textRun, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
    248248{
    249249    SVGFontElement* fontElement = nullptr;
    250250    SVGFontFaceElement* fontFaceElement = nullptr;
    251251
    252     const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(&fontData, fontFaceElement, fontElement);
     252    const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(&font, fontFaceElement, fontElement);
    253253    if (!fontElement || !fontFaceElement)
    254254        return std::make_unique<DummyGlyphToPathTranslator>();
     
    258258    bool isVerticalText = style.svgStyle().isVerticalWritingMode();
    259259
    260     float scale = scaleEmToUnits(fontData.platformData().size(), fontFaceElement->unitsPerEm());
     260    float scale = scaleEmToUnits(font.platformData().size(), fontFaceElement->unitsPerEm());
    261261
    262262    return std::make_unique<SVGGlyphToPathTranslator>(textRun, glyphBuffer, point, *svgFontData, *fontElement, from, numGlyphs, scale, isVerticalText);
    263263}
    264264
    265 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
     265void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
    266266{
    267267    auto activePaintingResource = this->activePaintingResource();
     
    279279
    280280    RenderSVGResourceMode resourceMode = context->textDrawingMode() == TextModeStroke ? ApplyToStrokeMode : ApplyToFillMode;
    281     for (auto translator = createGlyphToPathTranslator(*fontData, nullptr, glyphBuffer, from, numGlyphs, point); translator->containsMorePaths(); translator->advance()) {
     281    for (auto translator = createGlyphToPathTranslator(*font, nullptr, glyphBuffer, from, numGlyphs, point); translator->containsMorePaths(); translator->advance()) {
    282282        Path glyphPath = translator->path();
    283283        if (activePaintingResource->applyResource(elementRenderer, style, context, resourceMode)) {
     
    293293static GlyphData missingGlyphForFont(const FontCascade& font)
    294294{
    295     const SimpleFontData& primaryFontData = font.primaryFontData();
    296     if (!primaryFontData.isSVGFont())
     295    const Font& primaryFont = font.primaryFont();
     296    if (!primaryFont.isSVGFont())
    297297        return GlyphData();
    298298    SVGFontElement* fontElement;
    299299    SVGFontFaceElement* fontFaceElement;
    300     svgFontAndFontFaceElementForFontData(&primaryFontData, fontFaceElement, fontElement);
    301     return GlyphData(fontElement->missingGlyph(), &primaryFontData);
     300    svgFontAndFontFaceElementForFontData(&primaryFont, fontFaceElement, fontElement);
     301    return GlyphData(fontElement->missingGlyph(), &primaryFont);
    302302}
    303303
     
    308308        return missingGlyphForFont(font);
    309309
    310     ASSERT(glyphData.fontData);
     310    ASSERT(glyphData.font);
    311311
    312312    // Characters enclosed by an <altGlyph> element, may not be registered in the GlyphPage.
    313     if (!glyphData.fontData->isSVGFont()) {
     313    if (!glyphData.font->isSVGFont()) {
    314314        auto& elementRenderer = is<RenderElement>(renderer()) ? downcast<RenderElement>(renderer()) : *renderer().parent();
    315315        if (Element* parentRendererElement = elementRenderer.element()) {
    316316            if (is<SVGAltGlyphElement>(*parentRendererElement))
    317                 glyphData.fontData = &font.primaryFontData();
     317                glyphData.font = &font.primaryFont();
    318318        }
    319319    }
    320320
    321     if (!glyphData.fontData->isSVGFont())
     321    if (!glyphData.font->isSVGFont())
    322322        return glyphData;
    323323
    324324    SVGFontElement* fontElement = nullptr;
    325325    SVGFontFaceElement* fontFaceElement = nullptr;
    326     const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(glyphData.fontData, fontFaceElement, fontElement);
     326    const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(glyphData.font, fontFaceElement, fontElement);
    327327    if (!svgFontData)
    328328        return glyphData;
  • trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h

    r178510 r178940  
    4444
    4545    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;
    4747    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;
    4949#endif
    5050
     
    6161
    6262#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;
    6464#endif
    6565
  • trunk/Source/WebCore/svg/SVGFontData.cpp

    r178510 r178940  
    5858}
    5959
    60 void SVGFontData::initializeFontData(SimpleFontData* fontData, float fontSize)
    61 {
    62     ASSERT(fontData);
     60void SVGFontData::initializeFont(Font* font, float fontSize)
     61{
     62    ASSERT(font);
    6363
    6464    SVGFontFaceElement* svgFontFaceElement = this->svgFontFaceElement();
    6565    ASSERT(svgFontFaceElement);
    6666
    67     fontData->setZeroWidthSpaceGlyph(0);
    68     fontData->determinePitch();
     67    font->setZeroWidthSpaceGlyph(0);
     68    font->determinePitch();
    6969
    7070    unsigned unitsPerEm = svgFontFaceElement->unitsPerEm();
     
    7575    float lineGap = 0.1f * fontSize;
    7676
    77     const GlyphPage* glyphPageZero = fontData->glyphPage(0);
     77    const GlyphPage* glyphPageZero = font->glyphPage(0);
    7878
    7979    if (!xHeight && glyphPageZero) {
    8080        // Fallback if x_heightAttr is not specified for the font element.
    8181        Glyph letterXGlyph = glyphPageZero->glyphDataForCharacter('x').glyph;
    82         xHeight = letterXGlyph ? fontData->widthForGlyph(letterXGlyph) : 2 * ascent / 3;
    83     }
    84 
    85     FontMetrics& fontMetrics = fontData->fontMetrics();
     82        xHeight = letterXGlyph ? font->widthForGlyph(letterXGlyph) : 2 * ascent / 3;
     83    }
     84
     85    FontMetrics& fontMetrics = font->fontMetrics();
    8686    fontMetrics.setUnitsPerEm(unitsPerEm);
    8787    fontMetrics.setAscent(ascent);
     
    9292
    9393    if (!glyphPageZero) {
    94         fontData->setSpaceGlyph(0);
    95         fontData->setSpaceWidths(0);
    96         fontData->setAvgCharWidth(0);
    97         fontData->setMaxCharWidth(ascent);
     94        font->setSpaceGlyph(0);
     95        font->setSpaceWidths(0);
     96        font->setAvgCharWidth(0);
     97        font->setMaxCharWidth(ascent);
    9898        return;
    9999    }
     
    101101    // Calculate space width.
    102102    Glyph spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
    103     fontData->setSpaceGlyph(spaceGlyph);
    104     fontData->setSpaceWidths(fontData->widthForGlyph(spaceGlyph));
     103    font->setSpaceGlyph(spaceGlyph);
     104    font->setSpaceWidths(font->widthForGlyph(spaceGlyph));
    105105
    106106    // Estimate average character width.
    107107    Glyph numeralZeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph;
    108     fontData->setAvgCharWidth(numeralZeroGlyph ? fontData->widthForGlyph(numeralZeroGlyph) : fontData->spaceWidth());
     108    font->setAvgCharWidth(numeralZeroGlyph ? font->widthForGlyph(numeralZeroGlyph) : font->spaceWidth());
    109109
    110110    // Estimate maximum character width.
    111111    Glyph letterWGlyph = glyphPageZero->glyphDataForCharacter('W').glyph;
    112     fontData->setMaxCharWidth(letterWGlyph ? fontData->widthForGlyph(letterWGlyph) : ascent);
     112    font->setMaxCharWidth(letterWGlyph ? font->widthForGlyph(letterWGlyph) : ascent);
    113113}
    114114
     
    209209}
    210210
    211 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) const
    212 {
    213     ASSERT(fontData->isCustomFont());
    214     ASSERT(fontData->isSVGFont());
     211bool 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());
    215215
    216216    SVGFontFaceElement* fontFaceElement = this->svgFontFaceElement();
     
    221221
    222222    if (bufferLength == length)
    223         return fillBMPGlyphs(fontElement, pageToFill, offset, length, buffer, fontData);
     223        return fillBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font);
    224224
    225225    ASSERT(bufferLength == 2 * length);
    226     return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, fontData);
    227 }
    228 
    229 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontData) const
     226    return fillNonBMPGlyphs(fontElement, pageToFill, offset, length, buffer, font);
     227}
     228
     229bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const Font* font) const
    230230{
    231231    bool haveGlyphs = false;
     
    244244        // only possible within the context of a string (eg. arabic form matching).
    245245        haveGlyphs = true;
    246         pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData);
     246        pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font);
    247247        glyphs.clear();
    248248    }
     
    251251}
    252252
    253 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const SimpleFontData* fontData) const
     253bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, const Font* font) const
    254254{
    255255    bool haveGlyphs = false;
     
    269269        // only possible within the context of a string (eg. arabic form matching).
    270270        haveGlyphs = true;
    271         pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, fontData);
     271        pageToFill->setGlyphDataForIndex(offset + i, glyphs.first().tableEntry, font);
    272272        glyphs.clear();
    273273    }
  • trunk/Source/WebCore/svg/SVGFontData.h

    r177975 r178940  
    2222
    2323#if ENABLE(SVG_FONTS)
    24 #include "SimpleFontData.h"
     24#include "Font.h"
    2525
    2626namespace WebCore {
     
    2929class SVGFontFaceElement;
    3030
    31 class SVGFontData : public SimpleFontData::SVGData {
     31class SVGFontData : public Font::SVGData {
    3232public:
    3333    explicit SVGFontData(SVGFontFaceElement*);
    3434    virtual ~SVGFontData() { }
    3535
    36     virtual void initializeFontData(SimpleFontData*, float fontSize) override;
     36    virtual void initializeFont(Font*, float fontSize) override;
    3737    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;
    3939
    4040    bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const;
     
    5151
    5252private:
    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;
    5555
    5656    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, TypesettingFeatures) const = delete;
  • trunk/Source/WebCore/svg/SVGFontElement.h

    r178048 r178940  
    7777    float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const;
    7878
    79     // Used by SimpleFontData/WidthIterator.
     79    // Used by Font/WidthIterator.
    8080    SVGGlyph svgGlyphForGlyph(Glyph);
    8181    Glyph missingGlyph();
  • trunk/Source/WebKit/ios/Misc/EmojiFallbackFontSelector.cpp

    r178394 r178940  
    2828#include "EmojiFallbackFontSelector.h"
    2929
     30#include <WebCore/Font.h>
    3031#include <WebCore/FontCache.h>
    31 #include <WebCore/SimpleFontData.h>
    3232#include <wtf/Assertions.h>
    3333#include <wtf/text/AtomicString.h>
     
    3535using namespace WebCore;
    3636
    37 PassRefPtr<SimpleFontData> EmojiFallbackFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t)
     37PassRefPtr<Font> EmojiFallbackFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t)
    3838{
    3939    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);
    4141    if (!fontData) {
    4242        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  
    3636    virtual WebCore::FontRanges fontRangesForFamily(const WebCore::FontDescription&, const AtomicString&) override { ASSERT_NOT_REACHED(); return WebCore::FontRanges(); }
    3737    virtual bool resolvesFamilyFor(const WebCore::FontDescription&) const override { ASSERT_NOT_REACHED(); return false; }
    38     virtual size_t fallbackFontDataCount() 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;
    4040
    4141    virtual void registerForInvalidationCallbacks(WebCore::FontSelectorClient*) override { }
  • trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm

    r177876 r178940  
    148148+ (size_t)cachedFontDataCount
    149149{
    150     return fontCache().fontDataCount();
     150    return fontCache().fontCount();
    151151}
    152152
    153153+ (size_t)cachedFontDataInactiveCount
    154154{
    155     return fontCache().inactiveFontDataCount();
     155    return fontCache().inactiveFontCount();
    156156}
    157157
  • trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm

    r178510 r178940  
    2929#import <WebCore/ChromeClient.h>
    3030#import <WebCore/EventHandler.h>
     31#import <WebCore/Font.h>
    3132#import <WebCore/Frame.h>
    3233#import <WebCore/FrameView.h>
    3334#import <WebCore/Page.h>
    3435#import <WebCore/PopupMenuClient.h>
    35 #import <WebCore/SimpleFontData.h>
    3636#import <WebCore/WebCoreSystemInterface.h>
    3737
     
    8282        RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]);
    8383        if (style.font() != FontCascade()) {
    84             NSFont *font = style.font().primaryFontData().getNSFont();
     84            NSFont *font = style.font().primaryFont().getNSFont();
    8585            if (!font) {
    86                 CGFloat size = style.font().primaryFontData().platformData().size();
     86                CGFloat size = style.font().primaryFont().platformData().size();
    8787                font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size];
    8888            }
     
    149149   
    150150    NSPoint location;
    151     NSFont* font = m_client->menuStyle().font().primaryFontData().getNSFont();
     151    NSFont* font = m_client->menuStyle().font().primaryFont().getNSFont();
    152152
    153153    // These values were borrowed from AppKit to match their placement of the menu.
  • trunk/Source/WebKit/mac/WebView/WebFrame.mm

    r178575 r178940  
    115115#import <WebCore/EditorClient.h>
    116116#import <WebCore/FocusController.h>
     117#import <WebCore/Font.h>
    117118#import <WebCore/FrameSelection.h>
    118119#import <WebCore/HistoryController.h>
    119120#import <WebCore/NodeTraversal.h>
    120121#import <WebCore/RenderLayer.h>
    121 #import <WebCore/SimpleFontData.h>
    122122#import <WebCore/TextResourceDecoder.h>
    123123#import <WebCore/WAKScrollView.h>
     
    18701870    CTFontRef font = nil;
    18711871    if (_private->coreFrame) {
    1872         const SimpleFontData* fd = _private->coreFrame->editor().fontForSelection(multipleFonts);
     1872        const Font
     1873        * fd = _private->coreFrame->editor().fontForSelection(multipleFonts);
    18731874        if (fd)
    18741875            font = fd->getCTFont();
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r178434 r178940  
    9393#import <WebCore/FloatRect.h>
    9494#import <WebCore/FocusController.h>
     95#import <WebCore/Font.h>
    9596#import <WebCore/FontCache.h>
    9697#import <WebCore/Frame.h>
     
    113114#import <WebCore/RuntimeApplicationChecks.h>
    114115#import <WebCore/SharedBuffer.h>
    115 #import <WebCore/SimpleFontData.h>
    116116#import <WebCore/StyleProperties.h>
    117117#import <WebCore/Text.h>
     
    48794879    fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
    48804880    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];
    48834883}
    48844884
     
    54435443    NSFont *font = nil;
    54445444    if (Frame* coreFrame = core([self _frame])) {
    5445         if (const SimpleFontData* fd = coreFrame->editor().fontForSelection(multipleFonts))
     5445        if (const Font* fd = coreFrame->editor().fontForSelection(multipleFonts))
    54465446            font = fd->getNSFont();
    54475447    }
  • trunk/Source/WebKit/win/DOMCoreClasses.cpp

    r178525 r178940  
    3838#include <WebCore/DragImage.h>
    3939#include <WebCore/Element.h>
     40#include <WebCore/Font.h>
    4041#include <WebCore/FontCascade.h>
    4142#include <WebCore/Frame.h>
     
    4950#include <WebCore/RenderElement.h>
    5051#include <WebCore/RenderTreeAsText.h>
    51 #include <WebCore/SimpleFontData.h>
    5252
    5353#include <initguid.h>
  • trunk/Source/WebKit/win/WebCoreStatistics.cpp

    r177876 r178940  
    216216    if (!count)
    217217        return E_POINTER;
    218     *count = (UINT) fontCache().fontDataCount();
     218    *count = (UINT) fontCache().fontCount();
    219219    return S_OK;
    220220}
     
    225225    if (!count)
    226226        return E_POINTER;
    227     *count = (UINT) fontCache().inactiveFontDataCount();
     227    *count = (UINT) fontCache().inactiveFontCount();
    228228    return S_OK;
    229229}
  • trunk/Source/WebKit/win/WebView.cpp

    r178849 r178940  
    9797#include <WebCore/FloatQuad.h>
    9898#include <WebCore/FocusController.h>
     99#include <WebCore/Font.h>
    99100#include <WebCore/FrameLoader.h>
    100101#include <WebCore/FrameSelection.h>
     
    149150#include <WebCore/SecurityPolicy.h>
    150151#include <WebCore/Settings.h>
    151 #include <WebCore/SimpleFontData.h>
    152152#include <WebCore/SystemInfo.h>
    153153#include <WebCore/WindowMessageBroadcaster.h>
     
    55065506HRESULT WebView::setShouldApplyMacFontAscentHack(BOOL b)
    55075507{
    5508     SimpleFontData::setShouldApplyMacAscentHack(b);
     5508    Font::setShouldApplyMacAscentHack(b);
    55095509    return S_OK;
    55105510}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm

    r177955 r178940  
    4040#if USE(APPKIT)
    4141    // FIXME: font will be nil here for custom fonts, we should fix that.
    42     NSFont *font = m_popupClient->menuStyle().font().primaryFontData().getNSFont();
     42    NSFont *font = m_popupClient->menuStyle().font().primaryFont().getNSFont();
    4343    if (!font)
    4444        return;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r178889 r178940  
    805805        Node* nodeToRemove;
    806806        if (RenderStyle* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) {
    807             CTFontRef font = style->fontCascade().primaryFontData().getCTFont();
     807            CTFontRef font = style->fontCascade().primaryFont().getCTFont();
    808808            CTFontSymbolicTraits traits = font ? CTFontGetSymbolicTraits(font) : 0;
    809809           
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r178820 r178940  
    17911791    bool multipleFonts = false;
    17921792    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();
    17951795
    17961796    CGFloat fontSize = CTFontGetSize(font);
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r178634 r178940  
    928928   
    929929    // Gather font statistics.
    930     data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().fontDataCount());
    931     data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFontDataCount());
     930    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataCount"), fontCache().fontCount());
     931    data.statisticsNumbers.set(ASCIILiteral("CachedFontDataInactiveCount"), fontCache().inactiveFontCount());
    932932   
    933933    // Gather glyph page statistics.
Note: See TracChangeset for help on using the changeset viewer.