Changeset 14216 in webkit


Ignore:
Timestamp:
May 6, 2006 1:40:28 AM (18 years ago)
Author:
hyatt
Message:

Rename WebCoreFont to FontPlatformData and WebTextRenderer to FontData. Merge them into the
headers (uncleanly with ifdefs at the moment, so I can see what I'm working towards).

Reviewed by mjs

  • ChangeLog:
  • WebCore.vcproj/WebCore/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bridge/mac/WebCoreStringTruncator.mm: (stringWidth): (truncateString): (+[WebCoreStringTruncator widthOfString:font:]):
  • kwq/KWQComboBox.mm: (QComboBox::sizeHint):
  • kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth):
  • kwq/KWQListBox.mm: (itemTextRenderer): (groupLabelTextRenderer): (QListBox::sizeForNumberOfLines): (-[KWQTableView drawRow:clipRect:]):
  • platform/Font.cpp: (WebCore::m_wordSpacing): (WebCore::Font::Font): (WebCore::Font::operator=): (WebCore::Font::update): (WebCore::Font::ascent): (WebCore::Font::descent): (WebCore::Font::lineSpacing): (WebCore::Font::xHeight): (WebCore::Font::isFixedPitch):
  • platform/Font.h: (WebCore::Font::getNSFont):
  • platform/FontData.h: (WebCore::FontData::ascent): (WebCore::FontData::descent): (WebCore::FontData::lineSpacing): (WebCore::FontData::lineGap): (WebCore::FontData::misspellingLineThickness): (WebCore::FontData::misspellingLinePatternWidth): (WebCore::FontData::misspellingLinePatternGapWidth):
  • platform/FontDataSet.h: Removed.
  • platform/FontFallbackList.h: Added.
  • platform/FontPlatformData.h:
  • platform/mac/FontData.mm: Added. (WebCore::WebCoreInitializeFont): (WebCore::WebCoreInitializeEmptyTextGeometry): (WebCore::widthForGlyph): (WebCore::overrideLayoutOperation): (WebCore::FontData::~FontData): (WebCore::FontData::xHeight): (WebCore::FontData::drawRun): (WebCore::FontData::floatWidthForRun): (WebCore::FontData::drawLineForCharacters): (WebCore::FontData::selectionRectForRun): (WebCore::FontData::drawHighlightForRun): (WebCore::FontData::drawLineForMisspelling): (WebCore::FontData::pointToOffset): (WebCore::FontData::setAlwaysUseATSU): (WebCore::getSmallCapsRenderer): (WebCore::findSubstituteFont): (WebCore::rendererForAlternateFont): (WebCore::findSubstituteRenderer): (WebCore::computeWidthForSpace): (WebCore::setUpFont): (WebCore::CG_drawHighlight): (WebCore::CG_selectionRect): (WebCore::CG_draw): (WebCore::CG_floatWidthForRun): (WebCore::updateGlyphMapEntry): (WebCore::extendGlyphMap): (WebCore::extendWidthMap): (WebCore::initializeATSUStyle): (WebCore::createATSULayoutParameters): (WebCore::getTextBounds): (WebCore::ATSU_floatWidthForRun): (WebCore::ATSU_drawHighlight): (WebCore::ATSU_selectionRect): (WebCore::ATSU_draw): (WebCore::ATSU_pointToOffset): (WebCore::advanceWidthIteratorOneCharacter): (WebCore::CG_pointToOffset): (WebCore::glyphForCharacter): (WebCore::initializeWidthIterator): (WebCore::advanceWidthIterator):
  • platform/mac/FontMac.mm: (WebCore::m_font): (WebCore::FontFallbackList::~FontFallbackList): (WebCore::FontFallbackList::platformFont): (WebCore::FontFallbackList::primaryFont): (WebCore::FontFallbackList::determinePitch): (WebCore::FontFallbackList::invalidate): (WebCore::Font::platformFont): (WebCore::Font::selectionRectForText): (WebCore::Font::drawText): (WebCore::Font::drawHighlightForText): (WebCore::Font::drawLineForText): (WebCore::Font::drawLineForMisspelling): (WebCore::Font::misspellingLineThickness): (WebCore::Font::floatWidth): (WebCore::Font::checkSelectionPoint):
  • platform/mac/WebCoreTextRenderer.mm: (WebCoreDrawTextAtPoint): (WebCoreTextFloatWidth): (WebCoreSetAlwaysUseATSU):
  • platform/mac/WebTextRenderer.h: Removed.
  • platform/mac/WebTextRenderer.mm: Removed.
  • platform/mac/WebTextRendererFactory.h:
  • platform/mac/WebTextRendererFactory.mm: (-[WebTextRendererFactory isFontFixedPitch:]): (-[WebTextRendererFactory init]): (-[WebTextRendererFactory rendererWithFont:]): (-[WebTextRendererFactory fontWithFamilies:traits:size:]):
  • platform/win/FontWin.cpp: (WebCore::FontFallbackList::~FontFallbackList): (WebCore::FontFallbackList::determinePitch): (WebCore::FontFallbackList::invalidate): (WebCore::FontFallbackList::primaryFont): (WebCore::Font::floatWidth): (WebCore::Font::drawText): (WebCore::Font::drawHighlightForText): (WebCore::Font::selectionRectForText): (WebCore::Font::checkSelectionPoint):
Location:
trunk/WebCore
Files:
1 deleted
16 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r14215 r14216  
     12006-05-06  David Hyatt  <hyatt@apple.com>
     2
     3        Rename WebCoreFont to FontPlatformData and WebTextRenderer to FontData.  Merge them into the
     4        headers (uncleanly with ifdefs at the moment, so I can see what I'm working towards).
     5
     6        Reviewed by mjs
     7
     8        * ChangeLog:
     9        * WebCore.vcproj/WebCore/WebCore.vcproj:
     10        * WebCore.xcodeproj/project.pbxproj:
     11        * bridge/mac/WebCoreStringTruncator.mm:
     12        (stringWidth):
     13        (truncateString):
     14        (+[WebCoreStringTruncator widthOfString:font:]):
     15        * kwq/KWQComboBox.mm:
     16        (QComboBox::sizeHint):
     17        * kwq/KWQLineEdit.mm:
     18        (QLineEdit::sizeForCharacterWidth):
     19        * kwq/KWQListBox.mm:
     20        (itemTextRenderer):
     21        (groupLabelTextRenderer):
     22        (QListBox::sizeForNumberOfLines):
     23        (-[KWQTableView drawRow:clipRect:]):
     24        * platform/Font.cpp:
     25        (WebCore::m_wordSpacing):
     26        (WebCore::Font::Font):
     27        (WebCore::Font::operator=):
     28        (WebCore::Font::update):
     29        (WebCore::Font::ascent):
     30        (WebCore::Font::descent):
     31        (WebCore::Font::lineSpacing):
     32        (WebCore::Font::xHeight):
     33        (WebCore::Font::isFixedPitch):
     34        * platform/Font.h:
     35        (WebCore::Font::getNSFont):
     36        * platform/FontData.h:
     37        (WebCore::FontData::ascent):
     38        (WebCore::FontData::descent):
     39        (WebCore::FontData::lineSpacing):
     40        (WebCore::FontData::lineGap):
     41        (WebCore::FontData::misspellingLineThickness):
     42        (WebCore::FontData::misspellingLinePatternWidth):
     43        (WebCore::FontData::misspellingLinePatternGapWidth):
     44        * platform/FontDataSet.h: Removed.
     45        * platform/FontFallbackList.h: Added.
     46        * platform/FontPlatformData.h:
     47        * platform/mac/FontData.mm: Added.
     48        (WebCore::WebCoreInitializeFont):
     49        (WebCore::WebCoreInitializeEmptyTextGeometry):
     50        (WebCore::widthForGlyph):
     51        (WebCore::overrideLayoutOperation):
     52        (WebCore::FontData::~FontData):
     53        (WebCore::FontData::xHeight):
     54        (WebCore::FontData::drawRun):
     55        (WebCore::FontData::floatWidthForRun):
     56        (WebCore::FontData::drawLineForCharacters):
     57        (WebCore::FontData::selectionRectForRun):
     58        (WebCore::FontData::drawHighlightForRun):
     59        (WebCore::FontData::drawLineForMisspelling):
     60        (WebCore::FontData::pointToOffset):
     61        (WebCore::FontData::setAlwaysUseATSU):
     62        (WebCore::getSmallCapsRenderer):
     63        (WebCore::findSubstituteFont):
     64        (WebCore::rendererForAlternateFont):
     65        (WebCore::findSubstituteRenderer):
     66        (WebCore::computeWidthForSpace):
     67        (WebCore::setUpFont):
     68        (WebCore::CG_drawHighlight):
     69        (WebCore::CG_selectionRect):
     70        (WebCore::CG_draw):
     71        (WebCore::CG_floatWidthForRun):
     72        (WebCore::updateGlyphMapEntry):
     73        (WebCore::extendGlyphMap):
     74        (WebCore::extendWidthMap):
     75        (WebCore::initializeATSUStyle):
     76        (WebCore::createATSULayoutParameters):
     77        (WebCore::getTextBounds):
     78        (WebCore::ATSU_floatWidthForRun):
     79        (WebCore::ATSU_drawHighlight):
     80        (WebCore::ATSU_selectionRect):
     81        (WebCore::ATSU_draw):
     82        (WebCore::ATSU_pointToOffset):
     83        (WebCore::advanceWidthIteratorOneCharacter):
     84        (WebCore::CG_pointToOffset):
     85        (WebCore::glyphForCharacter):
     86        (WebCore::initializeWidthIterator):
     87        (WebCore::advanceWidthIterator):
     88        * platform/mac/FontMac.mm:
     89        (WebCore::m_font):
     90        (WebCore::FontFallbackList::~FontFallbackList):
     91        (WebCore::FontFallbackList::platformFont):
     92        (WebCore::FontFallbackList::primaryFont):
     93        (WebCore::FontFallbackList::determinePitch):
     94        (WebCore::FontFallbackList::invalidate):
     95        (WebCore::Font::platformFont):
     96        (WebCore::Font::selectionRectForText):
     97        (WebCore::Font::drawText):
     98        (WebCore::Font::drawHighlightForText):
     99        (WebCore::Font::drawLineForText):
     100        (WebCore::Font::drawLineForMisspelling):
     101        (WebCore::Font::misspellingLineThickness):
     102        (WebCore::Font::floatWidth):
     103        (WebCore::Font::checkSelectionPoint):
     104        * platform/mac/WebCoreTextRenderer.mm:
     105        (WebCoreDrawTextAtPoint):
     106        (WebCoreTextFloatWidth):
     107        (WebCoreSetAlwaysUseATSU):
     108        * platform/mac/WebTextRenderer.h: Removed.
     109        * platform/mac/WebTextRenderer.mm: Removed.
     110        * platform/mac/WebTextRendererFactory.h:
     111        * platform/mac/WebTextRendererFactory.mm:
     112        (-[WebTextRendererFactory isFontFixedPitch:]):
     113        (-[WebTextRendererFactory init]):
     114        (-[WebTextRendererFactory rendererWithFont:]):
     115        (-[WebTextRendererFactory fontWithFamilies:traits:size:]):
     116        * platform/win/FontWin.cpp:
     117        (WebCore::FontFallbackList::~FontFallbackList):
     118        (WebCore::FontFallbackList::determinePitch):
     119        (WebCore::FontFallbackList::invalidate):
     120        (WebCore::FontFallbackList::primaryFont):
     121        (WebCore::Font::floatWidth):
     122        (WebCore::Font::drawText):
     123        (WebCore::Font::drawHighlightForText):
     124        (WebCore::Font::selectionRectForText):
     125        (WebCore::Font::checkSelectionPoint):
     126
    11272006-05-05  Darin Adler  <darin@apple.com>
    2128
  • trunk/WebCore/WebCore.vcproj/WebCore/WebCore.vcproj

    r14163 r14216  
    700700                        </File>
    701701                        <File
    702                                 RelativePath="..\..\platform\FontDataSet.h"
     702                                RelativePath="..\..\platform\FontFallbackList.h"
    703703                                >
    704704                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r14174 r14216  
    990990                AB67D1A8097F3AE300F9392E /* RenderTextField.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextField.cpp */; };
    991991                AB67D1A9097F3AE300F9392E /* RenderTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextField.h */; };
    992                 BC066F3709FEAF5300C589A7 /* WebTextRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC066F3309FEAF5300C589A7 /* WebTextRenderer.h */; };
    993                 BC066F3809FEAF5300C589A7 /* WebTextRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC066F3409FEAF5300C589A7 /* WebTextRenderer.mm */; };
    994992                BC066F3909FEAF5300C589A7 /* WebTextRendererFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC066F3509FEAF5300C589A7 /* WebTextRendererFactory.h */; };
    995993                BC066F3A09FEAF5300C589A7 /* WebTextRendererFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC066F3609FEAF5300C589A7 /* WebTextRendererFactory.mm */; };
     
    10671065                BCC8D1730988301200140BF2 /* Pen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8D1710988301200140BF2 /* Pen.cpp */; };
    10681066                BCC8D1740988301200140BF2 /* Pen.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8D1720988301200140BF2 /* Pen.h */; };
     1067                BCCD13200A0C0030001AFA8B /* FontData.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCCD131E0A0C0030001AFA8B /* FontData.mm */; };
    10691068                BCD75ABC0989A446003E28DF /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD75ABB0989A446003E28DF /* Image.h */; };
    10701069                BCEA478D097CAAC80094C9E4 /* css_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA477A097CAAC80094C9E4 /* css_base.cpp */; };
     
    11461145                BCEA4948097F0F770094C9E4 /* BrowserExtensionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4946097F0F770094C9E4 /* BrowserExtensionMac.mm */; };
    11471146                BCEB377309B7BA3900CB38B1 /* FontMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCEB377209B7BA3900CB38B1 /* FontMac.mm */; };
    1148                 BCEB377609B7BB0D00CB38B1 /* FontDataSet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEB377509B7BB0D00CB38B1 /* FontDataSet.h */; };
     1147                BCEB377609B7BB0D00CB38B1 /* FontFallbackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEB377509B7BB0D00CB38B1 /* FontFallbackList.h */; };
    11491148                BCEF3434087B563E00BBF833 /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEF3432087B563E00BBF833 /* HTMLElementFactory.cpp */; };
    11501149                BCEF3435087B563E00BBF833 /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEF3433087B563E00BBF833 /* HTMLElementFactory.h */; };
     
    22712270                AB67D1A6097F3AE300F9392E /* RenderTextField.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextField.cpp; sourceTree = "<group>"; };
    22722271                AB67D1A7097F3AE300F9392E /* RenderTextField.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderTextField.h; sourceTree = "<group>"; };
    2273                 BC066F3309FEAF5300C589A7 /* WebTextRenderer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebTextRenderer.h; sourceTree = "<group>"; };
    2274                 BC066F3409FEAF5300C589A7 /* WebTextRenderer.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextRenderer.mm; sourceTree = "<group>"; };
    22752272                BC066F3509FEAF5300C589A7 /* WebTextRendererFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebTextRendererFactory.h; sourceTree = "<group>"; };
    22762273                BC066F3609FEAF5300C589A7 /* WebTextRendererFactory.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextRendererFactory.mm; sourceTree = "<group>"; };
     
    23582355                BCC8D1710988301200140BF2 /* Pen.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Pen.cpp; sourceTree = "<group>"; };
    23592356                BCC8D1720988301200140BF2 /* Pen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Pen.h; sourceTree = "<group>"; };
     2357                BCCD131E0A0C0030001AFA8B /* FontData.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontData.mm; sourceTree = "<group>"; };
    23602358                BCD75ABB0989A446003E28DF /* Image.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; };
    23612359                BCEA477A097CAAC80094C9E4 /* css_base.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = css_base.cpp; sourceTree = "<group>"; };
     
    24412439                BCEA4946097F0F770094C9E4 /* BrowserExtensionMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = BrowserExtensionMac.mm; sourceTree = "<group>"; };
    24422440                BCEB377209B7BA3900CB38B1 /* FontMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontMac.mm; sourceTree = "<group>"; };
    2443                 BCEB377509B7BB0D00CB38B1 /* FontDataSet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDataSet.h; sourceTree = "<group>"; };
     2441                BCEB377509B7BB0D00CB38B1 /* FontFallbackList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontFallbackList.h; sourceTree = "<group>"; };
    24442442                BCEF3432087B563E00BBF833 /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    24452443                BCEF3433087B563E00BBF833 /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    28412839                                9352071C09BD3BBB00F2038D /* WebCoreWidgetHolder.h */,
    28422840                                BCFE8E310A02A1D30009E61D /* WebCoreTextRenderer.mm */,
     2841                                BCCD131E0A0C0030001AFA8B /* FontData.mm */,
    28432842                                BC066F6C09FEB2FA00C589A7 /* WebCoreTextRenderer.h */,
    2844                                 BC066F3309FEAF5300C589A7 /* WebTextRenderer.h */,
    2845                                 BC066F3409FEAF5300C589A7 /* WebTextRenderer.mm */,
    28462843                                BC066F3509FEAF5300C589A7 /* WebTextRendererFactory.h */,
    28472844                                BC066F3609FEAF5300C589A7 /* WebTextRendererFactory.mm */,
     
    38873884                                BC6D6DD009AF906600F59759 /* Font.cpp */,
    38883885                                BC6D6DD109AF906600F59759 /* Font.h */,
    3889                                 BCEB377509B7BB0D00CB38B1 /* FontDataSet.h */,
     3886                                BCEB377509B7BB0D00CB38B1 /* FontFallbackList.h */,
    38903887                                BCC47E6A09A3FE4700ADB771 /* FontDescription.h */,
    38913888                                BCC47E2409A3D6F100ADB771 /* FontFamily.cpp */,
     
    47384735                                A82398A609B3ACDB00B60641 /* PlugInInfoStore.h in Headers */,
    47394736                                A8239E0109B3CF8A00B60641 /* Logging.h in Headers */,
    4740                                 BCEB377609B7BB0D00CB38B1 /* FontDataSet.h in Headers */,
     4737                                BCEB377609B7BB0D00CB38B1 /* FontFallbackList.h in Headers */,
    47414738                                C6D74AD509AA282E000B0A52 /* ModifySelectionListLevelCommand.h in Headers */,
    47424739                                6545F67109B82FED0013006F /* TransferJob.h in Headers */,
     
    48434840                                93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */,
    48444841                                65901A4409FC6039005BD752 /* WebCoreStringTruncator.h in Headers */,
    4845                                 BC066F3709FEAF5300C589A7 /* WebTextRenderer.h in Headers */,
    48464842                                BC066F3909FEAF5300C589A7 /* WebTextRendererFactory.h in Headers */,
    48474843                                BC066F6F09FEB2FA00C589A7 /* WebCoreTextRenderer.h in Headers */,
     
    55615557                                93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */,
    55625558                                65901A4509FC6039005BD752 /* WebCoreStringTruncator.mm in Sources */,
    5563                                 BC066F3809FEAF5300C589A7 /* WebTextRenderer.mm in Sources */,
    55645559                                BC066F3A09FEAF5300C589A7 /* WebTextRendererFactory.mm in Sources */,
    55655560                                BCFE8E320A02A1D30009E61D /* WebCoreTextRenderer.mm in Sources */,
     
    55675562                                142011B60A003133008303F9 /* JSCSSStyleDeclaration.cpp in Sources */,
    55685563                                936BDD1D0A031AEB004DF4AB /* GraphicsContextCG.cpp in Sources */,
     5564                                BCCD13200A0C0030001AFA8B /* FontData.mm in Sources */,
    55695565                        );
    55705566                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bridge/mac/WebCoreStringTruncator.mm

    r14179 r14216  
    3434#import <kxmlcore/Assertions.h>
    3535#import "WebTextRendererFactory.h"
    36 #import "WebTextRenderer.h"
     36#import "FontData.h"
    3737
    3838#define STRING_BUFFER_SIZE 2048
     
    4242
    4343static NSFont *currentFont;
    44 static WebTextRenderer* currentRenderer;
     44static FontData* currentRenderer;
    4545static float currentEllipsisWidth;
    4646
     
    8282}
    8383
    84 static float stringWidth(WebTextRenderer* renderer, const unichar *characters, unsigned length)
     84static float stringWidth(FontData* renderer, const unichar *characters, unsigned length)
    8585{
    8686    WebCoreTextRun run;
     
    115115        [currentFont release];
    116116        currentFont = [font retain];
    117         WebCoreFont f;
     117        FontPlatformData f;
    118118        WebCoreInitializeFont(&f);
    119119        f.font = font;
     
    224224    unichar *s = static_cast<unichar*>(malloc(sizeof(unichar) * length));
    225225    [string getCharacters:s];
    226     WebCoreFont f;
     226    FontPlatformData f;
    227227    WebCoreInitializeFont(&f);
    228228    f.font = font;
  • trunk/WebCore/kwq/KWQComboBox.mm

    r14174 r14216  
    3232#import "KWQLineEdit.h"
    3333#import "WebCoreFrameBridge.h"
    34 #import "WebTextRenderer.h"
     34#import "FontData.h"
    3535#import "WebTextRendererFactory.h"
    3636#import "WebCoreWidgetHolder.h"
     
    166166        DeprecatedValueListConstIterator<KWQListBoxItem> e = const_cast<const DeprecatedValueList<KWQListBoxItem> &>(_items).end();
    167167        if (i != e) {
    168             WebCoreFont itemFont;
     168            FontPlatformData itemFont;
    169169            WebCoreInitializeFont(&itemFont);
    170170            itemFont.font = [button font];
    171171            itemFont.forPrinter = ![NSGraphicsContext currentContextDrawingToScreen];
    172             WebTextRenderer* itemRenderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:itemFont];
    173             WebTextRenderer* labelRenderer = nil;
     172            FontData* itemRenderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:itemFont];
     173            FontData* labelRenderer = nil;
    174174            WebCoreTextStyle style;
    175175            WebCoreInitializeEmptyTextStyle(&style);
     
    185185                WebCoreInitializeTextRun(&run, reinterpret_cast<const UniChar *>(s.unicode()), length, 0, length);
    186186
    187                 WebTextRenderer* renderer;
     187                FontData* renderer;
    188188                if (isGroupLabel) {
    189189                    if (labelRenderer == nil) {
    190                         WebCoreFont labelFont;
     190                        FontPlatformData labelFont;
    191191                        WebCoreInitializeFont(&labelFont);
    192192                        labelFont.font = this->labelFont();
  • trunk/WebCore/kwq/KWQLineEdit.mm

    r14149 r14216  
    3434#import "WebCoreTextField.h"
    3535#import "WebCoreFrameBridge.h"
    36 #import "WebTextRenderer.h"
     36#import "FontData.h"
    3737#import "WebTextRendererFactory.h"
    3838#import "WebCoreViewFactory.h"
     
    262262    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    263263
    264     WebCoreFont font;
     264    FontPlatformData font;
    265265    WebCoreInitializeFont(&font);
    266266    font.font = [textField font];
    267267    font.forPrinter = ![NSGraphicsContext currentContextDrawingToScreen];
    268     WebTextRenderer* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font];
     268    FontData* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font];
    269269
    270270    NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
  • trunk/WebCore/kwq/KWQListBox.mm

    r14149 r14216  
    3030#import "FrameMac.h"
    3131#import "WebCoreFrameBridge.h"
    32 #import "WebTextRenderer.h"
     32#import "FontData.h"
    3333#import "WebTextRendererFactory.h"
    3434#import "WebCoreWidgetHolder.h"
     
    6767@end
    6868
    69 static WebTextRenderer* itemScreenRenderer;
    70 static WebTextRenderer* itemPrinterRenderer;
    71 static WebTextRenderer* groupLabelScreenRenderer;
    72 static WebTextRenderer* groupLabelPrinterRenderer;
     69static FontData* itemScreenRenderer;
     70static FontData* itemPrinterRenderer;
     71static FontData* groupLabelScreenRenderer;
     72static FontData* groupLabelPrinterRenderer;
    7373
    7474static NSFont *itemFont()
     
    7878}
    7979
    80 static WebTextRenderer* itemTextRenderer()
     80static FontData* itemTextRenderer()
    8181{
    8282    if ([NSGraphicsContext currentContextDrawingToScreen]) {
    8383        if (itemScreenRenderer == nil) {
    84             WebCoreFont font;
     84            FontPlatformData font;
    8585            WebCoreInitializeFont(&font);
    8686            font.font = itemFont();
     
    9090    } else {
    9191        if (itemPrinterRenderer == nil) {
    92             WebCoreFont font;
     92            FontPlatformData font;
    9393            WebCoreInitializeFont(&font);
    9494            font.font = itemFont();
     
    100100}
    101101
    102 static WebTextRenderer* groupLabelTextRenderer()
     102static FontData* groupLabelTextRenderer()
    103103{
    104104    if ([NSGraphicsContext currentContextDrawingToScreen]) {
    105105        if (groupLabelScreenRenderer == nil) {
    106             WebCoreFont font;
     106            FontPlatformData font;
    107107            WebCoreInitializeFont(&font);
    108108            font.font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]];
     
    112112    } else {
    113113        if (groupLabelPrinterRenderer == nil) {
    114             WebCoreFont font;
     114            FontPlatformData font;
    115115            WebCoreInitializeFont(&font);
    116116            font.font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]];
     
    280280            style.applyWordRounding = NO;
    281281           
    282             WebTextRenderer* renderer;
    283             WebTextRenderer* groupLabelRenderer;
     282            FontData* renderer;
     283            FontData* groupLabelRenderer;
    284284           
    285285            if (tableView->isSystemFont) {       
     
    287287                groupLabelRenderer = groupLabelTextRenderer();
    288288            } else {
    289                 renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font().getWebCoreFont()];
     289                renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font().platformFont()];
    290290                FontDescription boldDesc = font().fontDescription();
    291291                boldDesc.setWeight(cBoldWeight);
    292292                Font b = Font(boldDesc, font().letterSpacing(), font().wordSpacing());
    293293                b.update();
    294                 groupLabelRenderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:b.getWebCoreFont()];
     294                groupLabelRenderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:b.platformFont()];
    295295            }
    296296           
     
    681681    bool rtl = _direction == NSWritingDirectionRightToLeft;
    682682
    683     WebTextRenderer* renderer;
     683    FontData* renderer;
    684684    if (isSystemFont) {
    685685        renderer = (item.type == KWQListBoxGroupLabel) ? groupLabelTextRenderer() : itemTextRenderer();
     
    690690            Font b = Font(boldDesc, _box->font().letterSpacing(), _box->font().wordSpacing());
    691691            b.update();
    692             renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:b.getWebCoreFont()];
     692            renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:b.platformFont()];
    693693        }
    694694        else
    695             renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:_box->font().getWebCoreFont()];
     695            renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:_box->font().platformFont()];
    696696    }
    697697   
  • trunk/WebCore/platform/Font.cpp

    r13858 r14216  
    2626#include "config.h"
    2727#include "Font.h"
     28#include "FontData.h"
    2829
    29 #include "FontDataSet.h"
     30#include "FontFallbackList.h"
    3031#include "GraphicsContext.h"
    3132#include "KWQKHTMLSettings.h"
     
    3334namespace WebCore {
    3435
    35 Font::Font() :m_dataSet(0), m_letterSpacing(0), m_wordSpacing(0) {}
     36Font::Font() :m_fontList(0), m_letterSpacing(0), m_wordSpacing(0) {}
    3637Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing)
    3738: m_fontDescription(fd),
    38   m_dataSet(0),
     39  m_fontList(0),
    3940  m_letterSpacing(letterSpacing),
    4041  m_wordSpacing(wordSpacing)
     
    4445{
    4546    m_fontDescription = other.m_fontDescription;
    46     m_dataSet = other.m_dataSet;
     47    m_fontList = other.m_fontList;
    4748    m_letterSpacing = other.m_letterSpacing;
    4849    m_wordSpacing = other.m_wordSpacing;
     
    5354    if (&other != this) {
    5455        m_fontDescription = other.m_fontDescription;
    55         m_dataSet = other.m_dataSet;
     56        m_fontList = other.m_fontList;
    5657        m_letterSpacing = other.m_letterSpacing;
    5758        m_wordSpacing = other.m_wordSpacing;
     
    7172    // won't stick around long enough to get you in trouble).  Still, this is pretty disgusting,
    7273    // and could eventually be rectified by using RefPtrs for Fonts themselves.
    73     if (!m_dataSet)
    74         m_dataSet = new FontDataSet();
    75     m_dataSet->invalidate();
     74    if (!m_fontList)
     75        m_fontList = new FontFallbackList();
     76    m_fontList->invalidate();
    7677}
    7778
     
    8687}
    8788
     89int Font::ascent() const
     90{
     91    assert(m_fontList);
     92    return m_fontList->primaryFont(fontDescription())->ascent();
    8893}
     94
     95int Font::descent() const
     96{
     97    assert(m_fontList);
     98    return m_fontList->primaryFont(fontDescription())->descent();
     99}
     100
     101int Font::lineSpacing() const
     102{
     103    assert(m_fontList);
     104    return m_fontList->primaryFont(fontDescription())->lineSpacing();
     105}
     106
     107float Font::xHeight() const
     108{
     109    assert(m_fontList);
     110    return m_fontList->primaryFont(fontDescription())->xHeight();
     111}
     112
     113bool Font::isFixedPitch() const
     114{
     115    assert(m_fontList);
     116    return m_fontList->isFixedPitch(fontDescription());
     117}
     118
     119}
  • trunk/WebCore/platform/Font.h

    r14115 r14216  
    3232
    3333#if __APPLE__
    34 
    35 #ifdef __OBJC__
    36 @class NSFont;
    37 #else
    38 class NSFont;
    39 #endif
    40 
    41 struct WebCoreFont {
    42     NSFont *font;
    43     bool syntheticBold;
    44     bool syntheticOblique;
    45     bool forPrinter;
    46 };
    47 
     34// FIXME: Should not be necessary.
     35#include "FontPlatformData.h"
    4836#endif
    4937
    5038namespace WebCore {
    5139
    52 class FontDataSet;
     40class FontFallbackList;
    5341class GraphicsContext;
    5442class IntPoint;
     
    124112
    125113#if __APPLE__
     114    // FIXME: Shouldn't need to access FontPlatformData... should just need NSFont.
    126115    NSString* getNSFamily() const { return m_fontDescription.family().getNSFamily(); }   
    127     NSFont* getNSFont() const { return getWebCoreFont().font; }
    128     const WebCoreFont& getWebCoreFont() const;
     116    NSFont* getNSFont() const { return platformFont().font; }
     117    const FontPlatformData& platformFont() const;
    129118#endif
    130119
    131     // Metrics that we query the FontDataSet for.
     120    // Metrics that we query the FontFallbackList for.
    132121    int ascent() const;
    133122    int descent() const;
     
    138127private:
    139128    FontDescription m_fontDescription;
    140     mutable RefPtr<FontDataSet> m_dataSet;
     129    mutable RefPtr<FontFallbackList> m_fontList;
    141130    short m_letterSpacing;
    142131    short m_wordSpacing;
  • trunk/WebCore/platform/FontData.h

    r13329 r14216  
    2121 *
    2222 */
     23
     24#if __APPLE__
     25typedef UInt16                          ATSGlyphRef;
     26typedef struct OpaqueATSUStyle*         ATSUStyle;
     27
     28#if __OBJC__
     29@class NSColor;
     30#else
     31class NSColor;
     32#endif
     33
     34#include "FloatPoint.h"
     35#include "FontPlatformData.h"
     36
     37namespace WebCore
     38{
     39
     40class FloatRect;
     41class Color;
     42
     43struct WebCoreTextStyle
     44{
     45    NSColor *textColor;
     46    NSColor *backgroundColor;
     47    int letterSpacing;
     48    int wordSpacing;
     49    int padding;
     50    int tabWidth;
     51    int xpos;
     52    NSString **families;
     53    bool smallCaps;
     54    bool rtl;
     55    bool directionalOverride;
     56    bool applyRunRounding;
     57    bool applyWordRounding;
     58    bool attemptFontSubstitution;
     59};
     60
     61struct WebCoreTextRun
     62{
     63    const UniChar *characters;
     64    unsigned int length;
     65    int from;
     66    int to;
     67};
     68
     69struct WebCoreTextGeometry
     70{
     71    FloatPoint point;
     72    float selectionY;
     73    float selectionHeight;
     74    bool useFontMetricsForSelectionYAndHeight;
     75};
     76
     77void WebCoreInitializeTextRun(WebCoreTextRun *run, const UniChar *characters, unsigned int length, int from, int to);
     78void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style);
     79void WebCoreInitializeEmptyTextGeometry(WebCoreTextGeometry *geometry);
     80void WebCoreInitializeFont(FontPlatformData *font);
     81
     82typedef struct WidthMap WidthMap;
     83typedef struct GlyphMap GlyphMap;
     84
     85class FontData
     86{
     87public:
     88    FontData(const FontPlatformData& f);
     89    ~FontData();
     90
     91public:
     92    static void setAlwaysUseATSU(bool);
     93    static bool gAlwaysUseATSU;
     94
     95    // vertical metrics
     96    int ascent() const { return m_ascent; }
     97    int descent() const { return m_descent; }
     98    int lineSpacing() const { return m_lineSpacing; }
     99    int lineGap() const { return m_lineGap; }
     100
     101    float xHeight() const;
     102
     103    // horizontal metrics
     104    float floatWidthForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style);
     105
     106    // drawing
     107    void drawRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry);
     108    FloatRect selectionRectForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry);
     109    void drawHighlightForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry);
     110    void drawLineForCharacters(const FloatPoint& point, float yOffset, int width, const Color& color, float thickness);
     111    void drawLineForMisspelling(const FloatPoint& point, int width);
     112    int misspellingLineThickness() const { return 3; }
     113
     114    // selection point check
     115    int pointToOffset(const WebCoreTextRun* run, const WebCoreTextStyle* style, int x, bool includePartialGlyphs);
     116
     117private:
     118    int misspellingLinePatternWidth() const { return 4; }
     119    int misspellingLinePatternGapWidth() const { return 1; } // the number of transparent pixels after the dot
     120
     121public:
     122    int m_ascent;
     123    int m_descent;
     124    int m_lineSpacing;
     125    int m_lineGap;
     126   
     127    void* m_styleGroup;
     128   
     129    FontPlatformData m_font;
     130    GlyphMap* m_characterToGlyphMap;
     131    WidthMap* m_glyphToWidthMap;
     132
     133    bool m_treatAsFixedPitch;
     134    ATSGlyphRef m_spaceGlyph;
     135    float m_spaceWidth;
     136    float m_adjustedSpaceWidth;
     137    float m_syntheticBoldOffset;
     138   
     139    FontData* m_smallCapsRenderer;
     140    ATSUStyle m_ATSUStyle;
     141    bool m_ATSUStyleInitialized;
     142    bool m_ATSUMirrors;
     143};
     144
     145}
     146
     147#else
    23148
    24149#include "FontPlatformData.h"
     
    60185
    61186}
     187#endif
  • trunk/WebCore/platform/FontFallbackList.h

    r14184 r14216  
    2929namespace WebCore {
    3030
    31 #ifdef __APPLE__
    32 class WebTextRenderer;
    33 #endif
    34 
    3531class Font;
    3632class GraphicsContext;
    3733class IntRect;
    38 
    3934class FontData;
    4035
    41 class FontDataSet : public Shared<FontDataSet>, Noncopyable {
     36class FontFallbackList : public Shared<FontFallbackList>, Noncopyable {
    4237public:
    43     FontDataSet();
    44     ~FontDataSet();
     38    FontFallbackList();
     39    ~FontFallbackList();
    4540
     41    // FIXME: Eventually FontFallbackLists will be hashed themselves (by FontDescription), and so instead of invalidating we'll just
     42    // drop our reference.
    4643    void invalidate();
    4744   
     
    5148private:
    5249    mutable Pitch m_pitch;
     50   
     51    FontData* primaryFont(const FontDescription&) const;
     52
    5353#if __APPLE__
    54     WebTextRenderer* m_renderer;
    55     WebTextRenderer* getRenderer(const FontDescription&);
    56     mutable WebCoreFont m_webCoreFont;
    57     const WebCoreFont& getWebCoreFont(const FontDescription&) const;
     54    // FIXME: FontData is still doing too much and is basically handling functionality that will be lifted up into
     55    // FontFallbackList and Font.  That's why we still only have one FontData object and don't yet have the vector.
     56    mutable FontData* m_font;
     57    mutable FontPlatformData m_platformFont;
     58
     59    const FontPlatformData& platformFont(const FontDescription&) const;
    5860#else
    59     mutable Vector<FontData*> m_fontSet;
    60     FontData* primaryFont(const FontDescription& desc) const;
     61    mutable Vector<FontData*> m_fontList;
    6162#endif
    6263
  • trunk/WebCore/platform/FontPlatformData.h

    r13329 r14216  
    2424#ifndef FontPlatformData_H
    2525#define FontPlatformData_H
     26
     27#ifdef __APPLE__
     28
     29#ifdef __OBJC__
     30@class NSFont;
     31#else
     32class NSFont;
     33#endif
     34
     35namespace WebCore {
     36
     37struct FontPlatformData {
     38    NSFont *font;
     39    bool syntheticBold;
     40    bool syntheticOblique;
     41    bool forPrinter;
     42};
     43
     44}
     45
     46#else
    2647
    2748#include <kxmlcore/Noncopyable.h>
     
    6182
    6283#endif
     84
     85#endif
  • trunk/WebCore/platform/mac/FontData.mm

    r14184 r14216  
    2929
    3030#import "config.h"
    31 #import "WebTextRenderer.h"
     31#import "FontData.h"
     32#import "Color.h"
    3233#import "WebCoreTextRenderer.h"
    3334
     
    99100typedef struct GlyphEntry {
    100101    ATSGlyphRef glyph;
    101     WebTextRenderer *renderer;
     102    FontData *renderer;
    102103} GlyphEntry;
    103104
     
    110111
    111112typedef struct WidthIterator {
    112     WebTextRenderer *renderer;
     113    FontData *renderer;
    113114    const WebCoreTextRun *run;
    114115    const WebCoreTextStyle *style;
     
    126127    const WebCoreTextStyle *style;
    127128    ATSUTextLayout layout;
    128     WebTextRenderer **renderers;
     129    FontData **renderers;
    129130    UniChar *charBuffer;
    130131    bool hasSyntheticBold;
     
    133134} ATSULayoutParameters;
    134135
    135 static WebTextRenderer *rendererForAlternateFont(WebTextRenderer *, WebCoreFont);
    136 
    137 static WidthMap *extendWidthMap(WebTextRenderer *, ATSGlyphRef);
    138 static ATSGlyphRef extendGlyphMap(WebTextRenderer *, UChar32);
    139 static void updateGlyphMapEntry(WebTextRenderer *, UChar32, ATSGlyphRef, WebTextRenderer *substituteRenderer);
     136static FontData *rendererForAlternateFont(FontData *, FontPlatformData);
     137
     138static WidthMap *extendWidthMap(FontData *, ATSGlyphRef);
     139static ATSGlyphRef extendGlyphMap(FontData *, UChar32);
     140static void updateGlyphMapEntry(FontData *, UChar32, ATSGlyphRef, FontData *substituteRenderer);
    140141
    141142static void freeWidthMap(WidthMap *);
    142143static void freeGlyphMap(GlyphMap *);
    143 static inline ATSGlyphRef glyphForCharacter(WebTextRenderer **, UChar32);
     144static inline ATSGlyphRef glyphForCharacter(FontData **, UChar32);
    144145
    145146// Measuring runs.
    146 static float CG_floatWidthForRun(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *,
    147     float *widthBuffer, WebTextRenderer **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult);
    148 static float ATSU_floatWidthForRun(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *);
     147static float CG_floatWidthForRun(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *,
     148    float *widthBuffer, FontData **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult);
     149static float ATSU_floatWidthForRun(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *);
    149150
    150151// Drawing runs.
    151 static void CG_draw(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    152 static void ATSU_draw(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     152static void CG_draw(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     153static void ATSU_draw(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    153154
    154155// Selection point detection in runs.
    155 static int CG_pointToOffset(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *,
     156static int CG_pointToOffset(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *,
    156157    int x, bool includePartialGlyphs);
    157 static int ATSU_pointToOffset(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *,
     158static int ATSU_pointToOffset(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *,
    158159    int x, bool includePartialGlyphs);
    159160
    160161// Selection rect.
    161 static NSRect CG_selectionRect(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    162 static NSRect ATSU_selectionRect(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     162static NSRect CG_selectionRect(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     163static NSRect ATSU_selectionRect(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    163164
    164165// Drawing highlight.
    165 static void CG_drawHighlight(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    166 static void ATSU_drawHighlight(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
    167 
    168 static bool setUpFont(WebTextRenderer *);
     166static void CG_drawHighlight(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     167static void ATSU_drawHighlight(FontData *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
     168
     169static bool setUpFont(FontData *);
    169170
    170171// Iterator functions
    171 static void initializeWidthIterator(WidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style);
    172 static unsigned advanceWidthIterator(WidthIterator *iterator, unsigned offset, float *widths, WebTextRenderer **renderersUsed, ATSGlyphRef *glyphsUsed);
     172static void initializeWidthIterator(WidthIterator *iterator, FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style);
     173static unsigned advanceWidthIterator(WidthIterator *iterator, unsigned offset, float *widths, FontData **renderersUsed, ATSGlyphRef *glyphsUsed);
    173174
    174175static bool fillStyleWithAttributes(ATSUStyle style, NSFont *theFont);
     
    179180#endif
    180181
    181 static void createATSULayoutParameters(ATSULayoutParameters *params, WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style);
     182static void createATSULayoutParameters(ATSULayoutParameters *params, FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style);
    182183static void disposeATSULayoutParameters(ATSULayoutParameters *params);
    183184
     
    208209}
    209210
    210 void WebCoreInitializeFont(WebCoreFont *font)
     211void WebCoreInitializeFont(FontPlatformData *font)
    211212{
    212213    font->font = nil;
     
    242243void WebCoreInitializeEmptyTextGeometry(WebCoreTextGeometry *geometry)
    243244{
    244     geometry->point.x = 0;
    245     geometry->point.y = 0;
    246245    geometry->useFontMetricsForSelectionYAndHeight = YES;
    247246}
     
    249248// Map utility functions
    250249
    251 static inline WebGlyphWidth widthForGlyph(WebTextRenderer *renderer, ATSGlyphRef glyph)
     250static inline WebGlyphWidth widthForGlyph(FontData *renderer, ATSGlyphRef glyph)
    252251{
    253252    WidthMap *map;
     
    293292        const WebCoreTextRun *run = params->run;
    294293        const UniChar *characters = run->characters + run->from;
    295         WebTextRenderer **renderers = params->renderers + run->from;
    296         WebTextRenderer *renderer;
    297         WebTextRenderer *lastRenderer = 0;
     294        FontData **renderers = params->renderers + run->from;
     295        FontData *renderer;
     296        FontData *lastRenderer = 0;
    298297        UniChar ch, nextCh;
    299298        ByteCount offset = layoutRecords[0].originalOffset;
     
    397396}
    398397
    399 WebTextRenderer::WebTextRenderer(const WebCoreFont& f)
     398FontData::FontData(const FontPlatformData& f)
    400399:m_styleGroup(0), m_font(f), m_characterToGlyphMap(0), m_glyphToWidthMap(0), m_treatAsFixedPitch(false),
    401400 m_smallCapsRenderer(0), m_ATSUStyleInitialized(false), m_ATSUMirrors(false)
     
    489488}
    490489
    491 WebTextRenderer::~WebTextRenderer()
     490FontData::~FontData()
    492491{
    493492    if (m_styleGroup)
     
    506505}
    507506
    508 float WebTextRenderer::xHeight() const
     507float FontData::xHeight() const
    509508{
    510509    // Measure the actual character "x", because AppKit synthesizes X height rather than getting it from the font.
    511510    // Unfortunately, NSFont will round this for us so we don't quite get the right value.
    512     WebTextRenderer *renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:m_font];
     511    FontData *renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:m_font];
    513512    NSGlyph xGlyph = glyphForCharacter(&renderer, 'x');
    514513    if (xGlyph) {
     
    524523}
    525524
    526 void WebTextRenderer::drawRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
     525void FontData::drawRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
    527526{
    528527    if (shouldUseATSU(run))
     
    532531}
    533532
    534 float WebTextRenderer::floatWidthForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style)
     533float FontData::floatWidthForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style)
    535534{
    536535    if (shouldUseATSU(run))
     
    562561}
    563562
    564 void WebTextRenderer::drawLineForCharacters(const FloatPoint& point, float yOffset, int width, const Color& color, float thickness)
     563void FontData::drawLineForCharacters(const FloatPoint& point, float yOffset, int width, const Color& color, float thickness)
    565564{
    566565    // Note: This function assumes that point.x and point.y are integers (and that's currently always the case).
     
    609608}
    610609
    611 FloatRect WebTextRenderer::selectionRectForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
     610FloatRect FontData::selectionRectForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
    612611{
    613612    if (shouldUseATSU(run))
     
    617616}
    618617
    619 void WebTextRenderer::drawHighlightForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
     618void FontData::drawHighlightForRun(const WebCoreTextRun* run, const WebCoreTextStyle* style, const WebCoreTextGeometry* geometry)
    620619{
    621620    if (shouldUseATSU(run))
     
    625624}
    626625
    627 void WebTextRenderer::drawLineForMisspelling(const FloatPoint& point, int width)
     626void FontData::drawLineForMisspelling(const FloatPoint& point, int width)
    628627{
    629628    // Constants for pattern color
     
    672671}
    673672
    674 int WebTextRenderer::pointToOffset(const WebCoreTextRun* run, const WebCoreTextStyle* style, int x, bool includePartialGlyphs)
     673int FontData::pointToOffset(const WebCoreTextRun* run, const WebCoreTextStyle* style, int x, bool includePartialGlyphs)
    675674{
    676675    if (shouldUseATSU(run))
     
    679678}
    680679
    681 bool WebTextRenderer::gAlwaysUseATSU = false;
    682 
    683 void WebTextRenderer::setAlwaysUseATSU(bool alwaysUse)
     680bool FontData::gAlwaysUseATSU = false;
     681
     682void FontData::setAlwaysUseATSU(bool alwaysUse)
    684683{
    685684    gAlwaysUseATSU = alwaysUse;
    686685}
    687686
    688 static WebTextRenderer *getSmallCapsRenderer(WebTextRenderer *renderer)
     687static FontData *getSmallCapsRenderer(FontData *renderer)
    689688{
    690689    if (!renderer->m_smallCapsRenderer) {
    691690        NS_DURING
    692691            float size = [renderer->m_font.font pointSize] * SMALLCAPS_FONTSIZE_MULTIPLIER;
    693             WebCoreFont smallCapsFont;
     692            FontPlatformData smallCapsFont;
    694693            WebCoreInitializeFont(&smallCapsFont);
    695694            smallCapsFont.font = [[NSFontManager sharedFontManager] convertFont:renderer->m_font.font toSize:size];
     
    708707}
    709708
    710 static NSFont *findSubstituteFont(WebTextRenderer *renderer, NSString *string, NSString **families)
     709static NSFont *findSubstituteFont(FontData *renderer, NSString *string, NSString **families)
    711710{
    712711    NSFont *substituteFont = nil;
     
    754753}
    755754
    756 static WebTextRenderer *rendererForAlternateFont(WebTextRenderer *renderer, WebCoreFont alternateFont)
     755static FontData *rendererForAlternateFont(FontData *renderer, FontPlatformData alternateFont)
    757756{
    758757    if (!alternateFont.font)
     
    774773}
    775774
    776 static WebTextRenderer *findSubstituteRenderer(WebTextRenderer *renderer, const unichar *characters, int numCharacters, NSString **families)
    777 {
    778     WebCoreFont substituteFont;
     775static FontData *findSubstituteRenderer(FontData *renderer, const unichar *characters, int numCharacters, NSString **families)
     776{
     777    FontPlatformData substituteFont;
    779778    WebCoreInitializeFont(&substituteFont);
    780779    NSString *string = [[NSString alloc] initWithCharactersNoCopy:(unichar *)characters length: numCharacters freeWhenDone: NO];
     
    787786// If the font is monospace or fake monospace we ceil to ensure that
    788787// every character and the space are the same width.  Otherwise we round.
    789 static bool computeWidthForSpace(WebTextRenderer *renderer)
     788static bool computeWidthForSpace(FontData *renderer)
    790789{
    791790    renderer->m_spaceGlyph = extendGlyphMap(renderer, SPACE);
     
    803802}
    804803
    805 static bool setUpFont(WebTextRenderer *renderer)
     804static bool setUpFont(FontData *renderer)
    806805{
    807806    renderer->m_font.font = renderer->m_font.forPrinter ? [renderer->m_font.font printerFont] : [renderer->m_font.font screenFont];
     
    907906}
    908907
    909 static void CG_drawHighlight(WebTextRenderer *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     908static void CG_drawHighlight(FontData *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    910909{
    911910    if (run->length == 0)
     
    919918}
    920919
    921 static NSRect CG_selectionRect(WebTextRenderer *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     920static NSRect CG_selectionRect(FontData *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    922921{
    923922    float yPos = geometry->useFontMetricsForSelectionYAndHeight
    924         ? geometry->point.y - renderer->ascent() - (renderer->lineGap() / 2) : geometry->selectionY;
     923        ? geometry->point.y() - renderer->ascent() - (renderer->lineGap() / 2) : geometry->selectionY;
    925924    float height = geometry->useFontMetricsForSelectionYAndHeight
    926925        ? renderer->lineSpacing() : geometry->selectionHeight;
     
    941940        advanceWidthIterator(&it, run->length, 0, 0, 0);
    942941        float totalWidth = it.runWidthSoFar;
    943         return NSMakeRect(geometry->point.x + floorf(totalWidth - afterWidth), yPos, roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), height);
     942        return NSMakeRect(geometry->point.x() + floorf(totalWidth - afterWidth), yPos, roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), height);
    944943    } else {
    945         return NSMakeRect(geometry->point.x + floorf(beforeWidth), yPos, roundf(afterWidth) - floorf(beforeWidth), height);
    946     }
    947 }
    948 
    949 static void CG_draw(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     944        return NSMakeRect(geometry->point.x() + floorf(beforeWidth), yPos, roundf(afterWidth) - floorf(beforeWidth), height);
     945    }
     946}
     947
     948static void CG_draw(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    950949{
    951950    float *widthBuffer, localWidthBuffer[LOCAL_BUFFER_SIZE];
    952951    CGGlyph *glyphBuffer, localGlyphBuffer[LOCAL_BUFFER_SIZE];
    953     WebTextRenderer **rendererBuffer, *localRendererBuffer[LOCAL_BUFFER_SIZE];
     952    FontData **rendererBuffer, *localRendererBuffer[LOCAL_BUFFER_SIZE];
    954953    CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
    955954    int numGlyphs = 0, i;
     
    964963        widthBuffer = new float[length * MAX_GLYPH_EXPANSION];
    965964        glyphBuffer = new CGGlyph[length * MAX_GLYPH_EXPANSION];
    966         rendererBuffer = new WebTextRenderer*[length * MAX_GLYPH_EXPANSION];
     965        rendererBuffer = new FontData*[length * MAX_GLYPH_EXPANSION];
    967966    } else {
    968967        advances = localAdvanceBuffer;
     
    986985    // Calculate the starting point of the glyphs to be displayed by adding
    987986    // all the advances up to the first glyph.
    988     startX += geometry->point.x;
     987    startX += geometry->point.x();
    989988
    990989    if (style->backgroundColor != nil)
     
    10071006            advances[end] = aswap1;
    10081007
    1009             WebTextRenderer *rswap1 = rendererBuffer[i];
    1010             WebTextRenderer *rswap2 = rendererBuffer[end];
     1008            FontData *rswap1 = rendererBuffer[i];
     1009            FontData *rswap2 = rendererBuffer[end];
    10111010            rendererBuffer[i] = rswap2;
    10121011            rendererBuffer[end] = rswap1;
     
    10151014
    10161015    // Draw each contiguous run of glyphs that use the same renderer.
    1017     WebTextRenderer *currentRenderer = rendererBuffer[0];
     1016    FontData *currentRenderer = rendererBuffer[0];
    10181017    float nextX = startX;
    10191018    int lastFrom = 0;
    10201019    int nextGlyph = 0;
    10211020    while (nextGlyph < numGlyphs) {
    1022         WebTextRenderer *nextRenderer = rendererBuffer[nextGlyph];
     1021        FontData *nextRenderer = rendererBuffer[nextGlyph];
    10231022        if (nextRenderer != currentRenderer) {
    10241023            drawGlyphs(currentRenderer->m_font.font, style->textColor, &glyphBuffer[lastFrom], &advances[lastFrom],
    1025                 startX, geometry->point.y, nextGlyph - lastFrom,
     1024                startX, geometry->point.y(), nextGlyph - lastFrom,
    10261025                currentRenderer->m_syntheticBoldOffset, currentRenderer->m_font.syntheticOblique);
    10271026            lastFrom = nextGlyph;
     
    10331032    }
    10341033    drawGlyphs(currentRenderer->m_font.font, style->textColor, &glyphBuffer[lastFrom], &advances[lastFrom],
    1035         startX, geometry->point.y, nextGlyph - lastFrom,
     1034        startX, geometry->point.y(), nextGlyph - lastFrom,
    10361035        currentRenderer->m_syntheticBoldOffset, currentRenderer->m_font.syntheticOblique);
    10371036
     
    10441043}
    10451044
    1046 static float CG_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult)
     1045static float CG_floatWidthForRun(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, FontData **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult)
    10471046{
    10481047    WidthIterator it;
     
    10731072}
    10741073
    1075 static void updateGlyphMapEntry(WebTextRenderer *renderer, UChar32 c, ATSGlyphRef glyph, WebTextRenderer *substituteRenderer)
     1074static void updateGlyphMapEntry(FontData *renderer, UChar32 c, ATSGlyphRef glyph, FontData *substituteRenderer)
    10761075{
    10771076    GlyphMap *map;
     
    10901089}
    10911090
    1092 static ATSGlyphRef extendGlyphMap(WebTextRenderer *renderer, UChar32 c)
     1091static ATSGlyphRef extendGlyphMap(FontData *renderer, UChar32 c)
    10931092{
    10941093    GlyphMap *map = new GlyphMap;
     
    11861185}
    11871186
    1188 static WidthMap *extendWidthMap(WebTextRenderer *renderer, ATSGlyphRef glyph)
     1187static WidthMap *extendWidthMap(FontData *renderer, ATSGlyphRef glyph)
    11891188{
    11901189    WidthMap *map = new WidthMap;
     
    12301229}
    12311230
    1232 static void initializeATSUStyle(WebTextRenderer *renderer)
     1231static void initializeATSUStyle(FontData *renderer)
    12331232{
    12341233    // The two NSFont calls in this method (pointSize and _atsFontID) do not raise exceptions.
     
    12831282}
    12841283
    1285 static void createATSULayoutParameters(ATSULayoutParameters *params, WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
     1284static void createATSULayoutParameters(ATSULayoutParameters *params, FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
    12861285{
    12871286    params->run = run;
     
    12891288    // FIXME: It is probably best to always allocate a buffer for RTL, since even if for this
    12901289    // renderer ATSUMirrors is true, for a substitute renderer it might be false.
    1291     WebTextRenderer** renderers = new WebTextRenderer*[run->length];
     1290    FontData** renderers = new FontData*[run->length];
    12921291    params->renderers = renderers;
    12931292    UniChar *charBuffer = (UniChar*)((style->smallCaps || (style->rtl && !renderer->m_ATSUMirrors)) ? new UniChar[run->length] : 0);
     
    13521351    UniCharCount substituteLength;
    13531352    UniCharArrayOffset lastOffset;
    1354     WebTextRenderer *substituteRenderer = 0;
     1353    FontData *substituteRenderer = 0;
    13551354
    13561355    while (substituteOffset < runTo) {
     
    13721371        bool isSmallCap = false;
    13731372        UniCharArrayOffset firstSmallCap = 0;
    1374         WebTextRenderer *r = renderer;
     1373        FontData *r = renderer;
    13751374        UniCharArrayOffset i;
    13761375        for (i = lastOffset;  ; i++) {
     
    14341433}
    14351434
    1436 static ATSTrapezoid getTextBounds(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, NSPoint p)
     1435static ATSTrapezoid getTextBounds(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, NSPoint p)
    14371436{
    14381437    OSStatus status;
     
    14591458}
    14601459
    1461 static float ATSU_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
     1460static float ATSU_floatWidthForRun(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
    14621461{
    14631462    ATSTrapezoid oGlyphBounds = getTextBounds(renderer, run, style, NSZeroPoint);
     
    14921491}
    14931492
    1494 static void ATSU_drawHighlight(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     1493static void ATSU_drawHighlight(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    14951494{
    14961495    // The only Cocoa calls made here are to NSColor and NSBezierPath, and they do not raise exceptions.
     
    15051504}
    15061505
    1507 static NSRect ATSU_selectionRect(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     1506static NSRect ATSU_selectionRect(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    15081507{
    15091508    int from = run->from;
     
    15441543    float afterWidth = MAX(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x));
    15451544    float yPos = geometry->useFontMetricsForSelectionYAndHeight
    1546         ? geometry->point.y - renderer->ascent() : geometry->selectionY;
     1545        ? geometry->point.y() - renderer->ascent() : geometry->selectionY;
    15471546    float height = geometry->useFontMetricsForSelectionYAndHeight
    15481547        ? renderer->lineSpacing() : geometry->selectionHeight;
    15491548
    1550     NSRect rect = NSMakeRect(geometry->point.x + floorf(beforeWidth), yPos, roundf(afterWidth) - floorf(beforeWidth), height);
     1549    NSRect rect = NSMakeRect(geometry->point.x() + floorf(beforeWidth), yPos, roundf(afterWidth) - floorf(beforeWidth), height);
    15511550
    15521551    if (style->directionalOverride)
     
    15571556
    15581557
    1559 static void ATSU_draw(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
     1558static void ATSU_draw(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, const WebCoreTextGeometry *geometry)
    15601559{
    15611560    // The only Cocoa calls made here are to NSColor and NSGraphicsContext, and they do not raise exceptions.
     
    15961595    NSGraphicsContext *gContext = [NSGraphicsContext currentContext];
    15971596    CGContextRef context = (CGContextRef)[gContext graphicsPort];
    1598     CGContextTranslateCTM(context, geometry->point.x, geometry->point.y);
     1597    CGContextTranslateCTM(context, geometry->point.x(), geometry->point.y());
    15991598    bool flipped = [gContext isFlipped];
    16001599    if (!flipped)
     
    16091608    if (!flipped)
    16101609        CGContextScaleCTM(context, 1.0, -1.0);
    1611     CGContextTranslateCTM(context, -geometry->point.x, -geometry->point.y);
     1610    CGContextTranslateCTM(context, -geometry->point.x(), -geometry->point.y());
    16121611
    16131612    if (status != noErr) {
     
    16221621}
    16231622
    1624 static int ATSU_pointToOffset(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style,
     1623static int ATSU_pointToOffset(FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style,
    16251624    int x, bool includePartialGlyphs)
    16261625{
     
    16631662{
    16641663    float widths[MAX_GLYPH_EXPANSION];
    1665     WebTextRenderer *renderers[MAX_GLYPH_EXPANSION];
     1664    FontData *renderers[MAX_GLYPH_EXPANSION];
    16661665    ATSGlyphRef glyphs[MAX_GLYPH_EXPANSION];           
    16671666    unsigned numGlyphs = advanceWidthIterator(iterator, iterator->currentCharacter + 1, widths, renderers, glyphs);
     
    16741673}
    16751674
    1676 static int CG_pointToOffset(WebTextRenderer *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style,
     1675static int CG_pointToOffset(FontData *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style,
    16771676    int x, bool includePartialGlyphs)
    16781677{
     
    17401739}
    17411740
    1742 static inline ATSGlyphRef glyphForCharacter(WebTextRenderer **renderer, UChar32 c)
     1741static inline ATSGlyphRef glyphForCharacter(FontData **renderer, UChar32 c)
    17431742{
    17441743    // this loop is hot, so it is written to avoid LSU stalls
     
    17581757}
    17591758
    1760 static void initializeWidthIterator(WidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
     1759static void initializeWidthIterator(WidthIterator *iterator, FontData *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
    17611760{
    17621761    iterator->renderer = renderer;
     
    18171816}
    18181817
    1819 static unsigned advanceWidthIterator(WidthIterator *iterator, unsigned offset, float *widths, WebTextRenderer **renderersUsed, ATSGlyphRef *glyphsUsed)
     1818static unsigned advanceWidthIterator(WidthIterator *iterator, unsigned offset, float *widths, FontData **renderersUsed, ATSGlyphRef *glyphsUsed)
    18201819{
    18211820    const WebCoreTextRun *run = iterator->run;
     
    18671866        }
    18681867
    1869         WebTextRenderer *renderer = iterator->renderer;
     1868        FontData *renderer = iterator->renderer;
    18701869
    18711870        if (needCharTransform) {
     
    19021901        // string. If one isn't found we end up drawing and measuring the 0 glyph, usually a box.
    19031902        if (glyph == 0 && style->attemptFontSubstitution) {
    1904             WebTextRenderer *substituteRenderer = findSubstituteRenderer(renderer, cp, clusterLength, style->families);
     1903            FontData *substituteRenderer = findSubstituteRenderer(renderer, cp, clusterLength, style->families);
    19051904            if (substituteRenderer) {
    19061905                WebCoreTextRun clusterRun = { cp, clusterLength, 0, clusterLength };
     
    19121911                int cNumGlyphs;
    19131912                float localWidthBuffer[MAX_GLYPH_EXPANSION];
    1914                 WebTextRenderer *localRendererBuffer[MAX_GLYPH_EXPANSION];
     1913                FontData *localRendererBuffer[MAX_GLYPH_EXPANSION];
    19151914                ATSGlyphRef localGlyphBuffer[MAX_GLYPH_EXPANSION];           
    19161915                CG_floatWidthForRun(substituteRenderer, &clusterRun, &clusterStyle, localWidthBuffer, localRendererBuffer, localGlyphBuffer, 0, &cNumGlyphs);
  • trunk/WebCore/platform/mac/FontMac.mm

    r14149 r14216  
    3131#import "FoundationExtras.h"
    3232
    33 #import "FontDataSet.h"
     33#import "FontFallbackList.h"
    3434#import "GraphicsContext.h"
    3535#import "KWQKHTMLSettings.h"
    3636
    37 #import "WebTextRenderer.h"
     37#import "FontData.h"
    3838#import "WebTextRendererFactory.h"
    3939
     
    4242namespace WebCore {
    4343
    44 FontDataSet::FontDataSet()
    45 :m_pitch(UnknownPitch), m_renderer(nil)
    46 {
    47     m_webCoreFont.font = nil;
    48 }
    49 
    50 FontDataSet::~FontDataSet()
    51 {
    52     KWQRelease(m_webCoreFont.font);
    53 }
    54 
    55 const WebCoreFont& FontDataSet::getWebCoreFont(const FontDescription& fontDescription) const
    56 {
    57     if (!m_webCoreFont.font) {
     44FontFallbackList::FontFallbackList()
     45:m_pitch(UnknownPitch), m_font(nil)
     46{
     47    m_platformFont.font = nil;
     48}
     49
     50FontFallbackList::~FontFallbackList()
     51{
     52    KWQRelease(m_platformFont.font);
     53}
     54
     55const FontPlatformData& FontFallbackList::platformFont(const FontDescription& fontDescription) const
     56{
     57    if (!m_platformFont.font) {
    5858        CREATE_FAMILY_ARRAY(fontDescription, families);
    5959        BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
    6363        if (fontDescription.weight() >= WebCore::cBoldWeight)
    6464            traits |= NSBoldFontMask;
    65         m_webCoreFont = [[WebTextRendererFactory sharedFactory]
     65        m_platformFont = [[WebTextRendererFactory sharedFactory]
    6666                                     fontWithFamilies:families traits:traits size:fontDescription.computedPixelSize()];
    67         KWQRetain(m_webCoreFont.font);
    68         m_webCoreFont.forPrinter = fontDescription.usePrinterFont();
     67        KWQRetain(m_platformFont.font);
     68        m_platformFont.forPrinter = fontDescription.usePrinterFont();
    6969        END_BLOCK_OBJC_EXCEPTIONS;
    7070    }
    71     return m_webCoreFont;
    72 }
    73 
    74 WebTextRenderer* FontDataSet::getRenderer(const FontDescription& fontDescription)
    75 {
    76     if (!m_renderer)
    77         m_renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:getWebCoreFont(fontDescription)];
    78     return m_renderer;
    79 }
    80 
    81 void FontDataSet::determinePitch(const FontDescription& fontDescription) const {
     71    return m_platformFont;
     72}
     73
     74FontData* FontFallbackList::primaryFont(const FontDescription& fontDescription) const
     75{
     76    if (!m_font)
     77        m_font = [[WebTextRendererFactory sharedFactory] rendererWithFont:platformFont(fontDescription)];
     78    return m_font;
     79}
     80
     81void FontFallbackList::determinePitch(const FontDescription& fontDescription) const
     82{
    8283    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    83     if ([[WebTextRendererFactory sharedFactory] isFontFixedPitch:getWebCoreFont(fontDescription)])
     84    if ([[WebTextRendererFactory sharedFactory] isFontFixedPitch:platformFont(fontDescription)])
    8485        m_pitch = FixedPitch;
    8586    else
     
    8889}
    8990
    90 void FontDataSet::invalidate()
    91 {
    92     m_renderer = 0;
    93     KWQRelease(m_webCoreFont.font);
    94     m_webCoreFont.font = nil;
     91void FontFallbackList::invalidate()
     92{
     93    m_font = 0;
     94    KWQRelease(m_platformFont.font);
     95    m_platformFont.font = nil;
    9596    m_pitch = UnknownPitch;
    9697}
    9798
    98 const WebCoreFont& Font::getWebCoreFont() const
    99 {
    100     return m_dataSet->getWebCoreFont(fontDescription());
    101 }
    102 
    103 int Font::ascent() const
    104 {
    105     assert(m_dataSet);
    106     return m_dataSet->getRenderer(fontDescription())->ascent();
    107 }
    108 
    109 int Font::descent() const
    110 {
    111     assert(m_dataSet);
    112     return m_dataSet->getRenderer(fontDescription())->descent();
    113 }
    114 
    115 int Font::lineSpacing() const
    116 {
    117     assert(m_dataSet);
    118     return m_dataSet->getRenderer(fontDescription())->lineSpacing();
    119 }
    120 
    121 float Font::xHeight() const
    122 {
    123     assert(m_dataSet);
    124     return m_dataSet->getRenderer(fontDescription())->xHeight();
    125 }
    126 
    127 bool Font::isFixedPitch() const
    128 {
    129     assert(m_dataSet);
    130     return m_dataSet->isFixedPitch(fontDescription());
     99const FontPlatformData& Font::platformFont() const
     100{
     101    return m_fontList->platformFont(fontDescription());
    131102}
    132103
     
    135106    bool rtl, bool visuallyOrdered, int from, int to) const
    136107{
    137     assert(m_dataSet);
     108    assert(m_fontList);
    138109    int len = std::min(slen - pos, l);
    139110
     
    164135    geometry.selectionHeight = h;
    165136    geometry.useFontMetricsForSelectionYAndHeight = false;
    166     return enclosingIntRect(m_dataSet->getRenderer(fontDescription())->selectionRectForRun(&run, &style, &geometry));
     137    return enclosingIntRect(m_fontList->primaryFont(fontDescription())->selectionRectForRun(&run, &style, &geometry));
    167138}
    168139                     
     
    197168    WebCoreInitializeEmptyTextGeometry(&geometry);
    198169    geometry.point = point;
    199     m_dataSet->getRenderer(fontDescription())->drawRun(&run, &style, &geometry);
     170    m_fontList->primaryFont(fontDescription())->drawRun(&run, &style, &geometry);
    200171}
    201172
     
    234205    geometry.selectionHeight = h;
    235206    geometry.useFontMetricsForSelectionYAndHeight = false;
    236     m_dataSet->getRenderer(fontDescription())->drawHighlightForRun(&run, &style, &geometry);
     207    m_fontList->primaryFont(fontDescription())->drawHighlightForRun(&run, &style, &geometry);
    237208}
    238209
    239210void Font::drawLineForText(GraphicsContext* context, const IntPoint& point, int yOffset, int width) const
    240211{
    241     m_dataSet->getRenderer(fontDescription())->drawLineForCharacters(point, yOffset, width, context->pen().color(), context->pen().width());
     212    m_fontList->primaryFont(fontDescription())->drawLineForCharacters(point, yOffset, width, context->pen().color(), context->pen().width());
    242213}
    243214
    244215void Font::drawLineForMisspelling(GraphicsContext* context, const IntPoint& point, int width) const
    245216{
    246     m_dataSet->getRenderer(fontDescription())->drawLineForMisspelling(point, width);
     217    m_fontList->primaryFont(fontDescription())->drawLineForMisspelling(point, width);
    247218}
    248219
    249220int Font::misspellingLineThickness(GraphicsContext* context) const
    250221{
    251     return m_dataSet->getRenderer(fontDescription())->misspellingLineThickness();
     222    return m_fontList->primaryFont(fontDescription())->misspellingLineThickness();
    252223}
    253224
    254225float Font::floatWidth(const QChar* uchars, int slen, int pos, int len, int tabWidth, int xpos, bool runRounding) const
    255226{
    256     assert(m_dataSet);
     227    assert(m_fontList);
    257228    CREATE_FAMILY_ARRAY(fontDescription(), families);
    258229
     
    270241    style.applyRunRounding = runRounding;
    271242
    272     return m_dataSet->getRenderer(fontDescription())->floatWidthForRun(&run, &style);
     243    return m_fontList->primaryFont(fontDescription())->floatWidthForRun(&run, &style);
    273244}
    274245
    275246int Font::checkSelectionPoint(const QChar* s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, TextDirection d, bool visuallyOrdered, bool includePartialGlyphs) const
    276247{
    277     assert(m_dataSet);
     248    assert(m_fontList);
    278249    CREATE_FAMILY_ARRAY(fontDescription(), families);
    279250   
     
    293264    style.directionalOverride = visuallyOrdered;
    294265
    295     return m_dataSet->getRenderer(fontDescription())->pointToOffset(&run, &style, x, includePartialGlyphs);
    296 }
    297 
    298 }
     266    return m_fontList->primaryFont(fontDescription())->pointToOffset(&run, &style, x, includePartialGlyphs);
     267}
     268
     269}
  • trunk/WebCore/platform/mac/WebCoreTextRenderer.mm

    r14149 r14216  
    2727#import "WebCoreTextRenderer.h"
    2828
    29 #import "WebTextRenderer.h"
     29#import "FontData.h"
    3030#import "WebTextRendererFactory.h"
    3131
     
    3434void WebCoreDrawTextAtPoint(const UniChar* buffer, unsigned length, NSPoint point, NSFont* font, NSColor* textColor)
    3535{
    36     WebCoreFont f;
     36    FontPlatformData f;
    3737    WebCoreInitializeFont(&f);
    3838    f.font = font;
    39     WebTextRenderer* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:f];
     39    FontData* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:f];
    4040
    4141    WebCoreTextRun run;
     
    5454float WebCoreTextFloatWidth(const UniChar* buffer, unsigned length , NSFont* font)
    5555{
    56     WebCoreFont f;
     56    FontPlatformData f;
    5757    WebCoreInitializeFont(&f);
    5858    f.font = font;
    59     WebTextRenderer* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:f];
     59    FontData* renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:f];
    6060
    6161    WebCoreTextRun run;
     
    8282void WebCoreSetAlwaysUseATSU(bool useATSU)
    8383{
    84     WebTextRenderer::setAlwaysUseATSU(useATSU);
     84    FontData::setAlwaysUseATSU(useATSU);
    8585}
    8686
  • trunk/WebCore/platform/mac/WebTextRendererFactory.h

    r14149 r14216  
    6060#include <kxmlcore/HashMap.h>
    6161
    62 struct WebCoreFont;
    63 
    6462namespace WebCore {
    65     class WebTextRenderer;
     63    class FontData;
     64    struct FontPlatformData;
    6665}
    6766
     
    7069@interface WebTextRendererFactory : NSObject
    7170{
    72     HashMap<NSFont*, WebCore::WebTextRenderer*>* caches[WEB_TEXT_RENDERER_FACTORY_NUM_CACHES];
     71    HashMap<NSFont*, WebCore::FontData*>* caches[WEB_TEXT_RENDERER_FACTORY_NUM_CACHES];
    7372}
    7473
     
    7675+ (WebTextRendererFactory *)sharedFactory;
    7776
    78 - (WebCoreFont)fontWithFamilies:(NSString **)families traits:(NSFontTraitMask)traits size:(float)size;
    79 - (BOOL)isFontFixedPitch:(WebCoreFont)font;
     77- (WebCore::FontPlatformData)fontWithFamilies:(NSString **)families traits:(NSFontTraitMask)traits size:(float)size;
     78- (BOOL)isFontFixedPitch:(WebCore::FontPlatformData)font;
    8079
    8180- (void)clearCaches;
     
    8382- (NSFont *)cachedFontFromFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size;
    8483
    85 - (WebCore::WebTextRenderer *)rendererWithFont:(WebCoreFont)font;
     84- (WebCore::FontData *)rendererWithFont:(WebCore::FontPlatformData)font;
    8685
    8786@end
  • trunk/WebCore/platform/mac/WebTextRendererFactory.mm

    r14179 r14216  
    2929#import "config.h"
    3030#import "WebTextRendererFactory.h"
    31 #import "WebTextRenderer.h"
     31#import "FontData.h"
    3232#import "WebCoreSystemInterface.h"
    3333
     
    198198}
    199199
    200 - (BOOL)isFontFixedPitch:(WebCoreFont)font
     200- (BOOL)isFontFixedPitch:(FontPlatformData)font
    201201{
    202202    NSFont *f = font.font;
     
    234234    int i;
    235235    for (i = 0; i < WEB_TEXT_RENDERER_FACTORY_NUM_CACHES; ++i)
    236         caches[i] = new HashMap<NSFont*, WebTextRenderer*>;
     236        caches[i] = new HashMap<NSFont*, FontData*>;
    237237   
    238238    ASSERT(!sharedFactory);
     
    251251}
    252252
    253 - (WebTextRenderer *)rendererWithFont:(WebCoreFont)font
    254 {
    255     HashMap<NSFont*, WebTextRenderer*>* cache = caches[(font.syntheticBold << 2) | (font.syntheticOblique << 1) | font.forPrinter];
    256     WebTextRenderer *renderer = cache->get(font.font);
     253- (FontData *)rendererWithFont:(FontPlatformData)font
     254{
     255    HashMap<NSFont*, FontData*>* cache = caches[(font.syntheticBold << 2) | (font.syntheticOblique << 1) | font.forPrinter];
     256    FontData *renderer = cache->get(font.font);
    257257    if (!renderer) {
    258         renderer = new WebTextRenderer(font);
     258        renderer = new FontData(font);
    259259        cache->set(font.font, renderer);
    260260    }
     
    277277}
    278278
    279 - (WebCoreFont)fontWithFamilies:(NSString **)families traits:(NSFontTraitMask)traits size:(float)size
     279- (FontPlatformData)fontWithFamilies:(NSString **)families traits:(NSFontTraitMask)traits size:(float)size
    280280{
    281281    NSFont *font = nil;
     
    322322        actualTraits = [[NSFontManager sharedFontManager] traitsOfFont:font];
    323323   
    324     WebCoreFont result;
     324    FontPlatformData result;
    325325    result.font = font;
    326326    result.syntheticBold = (traits & NSBoldFontMask) && !(actualTraits & NSBoldFontMask);
  • trunk/WebCore/platform/win/FontWin.cpp

    r14215 r14216  
    2929#include <cairo-win32.h>
    3030#include "FontData.h"
    31 #include "FontDataSet.h"
     31#include "FontFallbackList.h"
    3232#include "GraphicsContext.h"
    3333#include "IntRect.h"
     
    102102}
    103103
    104 FontDataSet::FontDataSet()
     104FontFallbackList::FontFallbackList()
    105105:m_pitch(UnknownPitch)
    106106{
     
    108108}
    109109
    110 FontDataSet::~FontDataSet()
    111 {
    112     deleteAllValues(m_fontSet);
    113 }
    114 
    115 void FontDataSet::determinePitch(const FontDescription& fontDescription) const
     110FontFallbackList::~FontFallbackList()
     111{
     112    deleteAllValues(m_fontList);
     113}
     114
     115void FontFallbackList::determinePitch(const FontDescription& fontDescription) const
    116116{
    117117    // FIXME: Implement this.
     
    119119}
    120120
    121 void FontDataSet::invalidate()
     121void FontFallbackList::invalidate()
    122122{
    123123    // Delete the Cairo fonts.
    124124    m_pitch = UnknownPitch;
    125     deleteAllValues(m_fontSet);
    126 }
    127 
    128 FontData* FontDataSet::primaryFont(const FontDescription& fontDescription) const
    129 {
    130     if (!m_fontSet.isEmpty())
    131         return m_fontSet[0];
     125    deleteAllValues(m_fontList);
     126    m_fontList.clear();
     127}
     128
     129FontData* FontFallbackList::primaryFont(const FontDescription& fontDescription) const
     130{
     131    if (!m_fontList.isEmpty())
     132        return m_fontList[0];
    132133
    133134    // We want to ensure that the primary Cairo font face exists.
     
    139140            FontData* font = getFontData(fontDescription, currFamily->family());
    140141            if (font) {
    141                 m_fontSet.append(font);
     142                m_fontList.append(font);
    142143                return font;
    143144            }
     
    150151    FontData* defaultFont = getFontData(fontDescription, AtomicString("Times New Roman"));
    151152    if (defaultFont)
    152         m_fontSet.append(defaultFont);
     153        m_fontList.append(defaultFont);
    153154    return defaultFont;
    154155}
     
    179180                       int tabWidth, int xpos, bool runRounding) const
    180181{
    181     FontData* font = m_dataSet->primaryFont(fontDescription());
     182    FontData* font = m_fontList->primaryFont(fontDescription());
    182183    if (!font)
    183184        return 0;
     
    187188    ReleaseDC(0, dc);
    188189    return runSize.width();
    189 }
    190 
    191 int Font::ascent() const
    192 {
    193     FontData* font = m_dataSet->primaryFont(fontDescription());
    194     if (font)
    195         return font->ascent();
    196     return 0;
    197 }
    198 
    199 int Font::descent() const
    200 {
    201     FontData* font = m_dataSet->primaryFont(fontDescription());
    202     if (font)
    203         return font->descent();
    204     return 0;
    205 }
    206 
    207 float Font::xHeight() const
    208 {
    209     FontData* font = m_dataSet->primaryFont(fontDescription());
    210     if (font)
    211         return font->xHeight();
    212     return 0;
    213 }
    214 
    215 int Font::lineSpacing() const
    216 {
    217     FontData* font = m_dataSet->primaryFont(fontDescription());
    218     if (font)
    219         return font->lineSpacing();
    220     return 0;
    221 }
    222 
    223 bool Font::isFixedPitch() const
    224 {
    225     return m_dataSet->isFixedPitch(fontDescription());
    226190}
    227191
     
    242206                    int toAdd, TextDirection d, bool visuallyOrdered) const
    243207{
    244     FontData* font = m_dataSet->primaryFont(fontDescription());
     208    FontData* font = m_fontList->primaryFont(fontDescription());
    245209    if (!font)
    246210        return;
     
    275239        return;
    276240
    277     FontData* font = m_dataSet->primaryFont(fontDescription());
     241    FontData* font = m_fontList->primaryFont(fontDescription());
    278242    if (!font)
    279243        return;
     
    293257                                   int pos, int len, int toAdd, bool rtl, bool visuallyOrdered, int from, int to) const
    294258{
    295     FontData* font = m_dataSet->primaryFont(fontDescription());
     259    FontData* font = m_fontList->primaryFont(fontDescription());
    296260    if (!font)
    297261        return IntRect();
     
    309273                              TextDirection, bool visuallyOrdered, bool includePartialGlyphs) const
    310274{
    311     FontData* font = m_dataSet->primaryFont(fontDescription());
     275    FontData* font = m_fontList->primaryFont(fontDescription());
    312276    if (!font)
    313277        return 0;
Note: See TracChangeset for help on using the changeset viewer.