Changeset 64915 in webkit


Ignore:
Timestamp:
Aug 7, 2010 11:59:43 AM (14 years ago)
Author:
mitz@apple.com
Message:

Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
from SimpleFontData to FontPlatformData.
https://bugs.webkit.org/show_bug.cgi?id=43674

Reviewed by Anders Carlsson.

JavaScriptCore:

  • wtf/Platform.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI here from WebCore/config.h.

WebCore:

  • config.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI from here to wtf/Platform.h.
  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::getFontData): Use new SimpleFontData constructor for SVG fonts.

  • platform/graphics/SimpleFontData.cpp:

(WebCore::SimpleFontData::SimpleFontData): Separated into two constructors, one for
PlatformFontData-based fonts and one for SVG fonts.

  • platform/graphics/SimpleFontData.h: Moved the m_CTFont member variable and the getCTFont()

accessor from here…

  • platform/graphics/mac/FontPlatformData.h: …to here, renaming the latter ctFont().
  • platform/graphics/mac/FontPlatformDataMac.mm:

(WebCore::FontPlatformData::FontPlatformData): Copy m_CTFont.
(WebCore::FontPlatformData::operator=): Copy m_CTFont.
(WebCore::FontPlatformData::setFont): Clear m_CTFont.
(WebCore::FontPlatformData::ctFont): Moved here from SimpleFontDataCoreText.cpp and renamed.

  • platform/graphics/mac/SimpleFontDataCoreText.cpp:

(WebCore::SimpleFontData::getCFStringAttributes): Updated to use FontPlatformData::ctFont().

  • svg/SVGFontData.cpp:

(WebCore::SVGFontData::SVGFontData): Added an assertion.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r64912 r64915  
     12010-08-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
     6        from SimpleFontData to FontPlatformData.
     7        https://bugs.webkit.org/show_bug.cgi?id=43674
     8
     9        * wtf/Platform.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI here from WebCore/config.h.
     10
    1112010-08-07  Zoltan Herczeg  <zherczeg@webkit.org>
    212
  • trunk/JavaScriptCore/wtf/Platform.h

    r64818 r64915  
    10331033#endif
    10341034
     1035#if PLATFORM(MAC)
     1036/* Complex text framework */
     1037#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     1038#define WTF_USE_ATSUI 0
     1039#define WTF_USE_CORE_TEXT 1
     1040#else
     1041#define WTF_USE_ATSUI 1
     1042#define WTF_USE_CORE_TEXT 0
     1043#endif
     1044
    10351045/* Accelerated compositing */
    1036 #if PLATFORM(MAC)
    10371046#if !defined(BUILDING_ON_TIGER)
    10381047#define WTF_USE_ACCELERATED_COMPOSITING 1
  • trunk/WebCore/ChangeLog

    r64914 r64915  
     12010-08-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
     6        from SimpleFontData to FontPlatformData.
     7        https://bugs.webkit.org/show_bug.cgi?id=43674
     8
     9        * config.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI from here to wtf/Platform.h.
     10        * css/CSSFontFaceSource.cpp:
     11        (WebCore::CSSFontFaceSource::getFontData): Use new SimpleFontData constructor for SVG fonts.
     12        * platform/graphics/SimpleFontData.cpp:
     13        (WebCore::SimpleFontData::SimpleFontData): Separated into two constructors, one for
     14        PlatformFontData-based fonts and one for SVG fonts.
     15        * platform/graphics/SimpleFontData.h: Moved the m_CTFont member variable and the getCTFont()
     16        accessor from here…
     17        * platform/graphics/mac/FontPlatformData.h: …to here, renaming the latter ctFont().
     18        * platform/graphics/mac/FontPlatformDataMac.mm:
     19        (WebCore::FontPlatformData::FontPlatformData): Copy m_CTFont.
     20        (WebCore::FontPlatformData::operator=): Copy m_CTFont.
     21        (WebCore::FontPlatformData::setFont): Clear m_CTFont.
     22        (WebCore::FontPlatformData::ctFont): Moved here from SimpleFontDataCoreText.cpp and renamed.
     23        * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     24        (WebCore::SimpleFontData::getCFStringAttributes): Updated to use FontPlatformData::ctFont().
     25        * svg/SVGFontData.cpp:
     26        (WebCore::SVGFontData::SVGFontData): Added an assertion.
     27
    1282010-08-07  Adam Barth  <abarth@webkit.org>
    229
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r64909 r64915  
    14241424                7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
    14251425                7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1426                 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursor.cpp */; };
    14271426                81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209211F4AB8D00915DFA /* IDBCursor.h */; };
    14281427                81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */; };
    1429                 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */; };
    1430                 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209611F4AB8D00915DFA /* IDBCursorBackendInterface.h */; };
     1428                81BE209911F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */; };
    14311429                81BE20D211F4BC3200915DFA /* JSIDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */; };
    14321430                81BE20D311F4BC3200915DFA /* JSIDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE20A811F4B66F00915DFA /* JSIDBCursor.h */; };
     
    72607258                81BE209211F4AB8D00915DFA /* IDBCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursor.h; sourceTree = "<group>"; };
    72617259                81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorBackendImpl.cpp; sourceTree = "<group>"; };
    7262                 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendImpl.h; sourceTree = "<group>"; };
    72637260                81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendInterface.h; sourceTree = "<group>"; };
    72647261                81BE209C11F4ABBD00915DFA /* IDBCursor.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBCursor.idl; sourceTree = "<group>"; };
     
    1009810095                B6566269120B115A006EA85C /* IDBTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransaction.idl; sourceTree = "<group>"; };
    1009910096                B656626D120B116B006EA85C /* IDBTransactionBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionBackendInterface.h; sourceTree = "<group>"; };
    10100                 B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIDBTransaction.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
    10101                 B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSIDBTransaction.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
     10097                B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
     10098                B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
    1010210099                B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
    1010310100                B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
     
    1146911466                                C585A69A11D4FB3D004C3E4B /* IDBAny.idl */,
    1147011467                                C585A69B11D4FB3D004C3E4B /* IDBCallbacks.h */,
    11471                                 81BE209211F4AB8D00915DFA /* IDBCursor.cpp */,
     11468                                81BE209211F4AB8D00915DFA /* IDBCursor.h */,
    1147211469                                81BE209211F4AB8D00915DFA /* IDBCursor.h */,
    1147311470                                81BE209C11F4ABBD00915DFA /* IDBCursor.idl */,
    1147411471                                81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */,
    11475                                 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */,
    11476                                 81BE209511F4AB8D00915DFA /* IDBCursorBackendInterface.h */,
     11472                                81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */,
    1147711473                                C585A6A311D4FB3D004C3E4B /* IDBDatabase.cpp */,
    1147811474                                C585A6A411D4FB3D004C3E4B /* IDBDatabase.h */,
     
    1871618712                                C585A6CF11D4FB3D004C3E4B /* IDBCallbacks.h in Headers */,
    1871718713                                81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */,
    18718                                 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */,
    18719                                 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */,
     18714                                81BE209911F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */,
    1872018715                                C585A6D811D4FB3D004C3E4B /* IDBDatabase.h in Headers */,
    1872118716                                B61762621203490800EF9114 /* IDBDatabaseBackendImpl.h in Headers */,
     
    2116621161                                C585A6CC11D4FB3D004C3E4B /* IDBAny.cpp in Sources */,
    2116721162                                C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */,
    21168                                 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */,
     21163                                81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */,
    2116921164                                81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */,
    2117021165                                B691C1F91206D4A00025D980 /* IDBDatabase.cpp in Sources */,
  • trunk/WebCore/config.h

    r64591 r64915  
    156156
    157157#if PLATFORM(MAC)
    158 // ATSUI vs. CoreText
    159 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    160 #define WTF_USE_ATSUI 0
    161 #define WTF_USE_CORE_TEXT 1
    162 #else
    163 #define WTF_USE_ATSUI 1
    164 #define WTF_USE_CORE_TEXT 0
    165 #endif
    166 
    167158// New theme
    168159#define WTF_USE_NEW_THEME 1
  • trunk/WebCore/css/CSSFontFaceSource.cpp

    r64528 r64915  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    154154                    }
    155155
    156                     SVGFontData* svgFontData = new SVGFontData(fontFaceElement);
    157                     fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.renderingMode()), true, false, svgFontData));
     156                    fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(fontFaceElement)), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic));
    158157                }
    159158            } else
     
    169168#if ENABLE(SVG_FONTS)
    170169            // In-Document SVG Fonts
    171             if (m_svgFontFaceElement) {
    172                 SVGFontData* svgFontData = new SVGFontData(m_svgFontFaceElement);
    173                 fontData.set(new SimpleFontData(FontPlatformData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic), true, false, svgFontData));
    174             }
     170            if (m_svgFontFaceElement)
     171                fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(m_svgFontFaceElement)), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic));
    175172#endif
    176173        }
  • trunk/WebCore/platform/graphics/SimpleFontData.cpp

    r58474 r64915  
    11/*
    2  * Copyright (C) 2005, 2008 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Alexey Proskuryakov
    44 *
     
    4848namespace WebCore {
    4949
    50 SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
     50SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading)
    5151    : m_maxCharWidth(-1)
    5252    , m_avgCharWidth(-1)
    5353    , m_unitsPerEm(defaultUnitsPerEm)
    54     , m_platformData(f)
     54    , m_platformData(platformData)
    5555    , m_treatAsFixedPitch(false)
    56 #if ENABLE(SVG_FONTS)
    57     , m_svgFontData(svgFontData)
    58 #endif
    59     , m_isCustomFont(customFont)
    60     , m_isLoading(loading)
     56    , m_isCustomFont(isCustomFont)
     57    , m_isLoading(isLoading)
    6158    , m_smallCapsFontData(0)
    6259{
    63 #if !ENABLE(SVG_FONTS)
    64     UNUSED_PARAM(svgFontData);
    65 #else
    66     if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
    67         m_unitsPerEm = svgFontFaceElement->unitsPerEm();
    68 
    69         double scale = f.size();
    70         if (m_unitsPerEm)
    71             scale /= m_unitsPerEm;
    72 
    73         m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
    74         m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
    75         m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
    76         m_lineGap = 0.1f * f.size();
    77         m_lineSpacing = m_ascent + m_descent + m_lineGap;
    78 
    79         SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
    80 
    81         Vector<SVGGlyphIdentifier> spaceGlyphs;
    82         associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
    83         m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
    84 
    85         Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
    86         associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
    87         m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
    88 
    89         Vector<SVGGlyphIdentifier> letterWGlyphs;
    90         associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
    91         m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
    92 
    93         // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
    94         m_spaceGlyph = 0;
    95         m_zeroWidthSpaceGlyph = 0;
    96         determinePitch();
    97         m_adjustedSpaceWidth = roundf(m_spaceWidth);
    98         m_missingGlyphData.fontData = this;
    99         m_missingGlyphData.glyph = 0;
    100         return;
    101     }
    102 #endif
    103 
    10460    platformInit();
    10561    platformGlyphInit();
    10662    platformCharWidthInit();
    10763}
     64
     65#if ENABLE(SVG_FONTS)
     66SimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bool syntheticBold, bool syntheticItalic)
     67    : m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic))
     68    , m_treatAsFixedPitch(false)
     69    , m_svgFontData(svgFontData)
     70    , m_isCustomFont(true)
     71    , m_isLoading(false)
     72    , m_smallCapsFontData(0)
     73{
     74    SVGFontFaceElement* svgFontFaceElement = m_svgFontData->svgFontFaceElement();
     75    m_unitsPerEm = svgFontFaceElement->unitsPerEm();
     76
     77    double scale = size;
     78    if (m_unitsPerEm)
     79        scale /= m_unitsPerEm;
     80
     81    m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
     82    m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
     83    m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
     84    m_lineGap = 0.1f * size;
     85    m_lineSpacing = m_ascent + m_descent + m_lineGap;
     86
     87    SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
     88
     89    Vector<SVGGlyphIdentifier> spaceGlyphs;
     90    associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
     91    m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
     92
     93    Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
     94    associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
     95    m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
     96
     97    Vector<SVGGlyphIdentifier> letterWGlyphs;
     98    associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
     99    m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
     100
     101    // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
     102    m_spaceGlyph = 0;
     103    m_zeroWidthSpaceGlyph = 0;
     104    determinePitch();
     105    m_adjustedSpaceWidth = roundf(m_spaceWidth);
     106    m_missingGlyphData.fontData = this;
     107    m_missingGlyphData.glyph = 0;
     108}
     109#endif
    108110
    109111#if !PLATFORM(QT)
  • trunk/WebCore/platform/graphics/SimpleFontData.h

    r62677 r64915  
    22 * This file is part of the internal font implementation.
    33 *
    4  * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
     4 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
    55 * Copyright (C) 2007-2008 Torch Mobile, Inc.
    66 *
     
    3333#include <wtf/OwnPtr.h>
    3434#include <wtf/PassOwnPtr.h>
     35#include <wtf/RetainPtr.h>
    3536
    3637#if USE(ATSUI)
    3738typedef struct OpaqueATSUStyle* ATSUStyle;
    38 #endif
    39 
    40 #if USE(CORE_TEXT)
    41 #include <ApplicationServices/ApplicationServices.h>
    42 #include <wtf/RetainPtr.h>
    4339#endif
    4440
     
    6359
    6460class FontDescription;
    65 class FontPlatformData;
    6661class SharedBuffer;
    6762class SVGFontData;
     
    7166class SimpleFontData : public FontData {
    7267public:
    73     SimpleFontData(const FontPlatformData&, bool customFont = false, bool loading = false, SVGFontData* data = 0);
     68    SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false);
     69#if ENABLE(SVG_FONTS)
     70    SimpleFontData(PassOwnPtr<SVGFontData>, int size, bool syntheticBold, bool syntheticItalic);
     71#endif
    7472    virtual ~SimpleFontData();
    7573
    76 public:
    7774    const FontPlatformData& platformData() const { return m_platformData; }
    7875    SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) const;
     
    132129
    133130#if USE(CORE_TEXT)
    134     CTFontRef getCTFont() const;
    135131    CFDictionaryRef getCFStringAttributes(TypesettingFeatures) const;
    136132#endif
     
    237233
    238234#if USE(CORE_TEXT)
    239     mutable RetainPtr<CTFontRef> m_CTFont;
    240235    mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
    241236#endif
  • trunk/WebCore/platform/graphics/mac/FontPlatformData.h

    r64861 r64915  
    33 * It should not be included by source files outside of it.
    44 *
    5  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     5 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    115115    void setFont(NSFont *font);
    116116
     117#if USE(CORE_TEXT)
     118    CTFontRef ctFont() const;
     119#endif
     120
    117121    bool roundsGlyphAdvances() const;
    118122    bool allowsLigatures() const;
     
    133137
    134138    NSFont *m_font;
     139
    135140#ifndef BUILDING_ON_TIGER
    136141    RetainPtr<CGFontRef> m_cgFont;
    137142#else
    138143    CGFontRef m_cgFont; // It is not necessary to refcount this, since either an NSFont owns it or some CachedFont has it referenced.
     144#endif
     145
     146#if USE(CORE_TEXT)
     147    mutable RetainPtr<CTFontRef> m_CTFont;
    139148#endif
    140149
  • trunk/WebCore/platform/graphics/mac/FontPlatformDataMac.mm

    r62186 r64915  
    6262    m_atsuFontID = f.m_atsuFontID;
    6363    m_isColorBitmapFont = f.m_isColorBitmapFont;
     64#if USE(CORE_TEXT)
     65    m_CTFont = f.m_CTFont;
     66#endif
    6467}
    6568
     
    8588    m_font = f.m_font;
    8689    m_isColorBitmapFont = f.m_isColorBitmapFont;
     90#if USE(CORE_TEXT)
     91    m_CTFont = f.m_CTFont;
     92#endif
    8793    return *this;
    8894}
     
    108114    m_isColorBitmapFont = CTFontGetSymbolicTraits(toCTFontRef(font)) & kCTFontColorGlyphsTrait;
    109115#endif
     116#if USE(CORE_TEXT)
     117    m_CTFont = 0;
     118#endif
    110119}
    111120
     
    120129}
    121130
     131#if USE(CORE_TEXT)
     132CTFontRef FontPlatformData::ctFont() const
     133{
     134    if (m_font)
     135        return toCTFontRef(m_font);
     136    if (!m_CTFont)
     137        m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0));
     138    return m_CTFont.get();
     139}
     140#endif // USE(CORE_TEXT)
     141
    122142#ifndef NDEBUG
    123143String FontPlatformData::description() const
  • trunk/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp

    r58581 r64915  
    4242namespace WebCore {
    4343
    44 CTFontRef SimpleFontData::getCTFont() const
    45 {
    46     if (getNSFont())
    47         return toCTFontRef(getNSFont());
    48     if (!m_CTFont)
    49         m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_platformData.cgFont(), m_platformData.size(), 0, 0));
    50     return m_CTFont.get();
    51 }
    52 
    5344CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const
    5445{
     
    7162        static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue);
    7263        static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
    73         const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures
     64        const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures
    7465            ? ligaturesAllowed : ligaturesNotAllowed };
    7566        attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled,
     
    7970        // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning.
    8071        static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName };
    81         const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
     72        const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
    8273        attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled,
    8374            sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled),
  • trunk/WebCore/svg/SVGFontData.cpp

    r64579 r64915  
    3434    , m_verticalAdvanceY(fontFaceElement->verticalAdvanceY())
    3535{
     36    ASSERT_ARG(fontFaceElement, fontFaceElement);
    3637}
    3738
Note: See TracChangeset for help on using the changeset viewer.