WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2008 23:32:55 +0000 (23:32 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2008 23:32:55 +0000 (23:32 +0000)
        Reviewed by Dave Hyatt.

        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules

        * GNUmakefile.am:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        * bindings/objc/DOM.mm:
        * bridge/mac/WebCoreAXObject.mm:
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSFontFace.cpp:
        (WebCore::CSSFontFace::fontLoaded): Changed to call the owning segmented
        font face.
        (WebCore::CSSFontFace::getFontData):
        * css/CSSFontFace.h:
        (WebCore::CSSFontFace::CSSFontFace):
        (WebCore::CSSFontFace::setSegmentedFontFace):
        * css/CSSFontFaceSource.cpp:
        (WebCore::CSSFontFaceSource::pruneTable): Removed the calls to
        GlyphPageTreeNode::pruneTreeCustomFontData because the fonts in the
        font table are not exposed in the glyph page tree. Only the segmented
        font is, and that is taken care of by the segmented font face.
        (WebCore::CSSFontFaceSource::getFontData):
        * css/CSSFontFaceSource.h:
        * css/CSSFontSelector.cpp:
        (WebCore::CSSFontSelector::addFontFaceRule): Changed to collect
        @font-face rules with the same family and traits into a single
        segmented font face, instead of just retaining the most recent one.
        (WebCore::CSSFontSelector::fontLoaded):
        (WebCore::CSSFontSelector::getFontData):
        * css/CSSFontSelector.h:
        * css/CSSGrammar.y:
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parseFontFaceUnicodeRange): Added. Parses a unicode
        range value.
        * css/CSSParser.h:
        * css/CSSPrimitiveValue.h:
        (WebCore::CSSPrimitiveValue::):
        * css/CSSPropertyNames.in:
        * css/CSSSegmentedFontFace.cpp: Added.
        (WebCore::CSSSegmentedFontFace::CSSSegmentedFontFace):
        (WebCore::CSSSegmentedFontFace::~CSSSegmentedFontFace):
        (WebCore::CSSSegmentedFontFace::pruneTable):
        (WebCore::CSSSegmentedFontFace::isLoaded):
        (WebCore::CSSSegmentedFontFace::isValid):
        (WebCore::CSSSegmentedFontFace::fontLoaded):
        (WebCore::CSSSegmentedFontFace::overlayRange):
        (WebCore::CSSSegmentedFontFace::getFontData):
        * css/CSSSegmentedFontFace.h: Added.
        (WebCore::FontFaceRange::FontFaceRange):
        (WebCore::FontFaceRange::from):
        (WebCore::FontFaceRange::to):
        (WebCore::FontFaceRange::fontFace):
        (WebCore::CSSSegmentedFontFace::fontSelector):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * css/CSSUnicodeRangeValue.cpp: Added.
        (WebCore::CSSUnicodeRangeValue::~CSSUnicodeRangeValue):
        (WebCore::CSSUnicodeRangeValue::cssText):
        * css/CSSUnicodeRangeValue.h: Added.
        (WebCore::CSSUnicodeRangeValue::CSSUnicodeRangeValue):
        (WebCore::CSSUnicodeRangeValue::from):
        (WebCore::CSSUnicodeRangeValue::to):
        * css/SVGCSSFontFace.cpp:
        (WebCore::SVGCSSFontFace::getFontData):
        * css/SVGCSSFontFace.h:
        * editing/Editor.cpp:
        (WebCore::Editor::fontForSelection):
        * editing/Editor.h:
        * page/mac/FrameMac.mm:
        * page/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge fontForSelection:]):
        * platform/graphics/Font.cpp:
        (WebCore::WidthIterator::advance):
        (WebCore::Font::glyphDataForCharacter):
        (WebCore::Font::primaryFont): Changed to return the simple font data
        used for the space character.
        (WebCore::Font::fontDataAt):
        (WebCore::Font::fontDataForCharacters):
        (WebCore::Font::drawGlyphBuffer):
        * platform/graphics/Font.h:
        * platform/graphics/FontCache.cpp:
        (WebCore::FontCache::getCachedFontData):
        (WebCore::FontCache::getFontData):
        * platform/graphics/FontCache.h:
        * platform/graphics/FontData.cpp: Renamed to SimpleFontData.cpp
        * platform/graphics/FontData.h: Renamed to SimpleFontData.cpp.
        * platform/graphics/FontDataBaseClass.cpp: Added. This will be renamed
        FontData.cpp.
        (WebCore::FontData::~FontData):
        * platform/graphics/FontDataBaseClass.h: Added. This will be renamed
        FontData.h.
        * platform/graphics/FontFallbackList.cpp:
        (WebCore::FontFallbackList::determinePitch):
        (WebCore::FontFallbackList::fontDataAt):
        (WebCore::FontFallbackList::fontDataForCharacters):
        * platform/graphics/FontFallbackList.h:
        (WebCore::FontFallbackList::primaryFont):
        * platform/graphics/FontSelector.h:
        * platform/graphics/GlyphBuffer.h:
        (WebCore::GlyphBuffer::fontDataAt):
        (WebCore::GlyphBuffer::swap):
        (WebCore::GlyphBuffer::add):
        * platform/graphics/GlyphPageTreeNode.cpp:
        (WebCore::GlyphPageTreeNode::pruneTreeCustomFontData):
        (WebCore::GlyphPageTreeNode::initializePage): Added code to initialize
        pages for segmented font data.
        (WebCore::GlyphPageTreeNode::getChild):
        (WebCore::GlyphPageTreeNode::pruneCustomFontData):
        * platform/graphics/GlyphPageTreeNode.h:
        (WebCore::GlyphPage::setGlyphDataForCharacter):
        (WebCore::GlyphPage::setGlyphDataForIndex):
        (WebCore::GlyphPageTreeNode::getRootChild):
        * platform/graphics/SegmentedFontData.cpp: Added.
        (WebCore::SegmentedFontData::~SegmentedFontData):
        (WebCore::SegmentedFontData::fontDataForCharacter):
        (WebCore::SegmentedFontData::containsCharacters):
        (WebCore::SegmentedFontData::isCustomFont):
        (WebCore::SegmentedFontData::isLoading):
        (WebCore::SegmentedFontData::isSegmented):
        * platform/graphics/SegmentedFontData.h: Added.
        (WebCore::FontDataRange::FontDataRange):
        (WebCore::FontDataRange::from):
        (WebCore::FontDataRange::to):
        (WebCore::FontDataRange::fontData):
        (WebCore::SegmentedFontData::appendRange):
        (WebCore::SegmentedFontData::numRanges):
        (WebCore::SegmentedFontData::rangeAt):
        * platform/graphics/SimpleFontData.cpp: Copied from WebCore/platform/graphics/FontData.cpp.
        (WebCore::SimpleFontData::SimpleFontData):
        (WebCore::SimpleFontData::~SimpleFontData):
        (WebCore::SimpleFontData::ascent):
        (WebCore::SimpleFontData::descent):
        (WebCore::SimpleFontData::widthForGlyph):
        (WebCore::SimpleFontData::fontDataForCharacter):
        (WebCore::SimpleFontData::isSegmented):
        * platform/graphics/SimpleFontData.h: Copied from WebCore/platform/graphics/FontData.h.
        (WebCore::SimpleFontData::isCustomFont):
        (WebCore::SimpleFontData::isLoading):
        * platform/graphics/cairo/GraphicsContextCairo.cpp:
        (WebCore::GraphicsContext::setPlatformFont):
        * platform/graphics/gtk/FontCacheGtk.cpp:
        (WebCore::FontCache::getFontDataForCharacters):
        * platform/graphics/gtk/FontDataGtk.cpp: Renamed to
        SimpleFontDataGtk.cpp.
        * platform/graphics/gtk/FontGtk.cpp:
        (WebCore::Font::drawGlyphs):
        * platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp:
        (WebCore::GlyphPage::fill):
        * platform/graphics/gtk/SimpleFontDataGtk.cpp: Copied from WebCore/platform/graphics/gtk/FontDataGtk.cpp.
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformDestroy):
        (WebCore::SimpleFontData::smallCapsFontData):
        (WebCore::SimpleFontData::containsCharacters):
        (WebCore::SimpleFontData::determinePitch):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        (WebCore::SimpleFontData::setFont):
        * platform/graphics/mac/FontCacheMac.mm:
        (WebCore::FontCache::getFontDataForCharacters):
        * platform/graphics/mac/FontDataMac.mm: Renamed to SimpleFontDataMac.mm.
        * platform/graphics/mac/FontMac.mm:
        (WebCore::initializeATSUStyle):
        (WebCore::overrideLayoutOperation):
        (WebCore::ATSULayoutParameters::initialize):
        (WebCore::Font::drawGlyphs):
        * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
        (WebCore::GlyphPage::fill):
        * platform/graphics/mac/SimpleFontDataMac.mm: Copied from WebCore/platform/graphics/mac/FontDataMac.mm.
        (WebCore::initFontData):
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformDestroy):
        (WebCore::SimpleFontData::smallCapsFontData):
        (WebCore::SimpleFontData::containsCharacters):
        (WebCore::SimpleFontData::determinePitch):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        (WebCore::SimpleFontData::checkShapesArabic):
        * platform/graphics/qt/FontDataQt.cpp: Renamed to SimpleFontDataQt.cpp.
        * platform/graphics/qt/GlyphPageTreeNodeQt.cpp:
        (WebCore::GlyphPageTreeNode::pruneTreeCustomFontData):
        * platform/graphics/qt/SimpleFontDataQt.cpp: Copied from WebCore/platform/graphics/qt/FontDataQt.cpp.
        * platform/graphics/win/FontCacheWin.cpp:
        (WebCore::FontCache::getFontDataForCharacters):
        * platform/graphics/win/FontDataWin.cpp: Renamed to
        SimpleFontDataWin.cpp.
        * platform/graphics/win/FontWin.cpp:
        (WebCore::Font::drawGlyphs):
        * platform/graphics/win/GlyphPageTreeNodeWin.cpp:
        (WebCore::GlyphPage::fill):
        * platform/graphics/win/SimpleFontDataWin.cpp: Copied from WebCore/platform/graphics/win/FontDataWin.cpp.
        (WebCore::SimpleFontData::setShouldApplyMacAscentHack):
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformDestroy):
        (WebCore::SimpleFontData::smallCapsFontData):
        (WebCore::SimpleFontData::containsCharacters):
        (WebCore::SimpleFontData::determinePitch):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        (WebCore::SimpleFontData::scriptFontProperties):
        * platform/graphics/wx/FontCacheWx.cpp:
        (WebCore::FontCache::getFontDataForCharacters):
        * platform/graphics/wx/FontDataWx.cpp: Renamed to SimpleFontDataWx.cpp.
        * platform/graphics/wx/FontWx.cpp:
        (WebCore::Font::drawGlyphs):
        * platform/graphics/wx/GlyphMapWx.cpp:
        (WebCore::GlyphPage::fill):
        * platform/graphics/wx/SimpleFontDataWx.cpp: Copied from WebCore/platform/graphics/wx/FontDataWx.cpp.
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformDestroy):
        (WebCore::SimpleFontData::smallCapsFontData):
        (WebCore::SimpleFontData::containsCharacters):
        (WebCore::SimpleFontData::determinePitch):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        * platform/mac/FileChooserMac.mm:
        * platform/mac/PopupMenuMac.mm:
        * platform/mac/WebCoreTextRenderer.mm:
        * platform/win/PopupMenuWin.cpp:
        * platform/win/UniscribeController.cpp:
        (WebCore::UniscribeController::advance):
        (WebCore::UniscribeController::itemizeShapeAndPlace):
        (WebCore::UniscribeController::shapeAndPlaceItem):
        (WebCore::UniscribeController::shape):
        * platform/win/UniscribeController.h:
        * svg/SVGFont.cpp:
        (WebCore::Font::drawGlyphsWithSVGFont):
        * svg/SVGFontElement.cpp:
        (WebCore::SVGFontElement::collectGlyphs):
        * svg/SVGFontFaceElement.cpp:
        (WebCore::SVGFontFaceElement::createFontData):
        * svg/SVGFontFaceElement.h:
        * svg/SVGGlyphElement.cpp:

WebKit/mac:

        Reviewed by Dave Hyatt.

        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules

        * Misc/WebNSAttributedStringExtras.mm:

WebKit/win:

        Reviewed by Dave Hyatt.

        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules

        * WebView.cpp:
        (WebView::setShouldApplyMacFontAscentHack):

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

80 files changed:
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/WebCoreSources.bkl
WebCore/bindings/objc/DOM.mm
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/css/CSSComputedStyleDeclaration.cpp
WebCore/css/CSSFontFace.cpp
WebCore/css/CSSFontFace.h
WebCore/css/CSSFontFaceSource.cpp
WebCore/css/CSSFontFaceSource.h
WebCore/css/CSSFontSelector.cpp
WebCore/css/CSSFontSelector.h
WebCore/css/CSSGrammar.y
WebCore/css/CSSParser.cpp
WebCore/css/CSSParser.h
WebCore/css/CSSPrimitiveValue.h
WebCore/css/CSSPropertyNames.in
WebCore/css/CSSSegmentedFontFace.cpp [new file with mode: 0644]
WebCore/css/CSSSegmentedFontFace.h [new file with mode: 0644]
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSUnicodeRangeValue.cpp [new file with mode: 0644]
WebCore/css/CSSUnicodeRangeValue.h [new file with mode: 0644]
WebCore/css/SVGCSSFontFace.cpp
WebCore/css/SVGCSSFontFace.h
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/page/mac/FrameMac.mm
WebCore/page/mac/WebCoreFrameBridge.mm
WebCore/platform/graphics/Font.cpp
WebCore/platform/graphics/Font.h
WebCore/platform/graphics/FontCache.cpp
WebCore/platform/graphics/FontCache.h
WebCore/platform/graphics/FontDataBaseClass.cpp [new file with mode: 0644]
WebCore/platform/graphics/FontDataBaseClass.h [new file with mode: 0644]
WebCore/platform/graphics/FontFallbackList.cpp
WebCore/platform/graphics/FontFallbackList.h
WebCore/platform/graphics/GlyphBuffer.h
WebCore/platform/graphics/GlyphPageTreeNode.cpp
WebCore/platform/graphics/GlyphPageTreeNode.h
WebCore/platform/graphics/SegmentedFontData.cpp [new file with mode: 0644]
WebCore/platform/graphics/SegmentedFontData.h [new file with mode: 0644]
WebCore/platform/graphics/SimpleFontData.cpp [moved from WebCore/platform/graphics/FontData.cpp with 88% similarity]
WebCore/platform/graphics/SimpleFontData.h [moved from WebCore/platform/graphics/FontData.h with 86% similarity]
WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
WebCore/platform/graphics/gtk/FontCacheGtk.cpp
WebCore/platform/graphics/gtk/FontGtk.cpp
WebCore/platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp
WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp [moved from WebCore/platform/graphics/gtk/FontDataGtk.cpp with 89% similarity]
WebCore/platform/graphics/mac/FontCacheMac.mm
WebCore/platform/graphics/mac/FontMac.mm
WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
WebCore/platform/graphics/mac/SimpleFontDataMac.mm [moved from WebCore/platform/graphics/mac/FontDataMac.mm with 95% similarity]
WebCore/platform/graphics/qt/GlyphPageTreeNodeQt.cpp
WebCore/platform/graphics/qt/SimpleFontDataQt.cpp [moved from WebCore/platform/graphics/qt/FontDataQt.cpp with 97% similarity]
WebCore/platform/graphics/win/FontCacheWin.cpp
WebCore/platform/graphics/win/FontWin.cpp
WebCore/platform/graphics/win/GlyphPageTreeNodeWin.cpp
WebCore/platform/graphics/win/SimpleFontDataWin.cpp [moved from WebCore/platform/graphics/win/FontDataWin.cpp with 92% similarity]
WebCore/platform/graphics/wx/FontCacheWx.cpp
WebCore/platform/graphics/wx/FontWx.cpp
WebCore/platform/graphics/wx/GlyphMapWx.cpp
WebCore/platform/graphics/wx/SimpleFontDataWx.cpp [moved from WebCore/platform/graphics/wx/FontDataWx.cpp with 86% similarity]
WebCore/platform/mac/FileChooserMac.mm
WebCore/platform/mac/PopupMenuMac.mm
WebCore/platform/mac/WebCoreTextRenderer.mm
WebCore/platform/win/PopupMenuWin.cpp
WebCore/platform/win/UniscribeController.cpp
WebCore/platform/win/UniscribeController.h
WebCore/svg/SVGFont.cpp
WebCore/svg/SVGFontElement.cpp
WebCore/svg/SVGFontFaceElement.cpp
WebCore/svg/SVGFontFaceElement.h
WebCore/svg/SVGGlyphElement.cpp
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebNSAttributedStringExtras.mm
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index 6424a0c9115da9a8217fba8ba6fcd8b83ab1c59f..b97abbda6ff48d32792b628fd8b875cc1d2b0288 100644 (file)
@@ -1,3 +1,239 @@
+2008-01-07  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules
+
+        * GNUmakefile.am:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * WebCoreSources.bkl:
+        * bindings/objc/DOM.mm:
+        * bridge/mac/WebCoreAXObject.mm:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSFontFace.cpp:
+        (WebCore::CSSFontFace::fontLoaded): Changed to call the owning segmented
+        font face.
+        (WebCore::CSSFontFace::getFontData):
+        * css/CSSFontFace.h:
+        (WebCore::CSSFontFace::CSSFontFace):
+        (WebCore::CSSFontFace::setSegmentedFontFace):
+        * css/CSSFontFaceSource.cpp:
+        (WebCore::CSSFontFaceSource::pruneTable): Removed the calls to
+        GlyphPageTreeNode::pruneTreeCustomFontData because the fonts in the
+        font table are not exposed in the glyph page tree. Only the segmented
+        font is, and that is taken care of by the segmented font face.
+        (WebCore::CSSFontFaceSource::getFontData):
+        * css/CSSFontFaceSource.h:
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::addFontFaceRule): Changed to collect
+        @font-face rules with the same family and traits into a single
+        segmented font face, instead of just retaining the most recent one.
+        (WebCore::CSSFontSelector::fontLoaded):
+        (WebCore::CSSFontSelector::getFontData):
+        * css/CSSFontSelector.h:
+        * css/CSSGrammar.y:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFontFaceUnicodeRange): Added. Parses a unicode
+        range value.
+        * css/CSSParser.h:
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::):
+        * css/CSSPropertyNames.in:
+        * css/CSSSegmentedFontFace.cpp: Added.
+        (WebCore::CSSSegmentedFontFace::CSSSegmentedFontFace):
+        (WebCore::CSSSegmentedFontFace::~CSSSegmentedFontFace):
+        (WebCore::CSSSegmentedFontFace::pruneTable):
+        (WebCore::CSSSegmentedFontFace::isLoaded):
+        (WebCore::CSSSegmentedFontFace::isValid):
+        (WebCore::CSSSegmentedFontFace::fontLoaded):
+        (WebCore::CSSSegmentedFontFace::overlayRange):
+        (WebCore::CSSSegmentedFontFace::getFontData):
+        * css/CSSSegmentedFontFace.h: Added.
+        (WebCore::FontFaceRange::FontFaceRange):
+        (WebCore::FontFaceRange::from):
+        (WebCore::FontFaceRange::to):
+        (WebCore::FontFaceRange::fontFace):
+        (WebCore::CSSSegmentedFontFace::fontSelector):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * css/CSSUnicodeRangeValue.cpp: Added.
+        (WebCore::CSSUnicodeRangeValue::~CSSUnicodeRangeValue):
+        (WebCore::CSSUnicodeRangeValue::cssText):
+        * css/CSSUnicodeRangeValue.h: Added.
+        (WebCore::CSSUnicodeRangeValue::CSSUnicodeRangeValue):
+        (WebCore::CSSUnicodeRangeValue::from):
+        (WebCore::CSSUnicodeRangeValue::to):
+        * css/SVGCSSFontFace.cpp:
+        (WebCore::SVGCSSFontFace::getFontData):
+        * css/SVGCSSFontFace.h:
+        * editing/Editor.cpp:
+        (WebCore::Editor::fontForSelection):
+        * editing/Editor.h:
+        * page/mac/FrameMac.mm:
+        * page/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge fontForSelection:]):
+        * platform/graphics/Font.cpp:
+        (WebCore::WidthIterator::advance):
+        (WebCore::Font::glyphDataForCharacter):
+        (WebCore::Font::primaryFont): Changed to return the simple font data
+        used for the space character.
+        (WebCore::Font::fontDataAt):
+        (WebCore::Font::fontDataForCharacters):
+        (WebCore::Font::drawGlyphBuffer):
+        * platform/graphics/Font.h:
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontCache::getCachedFontData):
+        (WebCore::FontCache::getFontData):
+        * platform/graphics/FontCache.h:
+        * platform/graphics/FontData.cpp: Renamed to SimpleFontData.cpp
+        * platform/graphics/FontData.h: Renamed to SimpleFontData.cpp.
+        * platform/graphics/FontDataBaseClass.cpp: Added. This will be renamed
+        FontData.cpp.
+        (WebCore::FontData::~FontData):
+        * platform/graphics/FontDataBaseClass.h: Added. This will be renamed
+        FontData.h.
+        * platform/graphics/FontFallbackList.cpp:
+        (WebCore::FontFallbackList::determinePitch):
+        (WebCore::FontFallbackList::fontDataAt):
+        (WebCore::FontFallbackList::fontDataForCharacters):
+        * platform/graphics/FontFallbackList.h:
+        (WebCore::FontFallbackList::primaryFont):
+        * platform/graphics/FontSelector.h:
+        * platform/graphics/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::fontDataAt):
+        (WebCore::GlyphBuffer::swap):
+        (WebCore::GlyphBuffer::add):
+        * platform/graphics/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::pruneTreeCustomFontData):
+        (WebCore::GlyphPageTreeNode::initializePage): Added code to initialize
+        pages for segmented font data.
+        (WebCore::GlyphPageTreeNode::getChild):
+        (WebCore::GlyphPageTreeNode::pruneCustomFontData):
+        * platform/graphics/GlyphPageTreeNode.h:
+        (WebCore::GlyphPage::setGlyphDataForCharacter):
+        (WebCore::GlyphPage::setGlyphDataForIndex):
+        (WebCore::GlyphPageTreeNode::getRootChild):
+        * platform/graphics/SegmentedFontData.cpp: Added.
+        (WebCore::SegmentedFontData::~SegmentedFontData):
+        (WebCore::SegmentedFontData::fontDataForCharacter):
+        (WebCore::SegmentedFontData::containsCharacters):
+        (WebCore::SegmentedFontData::isCustomFont):
+        (WebCore::SegmentedFontData::isLoading):
+        (WebCore::SegmentedFontData::isSegmented):
+        * platform/graphics/SegmentedFontData.h: Added.
+        (WebCore::FontDataRange::FontDataRange):
+        (WebCore::FontDataRange::from):
+        (WebCore::FontDataRange::to):
+        (WebCore::FontDataRange::fontData):
+        (WebCore::SegmentedFontData::appendRange):
+        (WebCore::SegmentedFontData::numRanges):
+        (WebCore::SegmentedFontData::rangeAt):
+        * platform/graphics/SimpleFontData.cpp: Copied from WebCore/platform/graphics/FontData.cpp.
+        (WebCore::SimpleFontData::SimpleFontData):
+        (WebCore::SimpleFontData::~SimpleFontData):
+        (WebCore::SimpleFontData::ascent):
+        (WebCore::SimpleFontData::descent):
+        (WebCore::SimpleFontData::widthForGlyph):
+        (WebCore::SimpleFontData::fontDataForCharacter):
+        (WebCore::SimpleFontData::isSegmented):
+        * platform/graphics/SimpleFontData.h: Copied from WebCore/platform/graphics/FontData.h.
+        (WebCore::SimpleFontData::isCustomFont):
+        (WebCore::SimpleFontData::isLoading):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::setPlatformFont):
+        * platform/graphics/gtk/FontCacheGtk.cpp:
+        (WebCore::FontCache::getFontDataForCharacters):
+        * platform/graphics/gtk/FontDataGtk.cpp: Renamed to
+        SimpleFontDataGtk.cpp.
+        * platform/graphics/gtk/FontGtk.cpp:
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/gtk/SimpleFontDataGtk.cpp: Copied from WebCore/platform/graphics/gtk/FontDataGtk.cpp.
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::platformDestroy):
+        (WebCore::SimpleFontData::smallCapsFontData):
+        (WebCore::SimpleFontData::containsCharacters):
+        (WebCore::SimpleFontData::determinePitch):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        (WebCore::SimpleFontData::setFont):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::getFontDataForCharacters):
+        * platform/graphics/mac/FontDataMac.mm: Renamed to SimpleFontDataMac.mm.
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::initializeATSUStyle):
+        (WebCore::overrideLayoutOperation):
+        (WebCore::ATSULayoutParameters::initialize):
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/mac/SimpleFontDataMac.mm: Copied from WebCore/platform/graphics/mac/FontDataMac.mm.
+        (WebCore::initFontData):
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::platformDestroy):
+        (WebCore::SimpleFontData::smallCapsFontData):
+        (WebCore::SimpleFontData::containsCharacters):
+        (WebCore::SimpleFontData::determinePitch):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        (WebCore::SimpleFontData::checkShapesArabic):
+        * platform/graphics/qt/FontDataQt.cpp: Renamed to SimpleFontDataQt.cpp.
+        * platform/graphics/qt/GlyphPageTreeNodeQt.cpp:
+        (WebCore::GlyphPageTreeNode::pruneTreeCustomFontData):
+        * platform/graphics/qt/SimpleFontDataQt.cpp: Copied from WebCore/platform/graphics/qt/FontDataQt.cpp.
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::FontCache::getFontDataForCharacters):
+        * platform/graphics/win/FontDataWin.cpp: Renamed to
+        SimpleFontDataWin.cpp.
+        * platform/graphics/win/FontWin.cpp:
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/win/GlyphPageTreeNodeWin.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/win/SimpleFontDataWin.cpp: Copied from WebCore/platform/graphics/win/FontDataWin.cpp.
+        (WebCore::SimpleFontData::setShouldApplyMacAscentHack):
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::platformDestroy):
+        (WebCore::SimpleFontData::smallCapsFontData):
+        (WebCore::SimpleFontData::containsCharacters):
+        (WebCore::SimpleFontData::determinePitch):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        (WebCore::SimpleFontData::scriptFontProperties):
+        * platform/graphics/wx/FontCacheWx.cpp:
+        (WebCore::FontCache::getFontDataForCharacters):
+        * platform/graphics/wx/FontDataWx.cpp: Renamed to SimpleFontDataWx.cpp.
+        * platform/graphics/wx/FontWx.cpp:
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/wx/GlyphMapWx.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/wx/SimpleFontDataWx.cpp: Copied from WebCore/platform/graphics/wx/FontDataWx.cpp.
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::platformDestroy):
+        (WebCore::SimpleFontData::smallCapsFontData):
+        (WebCore::SimpleFontData::containsCharacters):
+        (WebCore::SimpleFontData::determinePitch):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        * platform/mac/FileChooserMac.mm:
+        * platform/mac/PopupMenuMac.mm:
+        * platform/mac/WebCoreTextRenderer.mm:
+        * platform/win/PopupMenuWin.cpp:
+        * platform/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::advance):
+        (WebCore::UniscribeController::itemizeShapeAndPlace):
+        (WebCore::UniscribeController::shapeAndPlaceItem):
+        (WebCore::UniscribeController::shape):
+        * platform/win/UniscribeController.h:
+        * svg/SVGFont.cpp:
+        (WebCore::Font::drawGlyphsWithSVGFont):
+        * svg/SVGFontElement.cpp:
+        (WebCore::SVGFontElement::collectGlyphs):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::createFontData):
+        * svg/SVGFontFaceElement.h:
+        * svg/SVGGlyphElement.cpp:
+
 2008-01-07  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Not reviewed. Try to fix mac build by forcing SVGNames regeneration.
index 2e584f6121fbed8d2970b483cdf1fe77eddc851f..9af049a07ad3fd950b8fe3112dbd3f9db4244755 100644 (file)
@@ -522,12 +522,14 @@ webcore_sources += \
        WebCore/css/CSSRule.cpp \
        WebCore/css/CSSRuleList.cpp \
        WebCore/css/CSSSelector.cpp \
+       WebCore/css/CSSSegmentedFontFace.cpp \
        WebCore/css/CSSStyleDeclaration.cpp \
        WebCore/css/CSSStyleRule.cpp \
        WebCore/css/CSSStyleSelector.cpp \
        WebCore/css/CSSStyleSheet.cpp \
        WebCore/css/CSSTimingFunctionValue.cpp \
        WebCore/css/CSSTransformValue.cpp \
+       WebCore/css/CSSUnicodeRangeValue.cpp \
        WebCore/css/CSSValueList.cpp \
        WebCore/css/FontFamilyValue.cpp \
        WebCore/css/FontValue.cpp \
@@ -911,8 +913,10 @@ webkitgtk_sources += \
        WebCore/platform/graphics/GlyphWidthMap.cpp \
        WebCore/platform/graphics/FontCache.cpp \
        WebCore/platform/graphics/Font.cpp \
-       WebCore/platform/graphics/FontData.cpp \
+       WebCore/platform/graphics/FontDataBaseClass.cpp \
        WebCore/platform/graphics/FontFallbackList.cpp \
+       WebCore/platform/graphics/SegmentedFontData.cpp \
+       WebCore/platform/graphics/SimpleFontData.cpp \
        WebCore/platform/graphics/StringTruncator.cpp \
        WebCore/platform/text/TextCodecICU.cpp \
        WebCore/platform/text/TextBoundariesICU.cpp \
@@ -930,10 +934,10 @@ webkitgtk_sources += \
        WebCore/platform/gtk/FileChooserGtk.cpp \
        WebCore/platform/gtk/FileSystemGtk.cpp \
        WebCore/platform/graphics/gtk/FontCacheGtk.cpp \
-       WebCore/platform/graphics/gtk/FontDataGtk.cpp \
        WebCore/platform/graphics/gtk/FontGtk.cpp \
        WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp \
        WebCore/platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp \
+       WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp \
        WebCore/platform/gtk/KeyEventGtk.cpp \
        WebCore/platform/gtk/Language.cpp \
        WebCore/platform/gtk/LocalizedStringsGtk.cpp \
index 709b3d8bbde4959044b29306ca468e03caf79359..c98c31dab0b7e4482f4f1362aaea91fdbae3ce95 100644 (file)
@@ -451,12 +451,14 @@ SOURCES += \
     css/CSSRule.cpp \
     css/CSSRuleList.cpp \
     css/CSSSelector.cpp \
+    css/CSSSegmentedFontFace.cpp \
     css/CSSStyleDeclaration.cpp \
     css/CSSStyleRule.cpp \
     css/CSSStyleSelector.cpp \
     css/CSSStyleSheet.cpp \
     css/CSSTimingFunctionValue.cpp \
     css/CSSTransformValue.cpp \
+    css/CSSUnicodeRangeValue.cpp \
     css/CSSValueList.cpp \
     css/FontFamilyValue.cpp \
     css/FontValue.cpp \
@@ -860,8 +862,10 @@ gtk-port {
     platform/graphics/GlyphWidthMap.cpp \
     platform/graphics/FontCache.cpp \
     platform/graphics/Font.cpp \
-    platform/graphics/FontData.cpp \
-    platform/graphics/FontFallbackList.cpp 
+    platform/graphics/FontDataBaseClass.cpp \
+    platform/graphics/FontFallbackList.cpp \
+    platform/graphics/SegmentedFontData.cpp \
+    platfomr/graphics/SimpleFontData.cpp 
 }
 
 qt-port {
@@ -916,9 +920,9 @@ qt-port {
     platform/qt/FileSystemQt.cpp \
     platform/graphics/qt/FontCacheQt.cpp \
     platform/graphics/qt/FontCustomPlatformData.cpp \
-    platform/graphics/qt/FontDataQt.cpp \
     platform/graphics/qt/FontQt.cpp \
     platform/graphics/qt/GlyphPageTreeNodeQt.cpp \
+    platform/graphics/qt/SimpleFontDataQt.cpp \
     platform/qt/Localizations.cpp \
     platform/qt/MIMETypeRegistryQt.cpp \
     platform/qt/PasteboardQt.cpp \
@@ -1001,10 +1005,10 @@ gtk-port {
         platform/gtk/FileChooserGtk.cpp \
         platform/gtk/FileSystemGtk.cpp \
         platform/graphics/gtk/FontCacheGtk.cpp \
-        platform/graphics/gtk/FontDataGtk.cpp \
         platform/graphics/gtk/FontGtk.cpp \
         platform/graphics/gtk/FontPlatformDataGtk.cpp \
         platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp \
+        platform/graphics/gtk/SimpleFontDataGtk.cpp \
         platform/gtk/KeyEventGtk.cpp \
         platform/gtk/Language.cpp \
         platform/gtk/LocalizedStringsGtk.cpp \
index 3737dc3d51eff64525e8b52c6edbef355bfe9970..9802580cd91bcb1f78dbdd8d66b52b7b021074d1 100644 (file)
                                RelativePath="..\platform\graphics\FontCache.h"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\platform\graphics\FontData.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\platform\graphics\FontData.h"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\platform\graphics\FontDescription.h"\r
                                >\r
                                        RelativePath="..\platform\graphics\FloatSize.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\FontDataBaseClass.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\FontDataBaseClass.h"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\platform\graphics\GraphicsContext.cpp"\r
                                        >\r
                                        RelativePath="..\platform\graphics\Pen.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\SegmentedFontData.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\SegmentedFontData.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\SimpleFontData.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\platform\graphics\SimpleFontData.h"\r
+                                       >\r
+                               </File>\r
                                <Filter\r
                                        Name="win"\r
                                        >\r
                                                RelativePath="..\platform\graphics\win\FontDatabase.h"\r
                                                >\r
                                        </File>\r
-                                       <File\r
-                                               RelativePath="..\platform\graphics\win\FontDataWin.cpp"\r
-                                               >\r
-                                       </File>\r
                                        <File\r
                                                RelativePath="..\platform\graphics\win\FontPlatformData.h"\r
                                                >\r
                                                RelativePath="..\platform\graphics\win\MediaPlayerPrivateQuickTimeWin.h"\r
                                                >\r
                                        </File>\r
+                                       <File\r
+                                               RelativePath="..\platform\graphics\win\SimpleFontDataWin.cpp"\r
+                                               >\r
+                                       </File>\r
                                </Filter>\r
                                <Filter\r
                                        Name="cg"\r
                                RelativePath="..\css\CSSSelector.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\css\CSSSegmentedFontFace.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\css\CSSSegmentedFontFace.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\css\CSSStyleDeclaration.cpp"\r
                                >\r
                                RelativePath="..\css\CSSTransformValue.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\css\CSSUnicodeRangeValue.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\css\CSSUnicodeRangeValue.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\css\CSSUnknownRule.h"\r
                                >\r
index 8497d0bab004295149c7eea27b17273206a780b7..e21c5ebfe53fd6d4232ff56dd4072456f4245019 100644 (file)
                1CFCEEFA0AACC7A700348750 /* DOMHTMLInputElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEEF90AACC79000348750 /* DOMHTMLInputElementPrivate.h */; };
                2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
                2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; };
+               371F4F400D25B9AF00ECE0D5 /* FontDataBaseClass.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontDataBaseClass.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               371F4F410D25B9AF00ECE0D5 /* FontDataBaseClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontDataBaseClass.cpp */; };
+               371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; };
+               371F4FFD0D25E7F300ECE0D5 /* SegmentedFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */; };
+               371F51A10D262FA000ECE0D5 /* CSSSegmentedFontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F519F0D262FA000ECE0D5 /* CSSSegmentedFontFace.h */; };
+               371F51A20D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F51A00D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp */; };
+               371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */; };
+               371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */; };
                37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
                37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; };
                441B05560CD779B6007C1F18 /* DOMCSSStyleSheetPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 4429AAEA0CB84DC7007647C5 /* DOMCSSStyleSheetPrivate.h */; };
                B2AFFC7C0D00A5C10030074D /* FontCacheMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC740D00A5C10030074D /* FontCacheMac.mm */; };
                B2AFFC7D0D00A5C10030074D /* FontCustomPlatformData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */; };
                B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */; };
-               B2AFFC7F0D00A5C10030074D /* FontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC770D00A5C10030074D /* FontDataMac.mm */; };
+               B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */; };
                B2AFFC800D00A5C10030074D /* FontMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC780D00A5C10030074D /* FontMac.mm */; };
                B2AFFC810D00A5C10030074D /* FontPlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AFFC790D00A5C10030074D /* FontPlatformData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2AFFC820D00A5C10030074D /* FontPlatformDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC7A0D00A5C10030074D /* FontPlatformDataMac.mm */; };
                B2C3DA610D006CD600EF6F26 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA500D006CD600EF6F26 /* Font.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA510D006CD600EF6F26 /* FontCache.cpp */; };
                B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA520D006CD600EF6F26 /* FontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               B2C3DA640D006CD600EF6F26 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* FontData.cpp */; };
-               B2C3DA650D006CD600EF6F26 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };
+               B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2C3DA670D006CD600EF6F26 /* FontFallbackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontFallbackList.cpp */; };
                B2C3DA680D006CD600EF6F26 /* FontFallbackList.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA570D006CD600EF6F26 /* FontFallbackList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D9066050BE141D400956998 /* LayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
                2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                2D90660C0665D937006B6F1A /* ClipboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               371F4F3E0D25B9AF00ECE0D5 /* FontDataBaseClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontDataBaseClass.h; sourceTree = "<group>"; };
+               371F4F3F0D25B9AF00ECE0D5 /* FontDataBaseClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDataBaseClass.cpp; sourceTree = "<group>"; };
+               371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; };
+               371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentedFontData.cpp; sourceTree = "<group>"; };
+               371F519F0D262FA000ECE0D5 /* CSSSegmentedFontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSegmentedFontFace.h; sourceTree = "<group>"; };
+               371F51A00D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSSegmentedFontFace.cpp; sourceTree = "<group>"; };
+               371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSUnicodeRangeValue.h; sourceTree = "<group>"; };
+               371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnicodeRangeValue.cpp; sourceTree = "<group>"; };
                37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
                37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; };
                441244D80CB853ED008F0C79 /* JSHTMLInputElementBaseTable.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = JSHTMLInputElementBaseTable.cpp; sourceTree = "<group>"; };
                B2AFFC740D00A5C10030074D /* FontCacheMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontCacheMac.mm; sourceTree = "<group>"; };
                B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCustomPlatformData.cpp; sourceTree = "<group>"; };
                B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCustomPlatformData.h; sourceTree = "<group>"; };
-               B2AFFC770D00A5C10030074D /* FontDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontDataMac.mm; sourceTree = "<group>"; };
+               B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleFontDataMac.mm; sourceTree = "<group>"; };
                B2AFFC780D00A5C10030074D /* FontMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontMac.mm; sourceTree = "<group>"; };
                B2AFFC790D00A5C10030074D /* FontPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontPlatformData.h; sourceTree = "<group>"; };
                B2AFFC7A0D00A5C10030074D /* FontPlatformDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontPlatformDataMac.mm; sourceTree = "<group>"; };
                B2C3DA500D006CD600EF6F26 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; };
                B2C3DA510D006CD600EF6F26 /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; };
                B2C3DA520D006CD600EF6F26 /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCache.h; sourceTree = "<group>"; };
-               B2C3DA530D006CD600EF6F26 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; };
-               B2C3DA540D006CD600EF6F26 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; };
+               B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };
+               B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SimpleFontData.h; sourceTree = "<group>"; };
                B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; };
                B2C3DA560D006CD600EF6F26 /* FontFallbackList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontFallbackList.cpp; sourceTree = "<group>"; };
                B2C3DA570D006CD600EF6F26 /* FontFallbackList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontFallbackList.h; sourceTree = "<group>"; };
                                B2AFFC740D00A5C10030074D /* FontCacheMac.mm */,
                                B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */,
                                B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */,
-                               B2AFFC770D00A5C10030074D /* FontDataMac.mm */,
                                B2AFFC780D00A5C10030074D /* FontMac.mm */,
                                B2AFFC790D00A5C10030074D /* FontPlatformData.h */,
                                B2AFFC7A0D00A5C10030074D /* FontPlatformDataMac.mm */,
                                B27535510B053814002CE64F /* IntSizeMac.mm */,
                                E4B41E100CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.h */,
                                E4B41E110CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.mm */,
+                               B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                B2C3DA500D006CD600EF6F26 /* Font.h */,
                                B2C3DA510D006CD600EF6F26 /* FontCache.cpp */,
                                B2C3DA520D006CD600EF6F26 /* FontCache.h */,
-                               B2C3DA530D006CD600EF6F26 /* FontData.cpp */,
-                               B2C3DA540D006CD600EF6F26 /* FontData.h */,
+                               B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
+                               B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
+                               371F4F3F0D25B9AF00ECE0D5 /* FontDataBaseClass.cpp */,
+                               371F4F3E0D25B9AF00ECE0D5 /* FontDataBaseClass.h */,
                                B2C3DA550D006CD600EF6F26 /* FontDescription.h */,
                                B2C3DA560D006CD600EF6F26 /* FontFallbackList.cpp */,
                                B2C3DA570D006CD600EF6F26 /* FontFallbackList.h */,
                                A88DD4860B4629A300C02990 /* PathTraversalState.h */,
                                B27535540B053814002CE64F /* Pen.cpp */,
                                B27535550B053814002CE64F /* Pen.h */,
+                               371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */,
+                               371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */,
                        );
                        path = graphics;
                        sourceTree = "<group>";
                                A8D0651B0A23C1FE005E7203 /* CSSRuleList.idl */,
                                A80E73480A199C77007FB8C5 /* CSSSelector.cpp */,
                                A80E734B0A199C77007FB8C5 /* CSSSelector.h */,
+                               371F51A00D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp */,
+                               371F519F0D262FA000ECE0D5 /* CSSSegmentedFontFace.h */,
                                A80E6E0E0A19911C007FB8C5 /* CSSStyleDeclaration.cpp */,
                                A80E6E0D0A19911C007FB8C5 /* CSSStyleDeclaration.h */,
                                142011AE0A003117008303F9 /* CSSStyleDeclaration.idl */,
                                BC80C9860CD294EE00A0B7B3 /* CSSTimingFunctionValue.h */,
                                BC9ADD7F0CC4092200098C4C /* CSSTransformValue.cpp */,
                                BC9ADD220CC4032600098C4C /* CSSTransformValue.h */,
+                               371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */,
+                               371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */,
                                A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */,
                                85C56CAD0AA89FE000D95755 /* CSSUnknownRule.idl */,
                                A80E6CC40A1989CA007FB8C5 /* CSSValue.h */,
                                B2C3DA610D006CD600EF6F26 /* Font.h in Headers */,
                                B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */,
                                B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */,
-                               B2C3DA650D006CD600EF6F26 /* FontData.h in Headers */,
+                               B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
                                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */,
                                B2C3DA680D006CD600EF6F26 /* FontFallbackList.h in Headers */,
                                B2C3DA6A0D006CD600EF6F26 /* FontFamily.h in Headers */,
                                BC60DA3A0D2A302800B9918F /* JSXMLHttpRequestException.h in Headers */,
                                BC60DA5B0D2A31F700B9918F /* XPathException.h in Headers */,
                                BC60DB4A0D2A3D1E00B9918F /* JSXPathException.h in Headers */,
+                               371F4F400D25B9AF00ECE0D5 /* FontDataBaseClass.h in Headers */,
+                               371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */,
+                               371F51A10D262FA000ECE0D5 /* CSSSegmentedFontFace.h in Headers */,
+                               371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */,
                                B2AFFC7C0D00A5C10030074D /* FontCacheMac.mm in Sources */,
                                B2AFFC7D0D00A5C10030074D /* FontCustomPlatformData.cpp in Sources */,
-                               B2C3DA640D006CD600EF6F26 /* FontData.cpp in Sources */,
-                               B2AFFC7F0D00A5C10030074D /* FontDataMac.mm in Sources */,
+                               B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,
+                               B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */,
                                B2C3DA670D006CD600EF6F26 /* FontFallbackList.cpp in Sources */,
                                B2C3DA690D006CD600EF6F26 /* FontFamily.cpp in Sources */,
                                A80E6CEC0A1989CA007FB8C5 /* FontFamilyValue.cpp in Sources */,
                                BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */,
                                BC60DA390D2A302800B9918F /* JSXMLHttpRequestException.cpp in Sources */,
                                BC60DB490D2A3D1E00B9918F /* JSXPathException.cpp in Sources */,
+                               371F4F410D25B9AF00ECE0D5 /* FontDataBaseClass.cpp in Sources */,
+                               371F4FFD0D25E7F300ECE0D5 /* SegmentedFontData.cpp in Sources */,
+                               371F51A20D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp in Sources */,
+                               371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 23c4c2347dba425ae3ea09097ec504cc835925d5..09fbb572afaabf0ea6609e4c13855654109fd90a 100644 (file)
@@ -120,12 +120,14 @@ This file contains the list of files needed to build WebCore.
         css/CSSRule.cpp
         css/CSSRuleList.cpp
         css/CSSSelector.cpp
+        css/CSSSegmentedFontFace.cpp
         css/CSSStyleDeclaration.cpp
         css/CSSStyleRule.cpp
         css/CSSStyleSelector.cpp
         css/CSSStyleSheet.cpp
         css/CSSTransformValue.cpp
         css/CSSTimingFunctionValue.cpp
+        css/CSSUnicodeRangeValue.cpp
         css/CSSValueList.cpp
         css/FontFamilyValue.cpp
         css/FontValue.cpp
@@ -569,11 +571,13 @@ This file contains the list of files needed to build WebCore.
         platform/FileChooser.cpp
         platform/graphics/Font.cpp
         platform/graphics/FontCache.cpp
-        platform/graphics/FontData.cpp
+        platform/graphics/FontDataBaseClass.cpp
         platform/graphics/FontFallbackList.cpp
         platform/graphics/FontFamily.cpp
         platform/graphics/GlyphPageTreeNode.cpp
         platform/graphics/GlyphWidthMap.cpp
+        platform/graphics/SegmentedFontData.cpp
+        platform/graphics/SimpleFontData.cpp
         platform/KURL.cpp
         platform/Logging.cpp
         platform/MIMETypeRegistry.cpp
index 48a7bfd536e57dc26b33e692bd3a9d9572e4614e..93deb23e982e0210e7357ba7c688f6052f181fcd 100644 (file)
@@ -43,7 +43,6 @@
 #import "EventListener.h"
 #import "EventTarget.h"
 #import "ExceptionHandlers.h"
-#import "FontData.h"
 #import "FoundationExtras.h"
 #import "Frame.h"
 #import "FrameView.h"
@@ -61,6 +60,7 @@
 #import "Range.h"
 #import "RenderImage.h"
 #import "RenderView.h"
+#import "SimpleFontData.h"
 #import "Text.h"
 #import "TreeWalker.h"
 #import "WebScriptObjectPrivate.h"
index 478e8ffe8a14909c86471532710cb09002a779ed..bc5efda132058ee679632eb71c0337fbb2cfaf43 100644 (file)
@@ -31,7 +31,6 @@
 #import "Document.h"
 #import "EventNames.h"
 #import "FocusController.h"
-#import "FontData.h"
 #import "Frame.h"
 #import "FrameLoader.h"
 #import "FrameView.h"
@@ -58,6 +57,7 @@
 #import "RenderView.h"
 #import "RenderWidget.h"
 #import "SelectionController.h"
+#import "SimpleFontData.h"
 #import "TextIterator.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreFrameView.h"
index 9cfa01060a2d46b32369373e713218ccd605d31e..3670e2b2b56d48626f1f72003a98959f9b248aa0 100644 (file)
@@ -893,6 +893,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
         case CSS_PROP_TEXT_UNDERLINE_MODE:
         case CSS_PROP_TEXT_UNDERLINE_STYLE:
         case CSS_PROP_TEXT_UNDERLINE_WIDTH:
+        case CSS_PROP_UNICODE_RANGE: // Only used in @font-face rules.
         case CSS_PROP__WEBKIT_BORDER_IMAGE:
         case CSS_PROP__WEBKIT_BORDER_RADIUS:
         case CSS_PROP__WEBKIT_COLUMNS:
index a53dbbf2e36ec707cbc3943182952ecbdae07d18..1be6facf7572bc4ab59a4e01bf68f45037b25f4f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "CSSFontFace.h"
 
 #include "CSSFontFaceSource.h"
-#include "CSSFontSelector.h"
-#include "FontData.h"
+#include "CSSSegmentedFontFace.h"
 #include "FontDescription.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
-CSSFontFace::CSSFontFace(CSSFontSelector* selector)
-: m_fontSelector(selector)
-{
-}
-
 CSSFontFace::~CSSFontFace()
 {
     deleteAllValues(m_sources);
@@ -74,19 +69,19 @@ void CSSFontFace::addSource(CSSFontFaceSource* source)
 void CSSFontFace::fontLoaded(CSSFontFaceSource*)
 {
     if (isLoaded())
-        return m_fontSelector->fontLoaded(this);
+        return m_segmentedFontFace->fontLoaded(this);
 }
 
-FontData* CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
+SimpleFontData* CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
 {
     if (!isValid())
         return 0;
         
     // If we hit a local font, we know it is valid, and can just return it.
-    FontData* result = 0;
+    SimpleFontData* result = 0;
     unsigned size = m_sources.size();
     for (unsigned i = 0; i < size && !result; i++)
-        result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, m_fontSelector);
+        result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, m_segmentedFontFace->fontSelector());
     return result;
 }
 
index de4e99205d73879c1dde208960dc8ab5360c6027..ef281e3212ba1fdc55666eb55590fc44b7abc6c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #ifndef CSSFontFace_h
 #define CSSFontFace_h
 
-#include <wtf/Vector.h>
 #include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
 class CSSFontFaceSource;
-class CSSFontSelector;
-class FontData;
+class CSSSegmentedFontFace;
 class FontDescription;
+class SimpleFontData;
 
 class CSSFontFace : public RefCounted<CSSFontFace> {
 public:
-    CSSFontFace(CSSFontSelector*);
+    CSSFontFace()
+        : m_segmentedFontFace(0)
+    {
+    }
+
     virtual ~CSSFontFace();
 
+    void setSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace) { m_segmentedFontFace = segmentedFontFace; }
+
     bool isLoaded() const;
     virtual bool isValid() const;
 
@@ -48,11 +54,11 @@ public:
 
     void fontLoaded(CSSFontFaceSource*);
 
-    virtual FontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
+    virtual SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
 
 private:
+    CSSSegmentedFontFace* m_segmentedFontFace;
     Vector<CSSFontFaceSource*> m_sources;
-    CSSFontSelector* m_fontSelector;
 };
 
 }
index b97fd52a0576ef6cffa9fa7fac9d6722dec4d150..cc255454e3fe640ec630f681b5bb8d20d075ba79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
 #include "CSSFontSelector.h"
 #include "DocLoader.h"
 #include "FontCache.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 #include "FontDescription.h"
 #include "GlyphPageTreeNode.h"
 
@@ -55,12 +55,8 @@ CSSFontFaceSource::~CSSFontFaceSource()
 
 void CSSFontFaceSource::pruneTable()
 {
-    // Make sure the glyph page tree prunes out all uses of these custom fonts.
     if (m_fontDataTable.isEmpty())
         return;
-    HashMap<int, FontData*>::iterator end = m_fontDataTable.end();
-    for (HashMap<int, FontData*>::iterator it = m_fontDataTable.begin(); it != end; ++it)
-        GlyphPageTreeNode::pruneTreeCustomFontData(it->second);
     deleteAllValues(m_fontDataTable);
     m_fontDataTable.clear();
 }
@@ -86,18 +82,18 @@ void CSSFontFaceSource::fontLoaded(CachedFont*)
         m_face->fontLoaded(this);
 }
 
-FontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
+SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
 {
     // If the font hasn't loaded or an error occurred, then we've got nothing.
     if (!isValid())
         return 0;
 
     if (!m_font)
-        // We're local.  Just return a FontData from the normal cache.
+        // We're local.  Just return a SimpleFontData from the normal cache.
         return FontCache::getCachedFontData(FontCache::getCachedFontPlatformData(fontDescription, m_string));
     
     // See if we have a mapping in our FontData cache.
-    FontData* cachedData = m_fontDataTable.get(fontDescription.computedPixelSize());
+    SimpleFontData* cachedData = m_fontDataTable.get(fontDescription.computedPixelSize());
     if (cachedData)
         return cachedData;
     
@@ -106,7 +102,7 @@ FontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription,
         // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef.
         if (!m_font->ensureCustomFontData())
             return 0;
-        cachedData = new FontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic), true, false);
+        cachedData = new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic), true, false);
     } else {
         // Kick off the load now.
         m_font->beginLoadIfNeeded(fontSelector->docLoader());
@@ -114,7 +110,7 @@ FontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescription,
         FontPlatformData* tempData = FontCache::getCachedFontPlatformData(fontDescription, m_string);
         if (!tempData)
             tempData = FontCache::getLastResortFallbackFont(fontDescription);
-        cachedData = new FontData(*tempData, true, true);
+        cachedData = new SimpleFontData(*tempData, true, true);
     }
 
     m_fontDataTable.set(fontDescription.computedPixelSize(), cachedData);
index 7d01539bd83eae0fd06a1eaa8ba9451a9bc21a2f..e059ca9bdf1c5da9a8c29519b2033e6ba4ba46e1 100644 (file)
@@ -35,8 +35,8 @@ namespace WebCore {
 class CachedFont;
 class CSSFontFace;
 class CSSFontSelector;
-class FontData;
 class FontDescription;
+class SimpleFontData;
 
 class CSSFontFaceSource : public CachedResourceClient {
 public:
@@ -52,7 +52,7 @@ public:
 
     virtual void fontLoaded(CachedFont*);
     
-    FontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
+    SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
     
     void pruneTable();
 
@@ -60,7 +60,7 @@ private:
     AtomicString m_string; // URI for remote, built-in font name for local.
     CachedFont* m_font; // For remote fonts, a pointer to our cached resource.
     CSSFontFace* m_face; // Our owning font face.
-    HashMap<int, FontData*> m_fontDataTable; // A cache of FontDatas for various pixel sizes.
+    HashMap<int, SimpleFontData*> m_fontDataTable; // A cache of FontDatas for various pixel sizes.
 };
 
 }
index 2371dc42724c6a0ade298d7f17159f003f96381c..1b441973d9feabc89b33b9965b4540ef2279fafc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  *           (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,8 @@
 #include "CSSMutableStyleDeclaration.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPropertyNames.h"
+#include "CSSSegmentedFontFace.h"
+#include "CSSUnicodeRangeValue.h"
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
 #include "DocLoader.h"
 #include "Frame.h"
 #include "NodeList.h"
 #include "RenderObject.h"
-#include "Settings.h"
 #include "SVGCSSFontFace.h"
 #include "SVGFontFaceElement.h"
 #include "SVGNames.h"
+#include "Settings.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -86,8 +89,9 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
     // Obtain the font-family property and the src property.  Both must be defined.
     const CSSMutableStyleDeclaration* style = fontFaceRule->style();
     RefPtr<CSSValue> fontFamily = style->getPropertyCSSValue(CSS_PROP_FONT_FAMILY);
-    RefPtr<CSSValue> src = style->getPropertyCSSValue(CSS_PROP_SRC);    
-    if (!fontFamily || !src || !fontFamily->isValueList() || !src->isValueList())
+    RefPtr<CSSValue> src = style->getPropertyCSSValue(CSS_PROP_SRC);
+    RefPtr<CSSValue> unicodeRange = style->getPropertyCSSValue(CSS_PROP_UNICODE_RANGE);
+    if (!fontFamily || !src || !fontFamily->isValueList() || !src->isValueList() || unicodeRange && !unicodeRange->isValueList())
         return;
 
     CSSValueList* familyList = static_cast<CSSValueList*>(fontFamily.get());
@@ -98,6 +102,8 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
     if (!srcList->length())
         return;
 
+    CSSValueList* rangeList = static_cast<CSSValueList*>(unicodeRange.get());
+
     // Create a FontDescription for this font and set up bold/italic info properly.
     FontDescription fontDescription;
 
@@ -172,7 +178,7 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
                 fontFace = new SVGCSSFontFace(this, svgFontFaceElement);
             else
 #endif
-                fontFace = new CSSFontFace(this);
+                fontFace = new CSSFontFace();
         }
 
         if (source)
@@ -231,12 +237,24 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
         if (svgFontFaceElement && fontDescription.smallCaps())
             familyName += "-webkit-svg-small-caps";
 #endif
-
-        m_fonts.set(hashForFont(familyName.lower(), fontDescription.bold(), fontDescription.italic()), fontFace);
+        String hash = hashForFont(familyName.lower(), fontDescription.bold(), fontDescription.italic());
+        CSSSegmentedFontFace* segmentedFontFace = m_fonts.get(hash).get();
+        if (!segmentedFontFace) {
+            segmentedFontFace = new CSSSegmentedFontFace(this);
+            m_fonts.set(hash, segmentedFontFace);
+        }
+        if (rangeList) {
+            unsigned numRanges = rangeList->length();
+            for (unsigned i = 0; i < numRanges; i++) {
+                CSSUnicodeRangeValue* range = static_cast<CSSUnicodeRangeValue*>(rangeList->item(i));
+                segmentedFontFace->overlayRange(range->from(), range->to(), fontFace);
+            }
+        } else
+            segmentedFontFace->overlayRange(0, 0x7FFFFFFF, fontFace);
     }
 }
 
-void CSSFontSelector::fontLoaded(CSSFontFace*)
+void CSSFontSelector::fontLoaded(CSSSegmentedFontFace*)
 {
     if (m_document->inPageCache())
         return;
@@ -266,7 +284,7 @@ FontData* CSSFontSelector::getFontData(const FontDescription& fontDescription, c
     } else
         face = m_fonts.get(hashForFont(family, bold, italic));
 #else
-    RefPtr<CSSFontFace> face = m_fonts.get(hashForFont(family, bold, italic));
+    RefPtr<CSSSegmentedFontFace> face = m_fonts.get(hashForFont(family, bold, italic));
 #endif
 
     // If we don't find a face, and if bold/italic are set, we should try other variants.
index 2a84f4a6eba3288ec6999a2c2d76612bd29c461a..51de2f2668685a410405968a94a283f20634fc43 100644 (file)
@@ -35,8 +35,8 @@
 namespace WebCore {
 
 class AtomicString;
-class CSSFontFace;
 class CSSFontFaceRule;
+class CSSSegmentedFontFace;
 class Document;
 class DocLoader;
 class FontDescription;
@@ -51,7 +51,7 @@ public:
     
     void addFontFaceRule(const CSSFontFaceRule*);
 
-    void fontLoaded(CSSFontFace*);
+    void fontLoaded(CSSSegmentedFontFace*);
 
     bool isEmpty() const;
 
@@ -59,7 +59,7 @@ public:
 
 protected:
     Document* m_document; // No need to ref, since we will always get destroyed before the document does.
-    HashMap<String, RefPtr<CSSFontFace> > m_fonts;
+    HashMap<String, RefPtr<CSSSegmentedFontFace> > m_fonts;
 };
 
 } // namespace WebCore
index 0f428e13ec31a7c485c7c334c4dcecef23f64947..2d8b070bcce6226601ba08486814ef0783f82c0d 100644 (file)
@@ -1056,7 +1056,7 @@ term:
   | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION }
   | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION }
   | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_URI; }
-  | UNICODERANGE maybe_space { $$.id = 0; $$.iValue = 0; $$.unit = CSSPrimitiveValue::CSS_UNKNOWN;/* ### */ }
+  | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE }
   | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_RGBCOLOR; }
   | '#' maybe_space { $$.id = 0; $$.string = ParseString(); $$.unit = CSSPrimitiveValue::CSS_RGBCOLOR; } /* Handle error case: "color: #;" */
 /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
index fc543a6a46e47ca55d9bee2a03576b41a0a9d8b7..490680247d7fdd166302dcb45fe42548afee2e44 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
  * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -44,6 +44,7 @@
 #include "CSSStyleRule.h"
 #include "CSSStyleSheet.h"
 #include "CSSTransformValue.h"
+#include "CSSUnicodeRangeValue.h"
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
 #include "Counter.h"
@@ -1071,6 +1072,9 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSS_PROP_SRC:  // Only used within @font-face, so cannot use inherit | initial or be !important.  This is a list of urls or local references.
         return parseFontFaceSrc();
 
+    case CSS_PROP_UNICODE_RANGE:
+        return parseFontFaceUnicodeRange();
+
     /* CSS3 properties */
     case CSS_PROP__WEBKIT_APPEARANCE:
         if ((id >= CSS_VAL_CHECKBOX && id <= CSS_VAL_TEXTAREA) || id == CSS_VAL_NONE)
@@ -2812,6 +2816,95 @@ bool CSSParser::parseFontFaceSrc()
     return false;
 }
 
+bool CSSParser::parseFontFaceUnicodeRange()
+{
+    CSSValueList* values = new CSSValueList();
+    Value* currentValue;
+    bool failed = false;
+    while ((currentValue = valueList->current())) {
+        if (valueList->current()->unit != CSSPrimitiveValue::CSS_UNICODE_RANGE) {
+            failed = true;
+            break;
+        }
+
+        String rangeString = domString(valueList->current()->string);
+        UChar32 from = 0;
+        UChar32 to = 0;
+        unsigned length = rangeString.length();
+
+        if (length < 3) {
+            failed = true;
+            break;
+        }
+
+        unsigned i = 2;
+        while (i < length) {
+            UChar c = rangeString[i];
+            if (c == '-' || c == '?')
+                break;
+            from *= 16;
+            if (c >= '0' && c <= '9')
+                from += c - '0';
+            else if (c >= 'A' && c <= 'F')
+                from += 10 + c - 'A';
+            else if (c >= 'a' && c <= 'f')
+                from += 10 + c - 'a';
+            else {
+                failed = true;
+                break;
+            }
+            i++;
+        }
+        if (failed)
+            break;
+
+        if (i == length)
+            to = from + 1;
+        else if (rangeString[i] == '?') {
+            unsigned span = 1;
+            while (i < length && rangeString[i] == '?') {
+                span *= 16;
+                from *= 16;
+                i++;
+            }
+            if (i < length)
+                failed = true;
+            to = from + span;
+        } else {
+            if (length < i + 2) {
+                failed = true;
+                break;
+            }
+            i++;
+            while (i < length) {
+                UChar c = rangeString[i];
+                to *= 16;
+                if (c >= '0' && c <= '9')
+                    to += c - '0';
+                else if (c >= 'A' && c <= 'F')
+                    to += 10 + c - 'A';
+                else if (c >= 'a' && c <= 'f')
+                    to += 10 + c - 'a';
+                else {
+                    failed = true;
+                    break;
+                }
+                i++;
+            }
+            if (failed)
+                break;
+        }
+        values->append(new CSSUnicodeRangeValue(from, to));
+        valueList->next();
+    }
+    if (failed || !values->length()) {
+        delete values;
+        return false;
+    }
+    addProperty(CSS_PROP_UNICODE_RANGE, values, important);
+    return true;
+}
+
 bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict)
 {
     if (!strict && Color::parseHexColor(name, rgb))
index 76c77c806323827741dcd0b6a2d9221ae91207c0..2e0f4de2d388418536cdcc51bf6425903c4c3f11 100644 (file)
@@ -173,6 +173,7 @@ namespace WebCore {
         static bool parseColor(const String&, RGBA32& rgb, bool strict);
 
         bool parseFontFaceSrc();
+        bool parseFontFaceUnicodeRange();
 
 #if ENABLE(SVG)
         bool parseSVGValue(int propId, bool important);
index ab74af389bcc32edf5c1a98fd8fbadb308156772..d81e7cf3e1fd1e5d697ead8c8f0cc3c4ad5b5513 100644 (file)
@@ -67,7 +67,8 @@ public:
         CSS_RECT = 24,
         CSS_RGBCOLOR = 25,
         CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
-        CSS_DASHBOARD_REGION = 101 // FIXME: What on earth is this doing as a primitive value? It should not be!
+        CSS_DASHBOARD_REGION = 101, // FIXME: What on earth is this doing as a primitive value? It should not be!
+        CSS_UNICODE_RANGE = 102
     };
 
     // FIXME: int vs. unsigned overloading is too tricky for color vs. ident
index f0a84e1b01c159640be2438474521139c9066b78..8ebfe84a5f2ca1827887142fad7093867fbe3709 100644 (file)
@@ -131,6 +131,7 @@ text-underline-style
 text-underline-width
 top
 unicode-bidi
+unicode-range
 vertical-align
 visibility
 white-space
diff --git a/WebCore/css/CSSSegmentedFontFace.cpp b/WebCore/css/CSSSegmentedFontFace.cpp
new file mode 100644 (file)
index 0000000..2705bff
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "CSSSegmentedFontFace.h"
+
+#include "CSSFontFace.h"
+#include "CSSFontSelector.h"
+#include "FontDescription.h"
+#include "SegmentedFontData.h"
+#include "SimpleFontData.h"
+
+namespace WebCore {
+
+CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector)
+    : m_fontSelector(fontSelector)
+{
+}
+
+CSSSegmentedFontFace::~CSSSegmentedFontFace()
+{
+    pruneTable();
+}
+
+void CSSSegmentedFontFace::pruneTable()
+{
+    // Make sure the glyph page tree prunes out all uses of this custom font.
+    if (m_fontDataTable.isEmpty())
+        return;
+    HashMap<unsigned, SegmentedFontData*>::iterator end = m_fontDataTable.end();
+    for (HashMap<unsigned, SegmentedFontData*>::iterator it = m_fontDataTable.begin(); it != end; ++it)
+        GlyphPageTreeNode::pruneTreeCustomFontData(it->second);
+    deleteAllValues(m_fontDataTable);
+    m_fontDataTable.clear();
+}
+
+bool CSSSegmentedFontFace::isLoaded() const
+{
+    unsigned size = m_ranges.size();
+    for (unsigned i = 0; i < size; i++) {
+        if (!m_ranges[i].fontFace()->isLoaded())
+            return false;
+    }
+    return true;
+}
+
+bool CSSSegmentedFontFace::isValid() const
+{
+    unsigned size = m_ranges.size();
+    for (unsigned i = 0; i < size; i++) {
+        if (!m_ranges[i].fontFace()->isValid())
+            return false;
+    }
+    return true;
+}
+
+void CSSSegmentedFontFace::fontLoaded(CSSFontFace*)
+{
+    pruneTable();
+    if (isLoaded())
+        return m_fontSelector->fontLoaded(this);
+}
+
+void CSSSegmentedFontFace::overlayRange(UChar32 from, UChar32 to, PassRefPtr<CSSFontFace> fontFace)
+{
+    pruneTable();
+    fontFace->setSegmentedFontFace(this);
+
+    unsigned size = m_ranges.size();
+    if (size) {
+        Vector<FontFaceRange, 8> oldRanges = m_ranges;
+        m_ranges.clear();
+        for (unsigned i = 0; i < size; i++) {
+            const FontFaceRange& range = oldRanges[i];
+            if (range.from() >= to || range.to() <= from)
+                m_ranges.append(range);
+            else if (range.from() < from) {
+                m_ranges.append(FontFaceRange(range.from(), from, range.fontFace()));
+                if (range.to() > to)
+                    m_ranges.append(FontFaceRange(to, range.to(), range.fontFace()));
+            } else if (range.to() > to)
+                m_ranges.append(FontFaceRange(to, range.to(), range.fontFace()));
+        }
+    }
+    m_ranges.append(FontFaceRange(from, to, fontFace));
+}
+
+FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
+{
+    if (!isValid())
+        return 0;
+
+    unsigned hashKey = fontDescription.computedPixelSize() << 2 | (syntheticBold ? 0 : 2) | (syntheticItalic ? 0 : 1);
+
+    SegmentedFontData* fontData = m_fontDataTable.get(hashKey);
+    if (fontData)
+        return fontData;
+
+    fontData = new SegmentedFontData();
+
+    unsigned size = m_ranges.size();
+    for (unsigned i = 0; i < size; i++) {
+        if (const FontData* rangeFontData = m_ranges[i].fontFace()->getFontData(fontDescription, syntheticBold, syntheticItalic)) {
+            ASSERT(!rangeFontData->isSegmented());
+            fontData->appendRange(FontDataRange(m_ranges[i].from(), m_ranges[i].to(), static_cast<const SimpleFontData*>(rangeFontData)));
+        }
+    }
+    m_fontDataTable.set(hashKey, fontData);
+
+    return fontData;
+}
+
+}
diff --git a/WebCore/css/CSSSegmentedFontFace.h b/WebCore/css/CSSSegmentedFontFace.h
new file mode 100644 (file)
index 0000000..743c98a
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CSSSegmentedFontFace_h
+#define CSSSegmentedFontFace_h
+
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class CSSFontFace;
+class CSSFontSelector;
+class FontData;
+class FontDescription;
+class SegmentedFontData;
+
+struct FontFaceRange {
+    FontFaceRange(UChar32 from, UChar32 to, PassRefPtr<CSSFontFace> fontFace)
+        : m_from(from)
+        , m_to(to)
+        , m_fontFace(fontFace)
+    {
+    }
+
+    UChar32 from() const { return m_from; }
+    UChar32 to() const { return m_to; }
+    CSSFontFace* fontFace() const { return m_fontFace.get(); }
+
+private:
+    UChar32 m_from;
+    UChar32 m_to;
+    RefPtr<CSSFontFace> m_fontFace;
+};
+
+class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> {
+public:
+    CSSSegmentedFontFace(CSSFontSelector*);
+    ~CSSSegmentedFontFace();
+
+    bool isLoaded() const;
+    bool isValid() const;
+    CSSFontSelector* fontSelector() const { return m_fontSelector; }
+
+    void fontLoaded(CSSFontFace*);
+
+    void overlayRange(UChar32 from, UChar32 to, PassRefPtr<CSSFontFace>);
+
+    FontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
+
+private:
+    void pruneTable();
+
+    CSSFontSelector* m_fontSelector;
+    HashMap<unsigned, SegmentedFontData*> m_fontDataTable;
+    Vector<FontFaceRange, 1> m_ranges;
+};
+
+} // namespace WebCore
+
+#endif // CSSSegmentedFontFace_h
index f2276154818aecff0c412fc76e4e50dfa156f0c4..56c897d835dbe3153428dfc46400ceafb11b114b 100644 (file)
@@ -3698,6 +3698,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     }
     case CSS_PROP_SRC: // Only used in @font-face rules.
         return;
+    case CSS_PROP_UNICODE_RANGE: // Only used in @font-face rules.
+        return;
     case CSS_PROP__WEBKIT_BOX_DIRECTION:
         HANDLE_INHERIT_AND_INITIAL(boxDirection, BoxDirection)
         if (primitiveValue)
diff --git a/WebCore/css/CSSUnicodeRangeValue.cpp b/WebCore/css/CSSUnicodeRangeValue.cpp
new file mode 100644 (file)
index 0000000..599c078
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "CSSUnicodeRangeValue.h"
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+CSSUnicodeRangeValue::~CSSUnicodeRangeValue()
+{
+}
+
+String CSSUnicodeRangeValue::cssText() const
+{
+    String result;
+    // FIXME: Implement.
+    return result;
+}
+
+}
diff --git a/WebCore/css/CSSUnicodeRangeValue.h b/WebCore/css/CSSUnicodeRangeValue.h
new file mode 100644 (file)
index 0000000..8eca31e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CSSUnicodeRangeValue_h
+#define CSSUnicodeRangeValue_h
+
+#include "CSSValue.h"
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class CSSUnicodeRangeValue : public CSSValue {
+public:
+    CSSUnicodeRangeValue(UChar32 from, UChar32 to)
+        : m_from(from)
+        , m_to(to)
+    {
+    }
+
+    virtual ~CSSUnicodeRangeValue();
+
+    UChar32 from() const { return m_from; }
+    UChar32 to() const { return m_to; }
+
+    virtual String cssText() const;
+
+private:
+    UChar32 m_from;
+    UChar32 m_to;
+};
+
+} // namespace WebCore
+
+#endif // CSSUnicodeRangeValue_h
index 7d44c521860501fd28a201cadccaaaaa058a48a3..5a6a7ee7a6551d06f3c9a9166c3249dde4ae9cfb 100644 (file)
@@ -28,9 +28,9 @@
 #if ENABLE(SVG_FONTS)
 #include "SVGCSSFontFace.h"
 
-#include "FontData.h"
 #include "FontDescription.h"
 #include "SVGFontFaceElement.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -55,7 +55,7 @@ void SVGCSSFontFace::addSource(CSSFontFaceSource*)
     // no-op
 }
 
-FontData* SVGCSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
+SimpleFontData* SVGCSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
 {
     if (!isValid())
         return 0;
index 0be98c8e810a42bf70e93f30298ed1d4dc28be02..0fec6631a8dcd4039d8291468b4b538544712f1c 100644 (file)
@@ -42,11 +42,11 @@ public:
     virtual bool isValid() const;
     virtual void addSource(CSSFontFaceSource*);
 
-    virtual FontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
+    virtual SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
 
 private:
     RefPtr<SVGFontFaceElement> m_fontFaceElement;
-    OwnPtr<FontData> m_fontData;
+    OwnPtr<SimpleFontData> m_fontData;
 };
 
 }
index 5ed601207e45b1cf6b673c2855cd89a04cb34f66..4861fee888ab5393306b07c6626f876d2c987422 100644 (file)
@@ -41,6 +41,7 @@
 #include "EventHandler.h"
 #include "EventNames.h"
 #include "FocusController.h"
+#include "FontDataBaseClass.h"
 #include "FrameView.h"
 #include "HTMLInputElement.h"
 #include "HTMLTextAreaElement.h"
@@ -407,7 +408,7 @@ void Editor::respondToChangedContents(const Selection& endingSelection)
         client()->respondToChangedContents();  
 }
 
-const FontData* Editor::fontForSelection(bool& hasMultipleFonts) const
+const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
 {
 #if !PLATFORM(QT)
     hasMultipleFonts = false;
@@ -416,7 +417,7 @@ const FontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         Node* nodeToRemove;
         RenderStyle* style = m_frame->styleForSelectionStart(nodeToRemove); // sets nodeToRemove
 
-        const FontData* result = 0;
+        const SimpleFontData* result = 0;
         if (style)
             result = style->font().primaryFont();
         
@@ -429,7 +430,7 @@ const FontData* Editor::fontForSelection(bool& hasMultipleFonts) const
         return result;
     }
 
-    const FontData* font = 0;
+    const SimpleFontData* font = 0;
 
     RefPtr<Range> range = m_frame->selectionController()->toRange();
     Node* startNode = range->editingStartPosition().node();
@@ -442,7 +443,7 @@ const FontData* Editor::fontForSelection(bool& hasMultipleFonts) const
             if (!renderer)
                 continue;
             // FIXME: Are there any node types that have renderers, but that we should be skipping?
-            const FontData* f = renderer->style()->font().primaryFont();
+            const SimpleFontData* f = renderer->style()->font().primaryFont();
             if (!font)
                 font = f;
             else if (font != f) {
index 5c42ae81080ad8865a7ddad4581d17bacc40f139..a42ad12ccc4addb05c0b4f03e45bfd4baee40a42 100644 (file)
@@ -49,13 +49,13 @@ class EditCommand;
 class EditorInternalCommand;
 class EditorClient;
 class EventTargetNode;
-class FontData;
 class Frame;
 class HTMLElement;
 class Pasteboard;
 class Range;
 class SelectionController;
 class Selection;
+class SimpleFontData;
 
 struct CompositionUnderline {
     CompositionUnderline() 
@@ -123,7 +123,7 @@ public:
     void respondToChangedContents(const Selection& endingSelection);
 
     TriState selectionHasStyle(CSSStyleDeclaration*) const;
-    const FontData* fontForSelection(bool&) const;
+    const SimpleFontData* fontForSelection(bool&) const;
     
     TriState selectionUnorderedListState() const;
     TriState selectionOrderedListState() const;
index ec4b68c3946fb96c53bba75b2a4af68609a2692b..b81c3615537a1df7ca60498af809b8a41a6593a3 100644 (file)
@@ -45,7 +45,6 @@
 #import "Event.h"
 #import "EventNames.h"
 #import "FloatRect.h"
-#import "FontData.h"
 #import "FoundationExtras.h"
 #import "FrameLoadRequest.h"
 #import "FrameLoader.h"
@@ -79,6 +78,7 @@
 #import "RenderView.h"
 #import "ResourceHandle.h"
 #import "Settings.h"
+#import "SimpleFontData.h"
 #import "SystemTime.h"
 #import "TextResourceDecoder.h"
 #import "WebCoreFrameBridge.h"
index 760ad110f85057da2bd2d722379bac42e4d16df6..3a13a9e5d7a2ebb8f2d80ec95ada52b0e59820e5 100644 (file)
@@ -45,7 +45,6 @@
 #import "EditorClient.h"
 #import "EventHandler.h"
 #import "FloatRect.h"
-#import "FontData.h"
 #import "FormDataStreamMac.h"
 #import "Frame.h"
 #import "FrameLoader.h"
@@ -73,6 +72,7 @@
 #import "ReplaceSelectionCommand.h"
 #import "ResourceRequest.h"
 #import "SelectionController.h"
+#import "SimpleFontData.h"
 #import "SmartReplace.h"
 #import "SubresourceLoader.h"
 #import "SystemTime.h"
@@ -1125,7 +1125,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     bool multipleFonts = false;
     NSFont *font = nil;
     if (m_frame) {
-        const FontData* fd = m_frame->editor()->fontForSelection(multipleFonts);
+        const SimpleFontData* fd = m_frame->editor()->fontForSelection(multipleFonts);
         if (fd)
             font = fd->getNSFont();
     }
index ef033df7ebe5ea7f40dc187f9c229e36fda7845b..8c1fe82243507cb32868a74f2e51a13c83430800 100644 (file)
@@ -153,7 +153,7 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
 
         const GlyphData& glyphData = m_font->glyphDataForCharacter(c, rtl);
         Glyph glyph = glyphData.glyph;
-        const FontData* fontData = glyphData.fontData;
+        const SimpleFontData* fontData = glyphData.fontData;
 
         ASSERT(fontData);
 
@@ -363,7 +363,7 @@ const GlyphData& Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceS
 
     GlyphPageTreeNode* node = pageNumber ? m_pages.get(pageNumber) : m_pageZero;
     if (!node) {
-        node = GlyphPageTreeNode::getRootChild(primaryFont(), pageNumber);
+        node = GlyphPageTreeNode::getRootChild(fontDataAt(0), pageNumber);
         if (pageNumber)
             m_pages.set(pageNumber, node);
         else
@@ -398,7 +398,7 @@ const GlyphData& Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceS
                 if (data.fontData) {
                     // The smallCapsFontData function should not normally return 0.
                     // But if it does, we will just render the capital letter big.
-                    const FontData* smallCapsFontData = data.fontData->smallCapsFontData(m_fontDescription);
+                    const SimpleFontData* smallCapsFontData = data.fontData->smallCapsFontData(m_fontDescription);
                     if (!smallCapsFontData)
                         return data;
 
@@ -447,7 +447,7 @@ const GlyphData& Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceS
         codeUnits[1] = U16_TRAIL(c);
         codeUnitsLength = 2;
     }
-    const FontData* characterFontData = FontCache::getFontDataForCharacters(*this, codeUnits, codeUnitsLength);
+    const SimpleFontData* characterFontData = FontCache::getFontDataForCharacters(*this, codeUnits, codeUnitsLength);
     if (useSmallCapsFont)
         characterFontData = characterFontData->smallCapsFontData(m_fontDescription);
     if (characterFontData) {
@@ -468,10 +468,10 @@ const GlyphData& Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceS
     return data;
 }
 
-const FontData* Font::primaryFont() const
+const SimpleFontData* Font::primaryFont() const
 {
     ASSERT(m_fontList);
-    return m_fontList->primaryFont(this);
+    return m_fontList->primaryFont(this)->fontDataForCharacter(' ');
 }
 
 const FontData* Font::fontDataAt(unsigned index) const
@@ -644,14 +644,14 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const GlyphBuffer& glyphBuf
                            const TextRun& run, const FloatPoint& point) const
 {   
     // Draw each contiguous run of glyphs that use the same font data.
-    const FontData* fontData = glyphBuffer.fontDataAt(0);
+    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
     FloatSize offset = glyphBuffer.offsetAt(0);
     FloatPoint startPoint(point);
     float nextX = startPoint.x();
     int lastFrom = 0;
     int nextGlyph = 0;
     while (nextGlyph < glyphBuffer.size()) {
-        const FontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
+        const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
         FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
         if (nextFontData != fontData || nextOffset != offset) {
             drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
index cc56b3dac3a636019bb82c9d0d5f1a3b10b62f78..e8e9c7925c876009db051d833925b7dd5073d94d 100644 (file)
@@ -47,6 +47,7 @@ class GlyphPageTreeNode;
 class GraphicsContext;
 class IntPoint;
 class RenderObject;
+class SimpleFontData;
 class SVGPaintServer;
 
 struct GlyphData;
@@ -212,7 +213,7 @@ public:
     int tabWidth() const { return 8 * spaceWidth(); }
 
 #if !PLATFORM(QT)
-    const FontData* primaryFont() const;
+    const SimpleFontData* primaryFont() const;
     const FontData* fontDataAt(unsigned) const;
     const GlyphData& glyphDataForCharacter(UChar32, bool mirror, bool forceSmallCaps = false) const;
     // Used for complex text, and does not utilize the glyph map cache.
@@ -226,7 +227,7 @@ private:
     float floatWidthUsingSVGFont(const TextRun&) const;
     FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const IntPoint&, int h, int from, int to) const;
 #endif
-    void drawGlyphs(GraphicsContext*, const FontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const;
+    void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const;
     void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const;
     void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
     float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const;
index 7cf9fbb280c3af2bf638331e98fb29540979f8d3..6abbb2ea43d5a64c1fa663fc4a4e908dc96935b3 100644 (file)
@@ -200,11 +200,11 @@ struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> {
     }
 };
 
-typedef HashMap<FontPlatformData, FontData*, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
+typedef HashMap<FontPlatformData, SimpleFontData*, FontDataCacheKeyHash, FontDataCacheKeyTraits> FontDataCache;
 
 static FontDataCache* gFontDataCache = 0;
 
-FontData* FontCache::getCachedFontData(const FontPlatformData* platformData)
+SimpleFontData* FontCache::getCachedFontData(const FontPlatformData* platformData)
 {
     if (!platformData)
         return 0;
@@ -212,9 +212,9 @@ FontData* FontCache::getCachedFontData(const FontPlatformData* platformData)
     if (!gFontDataCache)
         gFontDataCache = new FontDataCache;
     
-    FontData* result = gFontDataCache->get(*platformData);
+    SimpleFontData* result = gFontDataCache->get(*platformData);
     if (!result) {
-        result = new FontData(*platformData);
+        result = new SimpleFontData(*platformData);
         gFontDataCache->set(*platformData, result);
     }
         
index 5c69ea29f3b03e884c388f8c41b3365edd9e2bfb..df0554542ddac10b2a3c12dd95666710753fae40 100644 (file)
@@ -39,18 +39,19 @@ namespace WebCore
 {
 
 class AtomicString;
-class FontData;
-class FontPlatformData;
 class Font;
+class FontPlatformData;
+class FontData;
 class FontDescription;
 class FontSelector;
+class SimpleFontData;
 
 class FontCache {
 public:
     static const FontData* getFontData(const Font&, int& familyIndex, FontSelector*);
     
     // This method is implemented by the platform.
-    static const FontData* getFontDataForCharacters(const Font&, const UChar* characters, int length);
+    static const SimpleFontData* getFontDataForCharacters(const Font&, const UChar* characters, int length);
     
     // Also implemented by the platform.
     static void platformInit();
@@ -62,7 +63,7 @@ public:
     static bool fontExists(const FontDescription&, const AtomicString& family);
 
     static FontPlatformData* getCachedFontPlatformData(const FontDescription&, const AtomicString& family, bool checkingAlternateName = false);
-    static FontData* getCachedFontData(const FontPlatformData*);
+    static SimpleFontData* getCachedFontData(const FontPlatformData*);
     static FontPlatformData* getLastResortFallbackFont(const FontDescription&);
     
 private:
@@ -70,7 +71,7 @@ private:
     static FontPlatformData* getSimilarFontPlatformData(const Font&);
     static FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
 
-    friend class FontData;
+    friend class SimpleFontData;
     friend class FontFallbackList;
 };
 
diff --git a/WebCore/platform/graphics/FontDataBaseClass.cpp b/WebCore/platform/graphics/FontDataBaseClass.cpp
new file mode 100644 (file)
index 0000000..2d4daa0
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "FontDataBaseClass.h"
+
+namespace WebCore {
+
+FontData::~FontData()
+{
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/FontDataBaseClass.h b/WebCore/platform/graphics/FontDataBaseClass.h
new file mode 100644 (file)
index 0000000..a3e934f
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef FontDataBaseClass_h
+#define FontDataBaseClass_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class SimpleFontData;
+
+class FontData : Noncopyable {
+public:
+    virtual ~FontData();
+
+    virtual const SimpleFontData* fontDataForCharacter(UChar32) const = 0;
+    virtual bool containsCharacters(const UChar*, int length) const = 0;
+    virtual bool isCustomFont() const = 0;
+    virtual bool isLoading() const = 0;
+    virtual bool isSegmented() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // FontDataBaseClass_h
index 288f279acfe47c157b430e20fd00a205cc0a137f..5edc9286b51185673b089e5ed3a578c24375a9d4 100644 (file)
@@ -53,7 +53,7 @@ void FontFallbackList::invalidate(PassRefPtr<FontSelector> fontSelector)
 
 void FontFallbackList::determinePitch(const Font* font) const
 {
-    m_pitch = primaryFont(font)->pitch();
+    m_pitch = primaryFont(font)->fontDataForCharacter(' ')->pitch();
 }
 
 const FontData* FontFallbackList::fontDataAt(const Font* font, unsigned realizedFontIndex) const
index faf04608049e4f63ad45f1b0467c37224fd96be0..38128a2e19566fbd86fbd2c2b474a56fc78d5757 100644 (file)
@@ -24,8 +24,8 @@
 // This file has no guards on purpose in order to detect redundant includes. This is a private header
 // and so this may catch someone trying to include this file in public cpp files.
 
-#include "FontData.h"
 #include "FontSelector.h"
+#include "SimpleFontData.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
index 8cf1b10d74f070db88a2add9ee208dfd0cee22c2..f65996de1e2a686adfd6ad67e1b34ed724cedfe2 100644 (file)
@@ -42,7 +42,7 @@
 namespace WebCore {
 
 typedef unsigned short Glyph;
-class FontData;
+class SimpleFontData;
 
 #if PLATFORM(CG)
 typedef Glyph GlyphBufferGlyph;
@@ -78,11 +78,11 @@ public:
     const GlyphBufferGlyph* glyphs(int from) const { return m_glyphs.data() + from; }
     const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
 
-    const FontData* fontDataAt(int index) const { return m_fontData[index]; }
+    const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }
     
     void swap(int index1, int index2)
     {
-        const FontData* f = m_fontData[index1];
+        const SimpleFontData* f = m_fontData[index1];
         m_fontData[index1] = m_fontData[index2];
         m_fontData[index2] = f;
 
@@ -128,7 +128,7 @@ public:
 #endif
     }
 
-    void add(Glyph glyph, const FontData* font, float width, const FloatSize* offset = 0)
+    void add(Glyph glyph, const SimpleFontData* font, float width, const FloatSize* offset = 0)
     {
         m_fontData.append(font);
 #if PLATFORM(CG)
@@ -155,7 +155,7 @@ public:
     }
     
 private:
-    Vector<const FontData*, 2048> m_fontData;
+    Vector<const SimpleFontData*, 2048> m_fontData;
     Vector<GlyphBufferGlyph, 2048> m_glyphs;
     Vector<GlyphBufferAdvance, 2048> m_advances;
 #if PLATFORM(WIN)
index 8dee8e616dbe557bb9bb8db67e533b0d3a6fd386..307fcdead55e0dc07ead76b8bce11a5e73f51e33 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "GlyphPageTreeNode.h"
 
 #include "CharacterNames.h"
-#include "FontData.h"
+#include "SegmentedFontData.h"
+#include "SimpleFontData.h"
 #include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
+using std::max;
+using std::min;
+
 HashMap<int, GlyphPageTreeNode*>* GlyphPageTreeNode::roots = 0;
 GlyphPageTreeNode* GlyphPageTreeNode::pageZeroRoot = 0;
 
@@ -149,7 +153,30 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu
             // routine of our glyph map for actually filling in the page with the glyphs.
             // Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data
             // for only 128 out of 256 characters.
-            bool haveGlyphs = m_page->fill(buffer, bufferLength, fontData);
+            bool haveGlyphs;
+            if (fontData->isSegmented()) {
+                haveGlyphs = false;
+
+                const SegmentedFontData* segmentedFontData = static_cast<const SegmentedFontData*>(fontData);
+                unsigned numRanges = segmentedFontData->numRanges();
+                bool zeroFilled = false;
+                for (unsigned i = 0; i < numRanges; i++) {
+                    const FontDataRange& range = segmentedFontData->rangeAt(i);
+                    int from = max(0, range.from() - static_cast<int>(start));
+                    int to = min(range.to() - static_cast<int>(start), static_cast<int>(GlyphPage::size));
+                    if (from < static_cast<int>(GlyphPage::size) && to > 0) {
+                        if (!zeroFilled) {
+                            if (from > 0 || to < static_cast<int>(GlyphPage::size)) {
+                                for (unsigned i = 0; i < GlyphPage::size; i++)
+                                    m_page->setGlyphDataForIndex(i, 0, 0);
+                            }
+                            zeroFilled = true;
+                        }
+                        haveGlyphs |= m_page->fill(from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData());
+                    }
+                }
+            } else
+                haveGlyphs = m_page->fill(0, GlyphPage::size, buffer, bufferLength, static_cast<const SimpleFontData*>(fontData));
 
             if (!haveGlyphs)
                 m_page = 0;
index 53074ef3029dfb2761ac31cb822f61907c017dc4..26198883d6e5b941406895e77900ea833ee64398 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,14 +37,15 @@ namespace WebCore {
 
 class FontData;
 class GlyphPageTreeNode;
+class SimpleFontData;
 
 typedef unsigned short Glyph;
 
-// Holds the glyph index and the corresponding FontData information for a given
+// Holds the glyph index and the corresponding SimpleFontData information for a given
 // character.
 struct GlyphData {
     Glyph glyph;
-    const FontData* fontData;
+    const SimpleFontData* fontData;
 };
 
 // A GlyphPage contains a fixed-size set of GlyphData mappings for a contiguous
@@ -71,11 +72,11 @@ struct GlyphPage : public RefCounted<GlyphPage> {
     GlyphPageTreeNode* m_owner;
 
     const GlyphData& glyphDataForCharacter(UChar32 c) const { return m_glyphs[c % size]; }
-    void setGlyphDataForCharacter(UChar32 c, Glyph g, const FontData* f)
+    void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)
     {
         setGlyphDataForIndex(c % size, g, f);
     }
-    void setGlyphDataForIndex(unsigned index, Glyph g, const FontData* f)
+    void setGlyphDataForIndex(unsigned index, Glyph g, const SimpleFontData* f)
     {
         ASSERT(index < size);
         m_glyphs[index].glyph = g;
@@ -83,7 +84,7 @@ struct GlyphPage : public RefCounted<GlyphPage> {
     }
     GlyphPageTreeNode* owner() const { return m_owner; }
     // Implemented by the platform.
-    bool fill(UChar* characterBuffer, unsigned bufferLength, const FontData* fontData);
+    bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData* fontData);
 };
 
 // The glyph page tree is a data structure that maps (FontData, glyph page number)
diff --git a/WebCore/platform/graphics/SegmentedFontData.cpp b/WebCore/platform/graphics/SegmentedFontData.cpp
new file mode 100644 (file)
index 0000000..8c8d97f
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "SegmentedFontData.h"
+
+#include "SimpleFontData.h"
+#include <wtf/Assertions.h>
+
+namespace WebCore {
+
+SegmentedFontData::~SegmentedFontData()
+{
+}
+
+const SimpleFontData* SegmentedFontData::fontDataForCharacter(UChar32 c) const
+{
+    Vector<FontDataRange>::const_iterator end = m_ranges.end();
+    for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
+        if (it->from() <= c && it->to() > c)
+            return it->fontData();
+    }
+    return m_ranges[0].fontData();
+}
+
+bool SegmentedFontData::containsCharacters(const UChar* characters, int length) const
+{
+    Vector<FontDataRange>::const_iterator end = m_ranges.end();
+    for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
+        if (it->from() <= characters[0] && it->to() > characters[0])
+            return true;
+    }
+    return false;
+}
+
+bool SegmentedFontData::isCustomFont() const
+{
+    // All segmented fonts are custom fonts.
+    return true;
+}
+
+bool SegmentedFontData::isLoading() const
+{
+    Vector<FontDataRange>::const_iterator end = m_ranges.end();
+    for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
+        if (it->fontData()->isLoading())
+            return true;
+    }
+    return false;
+}
+
+bool SegmentedFontData::isSegmented() const
+{
+    return true;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/SegmentedFontData.h b/WebCore/platform/graphics/SegmentedFontData.h
new file mode 100644 (file)
index 0000000..23ef898
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SegmentedFontData_h
+#define SegmentedFontData_h
+
+#include "FontDataBaseClass.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class SimpleFontData;
+
+struct FontDataRange {
+    FontDataRange(UChar32 from, UChar32 to, const SimpleFontData* fontData)
+        : m_from(from)
+        , m_to(to)
+        , m_fontData(fontData)
+    {
+    }
+
+    UChar32 from() const { return m_from; }
+    UChar32 to() const { return m_to; }
+    const SimpleFontData* fontData() const { return m_fontData; }
+
+private:
+    UChar32 m_from;
+    UChar32 m_to;
+    const SimpleFontData* m_fontData;
+};
+
+class SegmentedFontData : public FontData {
+public:
+    virtual ~SegmentedFontData();
+
+    virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
+    virtual bool containsCharacters(const UChar*, int length) const;
+    virtual bool isCustomFont() const;
+    virtual bool isLoading() const;
+    virtual bool isSegmented() const;
+
+    void appendRange(const FontDataRange& range) { m_ranges.append(range); }
+    unsigned numRanges() const { return m_ranges.size(); }
+    const FontDataRange& rangeAt(unsigned i) const { return m_ranges[i]; }
+
+private:
+    Vector<FontDataRange, 1> m_ranges;
+};
+
+} // namespace WebCore
+
+#endif // SegmentedFontData_h
similarity index 88%
rename from WebCore/platform/graphics/FontData.cpp
rename to WebCore/platform/graphics/SimpleFontData.cpp
index 2226d0ee575d98ad5813dc118fb6524f6e14f30d..c8e1ca0d559c641fea4f268a28c9edc64b12fbce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 2008 Apple Computer, Inc.  All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
  */
 
 #include "config.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 
 #include <wtf/MathExtras.h>
 
@@ -58,7 +58,7 @@ float SVGFontData::convertEmUnitToPixel(float fontSize, float unitsPerEm, float
 }
 #endif
 
-FontData::FontData(const FontPlatformData& f, bool customFont, bool loading)
+SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading)
     : m_font(f)
     , m_treatAsFixedPitch(false)
 #if ENABLE(SVG_FONTS)
@@ -108,7 +108,7 @@ FontData::FontData(const FontPlatformData& f, bool customFont, bool loading)
     m_missingGlyphData.glyph = 0;
 }
 
-FontData::~FontData()
+SimpleFontData::~SimpleFontData()
 {
     platformDestroy();
 
@@ -116,7 +116,7 @@ FontData::~FontData()
     // it will be deleted then, so we don't need to do anything here.
 }
 
-int FontData::ascent(float fontSize) const
+int SimpleFontData::ascent(float fontSize) const
 {
 #if ENABLE(SVG_FONTS)
     if (m_svgFontData)
@@ -126,7 +126,7 @@ int FontData::ascent(float fontSize) const
     return m_ascent;
 }
 
-int FontData::descent(float fontSize) const
+int SimpleFontData::descent(float fontSize) const
 {
 #if ENABLE(SVG_FONTS)
     if (m_svgFontData)
@@ -136,7 +136,7 @@ int FontData::descent(float fontSize) const
     return m_descent;
 }
 
-int FontData::lineSpacing(float fontSize) const
+int SimpleFontData::lineSpacing(float fontSize) const
 {
 #if ENABLE(SVG_FONTS)
     if (m_svgFontData)
@@ -146,7 +146,7 @@ int FontData::lineSpacing(float fontSize) const
     return m_lineSpacing;
 }
 
-int FontData::lineGap(float fontSize) const
+int SimpleFontData::lineGap(float fontSize) const
 {
 #if ENABLE(SVG_FONTS)
     if (m_svgFontData)
@@ -156,7 +156,7 @@ int FontData::lineGap(float fontSize) const
     return m_lineGap;
 }
 
-float FontData::xHeight(float fontSize) const
+float SimpleFontData::xHeight(float fontSize) const
 {
 #if ENABLE(SVG_FONTS)
     if (m_svgFontData)
@@ -166,7 +166,7 @@ float FontData::xHeight(float fontSize) const
     return m_xHeight;
 }
 
-float FontData::widthForGlyph(Glyph glyph) const
+float SimpleFontData::widthForGlyph(Glyph glyph) const
 {
     float width = m_glyphToWidthMap.widthForGlyph(glyph);
     if (width != cGlyphWidthUnknown)
@@ -178,4 +178,14 @@ float FontData::widthForGlyph(Glyph glyph) const
     return width;
 }
 
+const SimpleFontData* SimpleFontData::fontDataForCharacter(UChar32) const
+{
+    return this;
+}
+
+bool SimpleFontData::isSegmented() const
+{
+    return false;
+}
+
 } // namespace WebCore
similarity index 86%
rename from WebCore/platform/graphics/FontData.h
rename to WebCore/platform/graphics/SimpleFontData.h
index e3d3899edb07b3a1f1a020d8b328441c38dea2c0..bd6d9dc0c6cff3bf1acb0c44f38dd5bc1bea8b56 100644 (file)
  *
  */
 
-#ifndef FontData_h
-#define FontData_h
+#ifndef SimpleFontData_h
+#define SimpleFontData_h
 
+#include "FontDataBaseClass.h"
 #include "FontPlatformData.h"
 #include "GlyphPageTreeNode.h"
 #include "GlyphWidthMap.h"
-#include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
-#include <wtf/unicode/Unicode.h>
-
 #if PLATFORM(MAC)
 typedef struct OpaqueATSUStyle* ATSUStyle;
 #endif
@@ -70,14 +68,14 @@ struct SVGFontData {
 
 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
 
-class FontData : Noncopyable {
+class SimpleFontData : public FontData {
 public:
-    FontData(const FontPlatformData&, bool customFont = false, bool loading = false);
-    ~FontData();
+    SimpleFontData(const FontPlatformData&, bool customFont = false, bool loading = false);
+    virtual ~SimpleFontData();
 
 public:
     const FontPlatformData& platformData() const { return m_font; }
-    FontData* smallCapsFontData(const FontDescription& fontDescription) const;
+    SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) const;
 
     // vertical metrics
     int ascent(float fontSize) const;
@@ -90,7 +88,8 @@ public:
     float widthForGlyph(Glyph) const;
     float platformWidthForGlyph(Glyph) const;
 
-    bool containsCharacters(const UChar* characters, int length) const;
+    virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
+    virtual bool containsCharacters(const UChar*, int length) const;
 
     void determinePitch();
     Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitch; }
@@ -100,8 +99,9 @@ public:
     SVGFontData* svgFontData() const { return m_svgFontData.get(); }
 #endif
 
-    bool isCustomFont() const { return m_isCustomFont; }
-    bool isLoading() const { return m_isLoading; }
+    virtual bool isCustomFont() const { return m_isCustomFont; }
+    virtual bool isLoading() const { return m_isLoading; }
+    virtual bool isSegmented() const;
 
     const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
 
@@ -165,7 +165,7 @@ public:
 
     GlyphData m_missingGlyphData;
 
-    mutable FontData* m_smallCapsFontData;
+    mutable SimpleFontData* m_smallCapsFontData;
 
 #if PLATFORM(CG)
     float m_syntheticBoldOffset;
@@ -189,4 +189,4 @@ public:
 
 } // namespace WebCore
 
-#endif // FontData_h
+#endif // SimpleFontData_h
index 19a566f4b41499b03f32cbbcc1435f5f33fcac75..f4caef246d9b8efa16b2d1797dcbf20a2fbd7d00 100644 (file)
 #include "CairoPath.h"
 #include "FloatRect.h"
 #include "Font.h"
-#include "FontData.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
 #include "Path.h"
+#include "SimpleFontData.h"
 #include <cairo.h>
 #include <math.h>
 #include <stdio.h>
@@ -580,7 +580,7 @@ void GraphicsContext::setPlatformFont(const Font& font)
 #if PLATFORM(GTK)
     // FIXME: is it the right thing to do? Also, doesn't work on Win because
     // there FontData doesn't have ::setFont()
-    const FontData *fontData = font.primaryFont();
+    const SimpleFontData *fontData = font.primaryFont();
     fontData->setFont(m_data->cr);
 #endif
 }
index 5caebc45a6f607f511e0e9b36673374b82632c38..21313405aae9875a087e8bb280d874a48bd68ee8 100644 (file)
@@ -32,7 +32,7 @@
 #include "FontCache.h"
 
 #include "Font.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 #include <wtf/Assertions.h>
 
 namespace WebCore {
@@ -43,9 +43,9 @@ void FontCache::platformInit()
         ASSERT_NOT_REACHED();
 }
 
-const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
 {
-    return new FontData(FontPlatformData(font.fontDescription(), font.family().family()));
+    return new SimpleFontData(FontPlatformData(font.fontDescription(), font.family().family()));
 }
 
 FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
index 59181f8f64394c6add769653d1434b6fed0cfd73..3b3a2284008aa9628f89002fe2bfbc9e0943ae6b 100644 (file)
 #include "config.h"
 #include "Font.h"
 
-#include "FontData.h"
 #include "GraphicsContext.h"
 #include "NotImplemented.h"
+#include "SimpleFontData.h"
 #include <cairo.h>
 
 namespace WebCore {
 
-void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, const GlyphBuffer& glyphBuffer,
+void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
                       int from, int numGlyphs, const FloatPoint& point) const
 {
     cairo_t* context = graphicsContext->platformContext();
index c0bcfa487915d2b1d44127b230f86d9849591ae7..4864fcc394e1c25731c557a95567c3c3fa35e495 100644 (file)
 #include "config.h"
 #include "GlyphPageTreeNode.h"
 
-#include "FontData.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     // The bufferLength will be greater than the glyph page size if the buffer has Unicode supplementary characters.
     // We won't support this for now.
@@ -47,12 +47,12 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontD
         return false;
 
     bool haveGlyphs = false;
-    for (unsigned i = 0; i < GlyphPage::size; i++) {
+    for (unsigned i = 0; i < length; i++) {
         Glyph glyph = FcFreeTypeCharIndex(face, buffer[i]);
         if (!glyph)
-            setGlyphDataForIndex(i, 0, 0);
+            setGlyphDataForIndex(offset + i, 0, 0);
         else {
-            setGlyphDataForIndex(i, glyph, fontData);
+            setGlyphDataForIndex(offset + i, glyph, fontData);
             haveGlyphs = true;
         }
     }
similarity index 89%
rename from WebCore/platform/graphics/gtk/FontDataGtk.cpp
rename to WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp
index 30b5e700c7cfc048ab221a057b21a621fda27637..410457393204c59487b67ac08024defdaa31cf8e 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "config.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 
 #include "FloatRect.h"
 #include "Font.h"
@@ -45,7 +45,7 @@
 
 namespace WebCore {
 
-void FontData::platformInit()
+void SimpleFontData::platformInit()
 {
     cairo_font_extents_t font_extents;
     cairo_text_extents_t text_extents;
@@ -60,7 +60,7 @@ void FontData::platformInit()
     m_lineGap = m_lineSpacing - m_ascent - m_descent;
 }
 
-void FontData::platformDestroy()
+void SimpleFontData::platformDestroy()
 {
     if (m_font.m_pattern && ((FcPattern*)-1 != m_font.m_pattern))
         FcPatternDestroy(m_font.m_pattern);
@@ -70,18 +70,18 @@ void FontData::platformDestroy()
     delete m_smallCapsFontData;
 }
 
-FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
+SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
 {
     if (!m_smallCapsFontData) {
         FontDescription desc = FontDescription(fontDescription);
         desc.setSpecifiedSize(0.70f*fontDescription.computedSize());
         const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family());
-        m_smallCapsFontData = new FontData(*pdata);
+        m_smallCapsFontData = new SimpleFontData(*pdata);
     }
     return m_smallCapsFontData;
 }
 
-bool FontData::containsCharacters(const UChar* characters, int length) const
+bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
     FT_Face face = cairo_ft_scaled_font_lock_face(m_font.m_scaledFont);
 
@@ -100,12 +100,12 @@ bool FontData::containsCharacters(const UChar* characters, int length) const
     return true;
 }
 
-void FontData::determinePitch()
+void SimpleFontData::determinePitch()
 {
     m_treatAsFixedPitch = m_font.isFixedPitch();
 }
 
-float FontData::platformWidthForGlyph(Glyph glyph) const
+float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     ASSERT(m_font.m_scaledFont);
 
@@ -119,7 +119,7 @@ float FontData::platformWidthForGlyph(Glyph glyph) const
     return w;
 }
 
-void FontData::setFont(cairo_t* cr) const
+void SimpleFontData::setFont(cairo_t* cr) const
 {
     ASSERT(cr);
     m_font.setFont(cr);
index f0abb715f180b0280dcdd9dcb049c53e3e7945c1..c2f0402599b0cfdfdd48f2551c220870d962093e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
 #import "FontCache.h"
 
 #import "Font.h"
-#import "FontData.h"
+#import "SimpleFontData.h"
 #import "FontPlatformData.h"
 #import "WebCoreSystemInterface.h"
 #import "WebFontCache.h"
@@ -117,9 +117,9 @@ void FontCache::platformInit()
     wkSetUpFontCache(s);
 }
 
-const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
 {
-    const FontPlatformData& platformData = font.primaryFont()->platformData();
+    const FontPlatformData& platformData = font.fontDataAt(0)->fontDataForCharacter(characters[0])->platformData();
     NSFont *nsFont = platformData.font();
 
     NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters)
@@ -140,16 +140,29 @@ const FontData* FontCache::getFontDataForCharacters(const Font& font, const UCha
 
     NSFontManager *manager = [NSFontManager sharedFontManager];
 
-    NSFontTraitMask traits = [manager traitsOfFont:nsFont];
-    if (platformData.m_syntheticBold)
-        traits |= NSBoldFontMask;
-    if (platformData.m_syntheticOblique)
-        traits |= NSItalicFontMask;
+    NSFontTraitMask traits;
+    NSInteger weight;
+    CGFloat size;
+
+    if (nsFont) {
+        traits = [manager traitsOfFont:nsFont];
+        if (platformData.m_syntheticBold)
+            traits |= NSBoldFontMask;
+        if (platformData.m_syntheticOblique)
+            traits |= NSItalicFontMask;
+        weight = [manager weightOfFont:nsFont];
+        size = [nsFont pointSize];
+    } else {
+        // For custom fonts nsFont is nil.
+        traits = (font.bold() ? NSBoldFontMask : 0) | (font.italic() ? NSItalicFontMask : 0);
+        weight = 5;
+        size = font.pixelSize();
+    }
 
     NSFont *bestVariation = [manager fontWithFamily:[substituteFont familyName]
         traits:traits
-        weight:[manager weightOfFont:nsFont]
-        size:[nsFont pointSize]];
+        weight:weight
+        size:size];
     if (bestVariation)
         substituteFont = bestVariation;
 
index 3415e41a7df43a6132ac1333597511293a8f20fc..06d8d9e4e91a7de0623cb61e7eae09dbde277672 100644 (file)
 
 #import "BlockExceptions.h"
 #import "CharacterNames.h"
-#import "FontData.h"
 #import "FontFallbackList.h"
 #import "GlyphBuffer.h"
 #import "GraphicsContext.h"
 #import "IntRect.h"
 #import "Logging.h"
+#import "ShapeArabic.h"
+#import "SimpleFontData.h"
 #import "WebCoreSystemInterface.h"
 #import "WebCoreTextRenderer.h"
-#import "ShapeArabic.h"
 
 #define SYNTHETIC_OBLIQUE_ANGLE 14
 
@@ -73,7 +73,7 @@ struct ATSULayoutParameters
     const Font* m_font;
     
     ATSUTextLayout m_layout;
-    const FontData **m_fonts;
+    const SimpleFontData **m_fonts;
     
     UChar *m_charBuffer;
     bool m_hasSyntheticBold;
@@ -94,7 +94,7 @@ static TextRun addDirectionalOverride(const TextRun& run, bool rtl)
     return result;
 }
 
-static void initializeATSUStyle(const FontData* fontData)
+static void initializeATSUStyle(const SimpleFontData* fontData)
 {
     // The two NSFont calls in this method (pointSize and _atsFontID) do not raise exceptions.
 
@@ -166,9 +166,9 @@ static OSStatus overrideLayoutOperation(ATSULayoutOperationSelector iCurrentOper
         Fixed lastNativePos = 0;
         float lastAdjustedPos = 0;
         const UChar* characters = params->m_charBuffer ? params->m_charBuffer : params->m_run.characters();
-        const FontData **renderers = params->m_fonts;
-        const FontData *renderer;
-        const FontData *lastRenderer = 0;
+        const SimpleFontData **renderers = params->m_fonts;
+        const SimpleFontData *renderer;
+        const SimpleFontData *lastRenderer = 0;
         UChar ch, nextCh;
         ByteCount offset = layoutRecords[0].originalOffset;
         nextCh = *(UChar *)(((char *)characters)+offset);
@@ -312,8 +312,8 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
 {
     m_font = font;
     
-    const FontData* fontData = font->primaryFont();
-    m_fonts = new const FontData*[m_run.length()];
+    const SimpleFontData* fontData = font->primaryFont();
+    m_fonts = new const SimpleFontData*[m_run.length()];
     m_charBuffer = font->isSmallCaps() ? new UChar[m_run.length()] : 0;
     
     ATSUTextLayout layout;
@@ -372,13 +372,17 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
     UniCharArrayOffset substituteOffset = 0;
     UniCharCount substituteLength;
     UniCharArrayOffset lastOffset;
-    const FontData* substituteFontData = 0;
+    const SimpleFontData* substituteFontData = 0;
 
     while (substituteOffset < runLength) {
+        // FIXME: Using ATSUMatchFontsToText() here results in several problems: the CSS font family list is not necessarily followed for the 2nd
+        // and onwards unmatched characters; segmented fonts do not work correctly; behavior does not match the simple text and Uniscribe code
+        // paths. Change this function to use Font::glyphDataForCharacter() for each character instead. 
         lastOffset = substituteOffset;
         status = ATSUMatchFontsToText(layout, substituteOffset, kATSUToTextEnd, &ATSUSubstituteFont, &substituteOffset, &substituteLength);
         if (status == kATSUFontsMatched || status == kATSUFontsNotMatched) {
-            substituteFontData = m_font->fontDataForCharacters(m_run.characters() + substituteOffset, substituteLength);
+            const FontData* fallbackFontData = m_font->fontDataForCharacters(m_run.characters() + substituteOffset, substituteLength);
+            substituteFontData = fallbackFontData ? fallbackFontData->fontDataForCharacter(m_run[0]) : 0;
             if (substituteFontData) {
                 initializeATSUStyle(substituteFontData);
                 if (substituteFontData->m_ATSUStyle)
@@ -393,7 +397,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
         bool shapedArabic = false;
         bool isSmallCap = false;
         UniCharArrayOffset firstSmallCap = 0;
-        const FontData *r = fontData;
+        const SimpleFontData *r = fontData;
         UniCharArrayOffset i;
         for (i = lastOffset;  ; i++) {
             if (i == substituteOffset || i == substituteOffset + substituteLength) {
@@ -428,7 +432,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
                 }
             }
             if (m_font->isSmallCaps()) {
-                const FontData* smallCapsData = r->smallCapsFontData(m_font->fontDescription());
+                const SimpleFontData* smallCapsData = r->smallCapsFontData(m_font->fontDescription());
                 UChar c = m_charBuffer[i];
                 UChar newC;
                 if (U_GET_GC_MASK(c) & U_GC_M_MASK)
@@ -599,7 +603,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includ
     return offset;
 }
 
-void Font::drawGlyphs(GraphicsContext* context, const FontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
+void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
 {
     CGContextRef cgContext = context->platformContext();
 
index f536e40d78073f1a12a2183e889663f88a8aea87..b9f2da3cec6692393a271c59863104ff28c43429 100644 (file)
 #include "config.h"
 #include "GlyphPageTreeNode.h"
 
-#include "FontData.h"
+#include "SimpleFontData.h"
 #include "WebCoreSystemInterface.h"
 #include <ApplicationServices/ApplicationServices.h>
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     // Use an array of long so we get good enough alignment.
     long glyphVector[(GLYPH_VECTOR_SIZE + sizeof(long) - 1) / sizeof(long)];
@@ -49,7 +49,7 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontD
     wkConvertCharToGlyphs(fontData->m_styleGroup, buffer, bufferLength, &glyphVector);
 
     unsigned numGlyphs = wkGetGlyphVectorNumGlyphs(&glyphVector);
-    if (numGlyphs != GlyphPage::size) {
+    if (numGlyphs != length) {
         // This should never happen, perhaps indicates a bad font?
         // If it does happen, the font substitution code will find an alternate font.
         wkClearGlyphVector(&glyphVector);
@@ -58,12 +58,12 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontD
 
     bool haveGlyphs = false;
     ATSLayoutRecord* glyphRecord = (ATSLayoutRecord*)wkGetGlyphVectorFirstRecord(glyphVector);
-    for (unsigned i = 0; i < GlyphPage::size; i++) {
+    for (unsigned i = 0; i < length; i++) {
         Glyph glyph = glyphRecord->glyphID;
         if (!glyph)
-            setGlyphDataForIndex(i, 0, 0);
+            setGlyphDataForIndex(offset + i, 0, 0);
         else {
-            setGlyphDataForIndex(i, glyph, fontData);
+            setGlyphDataForIndex(offset + i, glyph, fontData);
             haveGlyphs = true;
         }
         glyphRecord = (ATSLayoutRecord *)((char *)glyphRecord + wkGetGlyphVectorRecordSize(glyphVector));
similarity index 95%
rename from WebCore/platform/graphics/mac/FontDataMac.mm
rename to WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index dd9f789bcbe9cd97ddee4b360a0855f30d2403d2..1f45c94c0ce65333ba23949a8aa545c093bf8208 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #import "config.h"
-#import "FontData.h"
+#import "SimpleFontData.h"
 
 #import "BlockExceptions.h"
 #import "Color.h"
@@ -54,7 +54,7 @@ const float smallCapsFontSizeMultiplier = 0.7f;
 const float contextDPI = 72.0f;
 static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x * (contextDPI / (contextDPI * unitsPerEm)); }
 
-bool initFontData(FontData* fontData)
+bool initFontData(SimpleFontData* fontData)
 {
     if (!fontData->m_font.m_cgFont)
         return false;
@@ -96,7 +96,7 @@ static NSString *webFallbackFontFamily(void)
     return webFallbackFontFamily.get();
 }
 
-void FontData::platformInit()
+void SimpleFontData::platformInit()
 {
     m_styleGroup = 0;
     m_ATSUStyleInitialized = false;
@@ -207,7 +207,7 @@ void FontData::platformInit()
         m_xHeight = [m_font.font() xHeight];
 }
 
-void FontData::platformDestroy()
+void SimpleFontData::platformDestroy()
 {
     if (m_styleGroup)
         wkReleaseStyleGroup(m_styleGroup);
@@ -216,13 +216,13 @@ void FontData::platformDestroy()
         ATSUDisposeStyle(m_ATSUStyle);
 }
 
-FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
+SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
 {
     if (!m_smallCapsFontData) {
         if (isCustomFont()) {
             FontPlatformData smallCapsFontData(m_font);
             smallCapsFontData.m_size = smallCapsFontData.m_size * smallCapsFontSizeMultiplier;
-            m_smallCapsFontData = new FontData(smallCapsFontData, true, false);
+            m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false);
         } else {
             BEGIN_BLOCK_OBJC_EXCEPTIONS;
             float size = [m_font.font() pointSize] * smallCapsFontSizeMultiplier;
@@ -253,7 +253,7 @@ FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) co
     return m_smallCapsFontData;
 }
 
-bool FontData::containsCharacters(const UChar* characters, int length) const
+bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
     NSString *string = [[NSString alloc] initWithCharactersNoCopy:(UniChar*)characters length:length freeWhenDone:NO];
     NSCharacterSet *set = [[m_font.font() coveredCharacterSet] invertedSet];
@@ -262,7 +262,7 @@ bool FontData::containsCharacters(const UChar* characters, int length) const
     return result;
 }
 
-void FontData::determinePitch()
+void SimpleFontData::determinePitch()
 {
     NSFont* f = m_font.font();
     // Special case Osaka-Mono.
@@ -284,7 +284,7 @@ void FontData::determinePitch()
            [name caseInsensitiveCompare:@"MonotypeCorsiva"] != NSOrderedSame;
 }
 
-float FontData::platformWidthForGlyph(Glyph glyph) const
+float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     NSFont* font = m_font.font();
     float pointSize = m_font.m_size;
@@ -297,7 +297,7 @@ float FontData::platformWidthForGlyph(Glyph glyph) const
     return advance.width + m_syntheticBoldOffset;
 }
 
-void FontData::checkShapesArabic() const
+void SimpleFontData::checkShapesArabic() const
 {
     ASSERT(!m_checkedShapesArabic);
 
index d71b75565750d9c8f12b784545d2cb631cea948d..0f8963d5ebe324b8884e83978561ff40694e74db 100644 (file)
 #include "config.h"
 #include "GlyphPageTreeNode.h"
 
-#include "FontData.h"
 #include "FontPlatformData.h"
+#include "SimpleFontData.h"
 #include <QFontDatabase>
 
 namespace WebCore {
 
-void GlyphPageTreeNode::pruneTreeCustomFontData(const FontData* fontData)
+void GlyphPageTreeNode::pruneTreeCustomFontData(const SimpleFontData* fontData)
 {
     QFontDatabase::removeApplicationFont(fontData->platformData().handle);
 }
similarity index 97%
rename from WebCore/platform/graphics/qt/FontDataQt.cpp
rename to WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
index 523f51ae7932c67fb2d3531fe45e7cd66b5f9235..0b7baaa08b27d58d58bd057703dcd30a2731d297 100644 (file)
@@ -20,7 +20,7 @@
     pages from the web. It has a memory cache for these objects.
 */
 #include "config.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
index 7bfff9838e6c957955fdbd599473ffbcef74ae5d..f4328a797706adb0066c64fa60cfff28204d245f 100644 (file)
@@ -29,8 +29,8 @@
 #include "config.h"
 #include <winsock2.h>
 #include "FontCache.h"
-#include "FontData.h"
 #include "Font.h"
+#include "SimpleFontData.h"
 #include "StringHash.h"
 #include <windows.h>
 #include <mlang.h>
@@ -114,11 +114,11 @@ static const Vector<String>* getLinkedFonts(String& family)
     return result;
 }
 
-const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
 {
-    FontData* fontData = 0;
+    SimpleFontData* fontData = 0;
     HDC hdc = GetDC(0);
-    HFONT primaryFont = font.primaryFont()->m_font.hfont();
+    HFONT primaryFont = font.primaryFont()->fontDataForCharacter(characters[0])->m_font.hfont();
     HGDIOBJ oldFont = SelectObject(hdc, primaryFont);
     HFONT hfont = 0;
 
index a2ae8440372946db36b3ce7171b563f8ee026be3..5b6609769ce78ed5a259a7fb79b19486e06eb579 100644 (file)
 #include "config.h"
 #include "Font.h"
 
-#include "FontData.h"
 #include "FontFallbackList.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
+#include "SimpleFontData.h"
 #include "UniscribeController.h"
 #include <ApplicationServices/ApplicationServices.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -41,7 +41,7 @@ namespace WebCore {
 
 const int syntheticObliqueAngle = 14;
 
-void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, const GlyphBuffer& glyphBuffer, 
+void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, 
                       int from, int numGlyphs, const FloatPoint& point) const
 {
     if (font->m_font.useGDI()) {
index 813da36a66ceab993aca1708c311ac3a79514d9d..23b756cf2f0d412a29170a3646f55d1860c5de5c 100644 (file)
  */
 
 #include "config.h"
-#include "FontData.h"
+#include "GlyphPageTreeNode.h"
 
+#include "SimpleFontData.h"
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontData)
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     // The bufferLength will be greater than the glyph page size if the buffer has Unicode supplementary characters.
     // We won't support this for now.
@@ -43,12 +44,12 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontD
     bool haveGlyphs = false;
     CGGlyph localGlyphBuffer[GlyphPage::size];
     wkGetGlyphs(fontData->platformData().cgFont(), buffer, localGlyphBuffer, bufferLength);
-    for (unsigned i = 0; i < GlyphPage::size; i++) {
+    for (unsigned i = 0; i < length; i++) {
         Glyph glyph = localGlyphBuffer[i];
         if (!glyph)
-            setGlyphDataForIndex(i, 0, 0);
+            setGlyphDataForIndex(offset + i, 0, 0);
         else {
-            setGlyphDataForIndex(i, glyph, fontData);
+            setGlyphDataForIndex(offset + i, glyph, fontData);
             haveGlyphs = true;
         }
     }
similarity index 92%
rename from WebCore/platform/graphics/win/FontDataWin.cpp
rename to WebCore/platform/graphics/win/SimpleFontDataWin.cpp
index 4399102a0a982949c62e274eaa3a89fa2570cf67..6714b46b6d837f349d6bbeee50132aac4a0d6d70 100644 (file)
  */
 
 #include "config.h"
+#include "SimpleFontData.h"
+
 #include <winsock2.h>
 #include "Font.h"
 #include "FontCache.h"
-#include "FontData.h"
 #include "FloatRect.h"
 #include "FontDescription.h"
 #include <wtf/MathExtras.h>
@@ -51,12 +52,12 @@ static bool shouldApplyMacAscentHack;
 
 static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return unitsPerEm ? x / (float)unitsPerEm : x; }
 
-void FontData::setShouldApplyMacAscentHack(bool b)
+void SimpleFontData::setShouldApplyMacAscentHack(bool b)
 {
     shouldApplyMacAscentHack = b;
 }
 
-void FontData::platformInit()
+void SimpleFontData::platformInit()
 {    
     m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f;
     m_scriptCache = 0;
@@ -145,7 +146,7 @@ void FontData::platformInit()
     }
 }
 
-void FontData::platformDestroy()
+void SimpleFontData::platformDestroy()
 {
     if (!isCustomFont()) {
         DeleteObject(m_font.hfont());
@@ -159,26 +160,26 @@ void FontData::platformDestroy()
     delete m_scriptFontProperties;
 }
 
-FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
+SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
 {
     if (!m_smallCapsFontData) {
         float smallCapsHeight = cSmallCapsFontSizeMultiplier * m_font.size();
         if (isCustomFont()) {
             FontPlatformData smallCapsFontData(m_font);
             smallCapsFontData.setSize(smallCapsHeight);
-            m_smallCapsFontData = new FontData(smallCapsFontData, true, false);
+            m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false);
         } else {
             LOGFONT winfont;
             GetObject(m_font.hfont(), sizeof(LOGFONT), &winfont);
             winfont.lfHeight = -lroundf(smallCapsHeight * (m_font.useGDI() ? 1 : 32));
             HFONT hfont = CreateFontIndirect(&winfont);
-            m_smallCapsFontData = new FontData(FontPlatformData(hfont, smallCapsHeight, fontDescription.bold(), fontDescription.italic(), m_font.useGDI()));
+            m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, fontDescription.bold(), fontDescription.italic(), m_font.useGDI()));
         }
     }
     return m_smallCapsFontData;
 }
 
-bool FontData::containsCharacters(const UChar* characters, int length) const
+bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
     // FIXME: Support custom fonts.
     if (isCustomFont())
@@ -214,7 +215,7 @@ bool FontData::containsCharacters(const UChar* characters, int length) const
     return true;
 }
 
-void FontData::determinePitch()
+void SimpleFontData::determinePitch()
 {
     if (isCustomFont()) {
         m_treatAsFixedPitch = false;
@@ -236,7 +237,7 @@ void FontData::determinePitch()
     ReleaseDC(0, dc);
 }
 
-float FontData::platformWidthForGlyph(Glyph glyph) const
+float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     if (m_font.useGDI()) {
         HDC hdc = GetDC(0);
@@ -258,7 +259,7 @@ float FontData::platformWidthForGlyph(Glyph glyph) const
     return advance.width + m_syntheticBoldOffset;
 }
 
-SCRIPT_FONTPROPERTIES* FontData::scriptFontProperties() const
+SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
 {
     if (!m_scriptFontProperties) {
         m_scriptFontProperties = new SCRIPT_FONTPROPERTIES;
index b7467b757ec86800d0c7f4046717ce3196ab350d..eb41c895bd5886fca5c782a3be8cdb55530e6f4c 100755 (executable)
@@ -29,9 +29,9 @@
 #include "config.h"
 #include "FontCache.h"
 #include "Font.h"
-#include "FontData.h"
 #include "FontPlatformData.h"
 #include "NotImplemented.h"
+#include "SimpleFontData.h"
 
 namespace WebCore {
 
@@ -39,10 +39,10 @@ void FontCache::platformInit()
 {
 }
 
-const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
 {
-    FontData* fontData = 0;
-    fontData = new FontData(FontPlatformData(font.fontDescription(), font.family().family()));
+    SimpleFontData* fontData = 0;
+    fontData = new SimpleFontData(FontPlatformData(font.fontDescription(), font.family().family()));
     return fontData;
 }
 
index 5817fe43bdefdf78dfcee94c30937d3c9e710297..7ec532ad7e06e3362a4e3eb8a2f5408a784c2e40 100644 (file)
 #include "config.h"
 #include "Font.h"
 
-#include "FontData.h"
 #include "FontFallbackList.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
+#include "SimpleFontData.h"
 
 #include "fontprops.h"
 #include <wx/defs.h>
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, const GlyphBuffer& glyphBuffer, 
+void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, 
                       int from, int numGlyphs, const FloatPoint& point) const
 {
     // prepare DC
index a48c75ad562985611fd98d44f9c5baea6d46b1cd..5213d6d4935d5d3c27adb425f2d597e4f87947dc 100755 (executable)
  */
 
 #include "config.h"
-#include "FontData.h"
 #include "GlyphPageTreeNode.h"
+
+#include "SimpleFontData.h"
 #include <unicode/utf16.h>
 
 namespace WebCore
 {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const FontData* fontData)
+bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     bool isUtf16 = bufferLength != GlyphPage::size;
 
similarity index 86%
rename from WebCore/platform/graphics/wx/FontDataWx.cpp
rename to WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
index f128785c23d2857d80126e2f8f7fb6e8fadb502f..7f375a3a411e3fda32e39ba254bb94f3d4cb2b91 100755 (executable)
@@ -27,7 +27,8 @@
  */
 
 #include "config.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
+
 #include "FontCache.h"
 #include "FloatRect.h"
 #include "FontDescription.h"
@@ -42,7 +43,7 @@
 namespace WebCore
 {
 
-void FontData::platformInit()
+void SimpleFontData::platformInit()
 {    
     wxFont* font = m_font.font();
     wxFontProperties props = wxFontProperties(font);
@@ -54,29 +55,29 @@ void FontData::platformInit()
     m_lineGap = props.GetLineGap();
 }
 
-void FontData::platformDestroy()
+void SimpleFontData::platformDestroy()
 {
     delete m_smallCapsFontData;
 }
 
-FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
+SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
 {
     if (!m_smallCapsFontData){
         FontDescription desc = FontDescription(fontDescription);
         desc.setSpecifiedSize(0.70f*fontDescription.computedSize());
         const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family());
-        m_smallCapsFontData = new FontData(*pdata);
+        m_smallCapsFontData = new SimpleFontData(*pdata);
     }
     return m_smallCapsFontData;
 }
 
-bool FontData::containsCharacters(const UChar* characters, int length) const
+bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
     // FIXME: We will need to implement this to load non-ASCII encoding sites
     return true;
 }
 
-void FontData::determinePitch()
+void SimpleFontData::determinePitch()
 {
     if (m_font.font() && m_font.font()->Ok())
         m_treatAsFixedPitch = m_font.font()->IsFixedWidth();
@@ -84,7 +85,7 @@ void FontData::determinePitch()
         m_treatAsFixedPitch = false;
 }
 
-float FontData::platformWidthForGlyph(Glyph glyph) const
+float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
     // TODO: fix this! Make GetTextExtents a method of wxFont in 2.9
     int width = 10;
index b6a73f2339750c25e405d77f7241aa99ef8dc7dc..e8f9159670a9bba07a1de249a6cac901d9123c94 100644 (file)
@@ -31,7 +31,7 @@
 #import "FileChooser.h"
 
 #import "Document.h"
-#import "FontData.h"
+#import "SimpleFontData.h"
 #import "Frame.h"
 #import "Icon.h"
 #import "LocalizedStrings.h"
index 7c7bc763d76e34729dfa21543d57dbbc7f31d2c0..0d6565b7e66bb34a6dc375324cc1536a32c7e413 100644 (file)
@@ -21,7 +21,7 @@
 #import "PopupMenu.h"
 
 #import "EventHandler.h"
-#import "FontData.h"
+#import "SimpleFontData.h"
 #import "Frame.h"
 #import "FrameView.h"
 #import "HTMLNames.h"
index f57f30c21eb4e72a2f05a06a053da5199db2ef10..51ddf8ea7d34356ef61dd877bf8acf131bc2db97 100644 (file)
@@ -27,7 +27,7 @@
 #import "WebCoreTextRenderer.h"
 
 #import "Font.h"
-#import "FontData.h"
+#import "SimpleFontData.h"
 #import "GraphicsContext.h"
 #import "IntPoint.h"
 #import "WebFontCache.h"
index 0726caf0793e875ab0a56bc7d1a78dc034387ae4..f2e4b7d80c5360fa83e5c1b4534900b993503455 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "Document.h"
 #include "FloatRect.h"
-#include "FontData.h"
 #include "FontSelector.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -35,6 +34,7 @@
 #include "PlatformScrollBar.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
+#include "SimpleFontData.h"
 #include <tchar.h>
 #include <windows.h>
 
index 877388525001f243ae966037ad3931e5a93c130f..938dc2c59f8573a76e0dc41f5a8ae94fb46d991a 100644 (file)
@@ -29,7 +29,7 @@
 #include "config.h"
 #include "UniscribeController.h"
 #include "Font.h"
-#include "FontData.h"
+#include "SimpleFontData.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -116,8 +116,8 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
     const UChar* curr = m_run.rtl() ? cp + length  - 1 : cp;
     const UChar* end = m_run.rtl() ? cp - 1 : cp + length;
 
-    const FontData* fontData;
-    const FontData* nextFontData = m_font.glyphDataForCharacter(*curr, false).fontData;
+    const SimpleFontData* fontData;
+    const SimpleFontData* nextFontData = m_font.glyphDataForCharacter(*curr, false).fontData;
 
     UChar newC;
 
@@ -160,7 +160,7 @@ void UniscribeController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
     }
 }
 
-void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const FontData* fontData, GlyphBuffer* glyphBuffer)
+void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
 {
     // ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1.  This is why there is an extra empty item
     // hanging out at the end of the array
@@ -199,7 +199,7 @@ void UniscribeController::resetControlAndState()
     m_state.fOverrideDirection = m_run.directionalOverride();
 }
 
-bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const FontData* fontData, GlyphBuffer* glyphBuffer)
+bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const SimpleFontData* fontData, GlyphBuffer* glyphBuffer)
 {
     // Determine the string for this item.
     const UChar* str = cp + m_items[i].iCharPos;
@@ -386,7 +386,7 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const F
     return true;
 }
 
-bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const FontData* fontData,
+bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,
                                 Vector<WORD>& glyphs, Vector<WORD>& clusters,
                                 Vector<SCRIPT_VISATTR>& visualAttributes)
 {
index b96606ab4d5d4e7527838b64b687ce835f6836e4..6ea45e160d49449cd97b549118ffb761345d1f11 100644 (file)
@@ -52,9 +52,9 @@ public:
 private:    
     void resetControlAndState();
 
-    void itemizeShapeAndPlace(const UChar*, unsigned length, const FontData*, GlyphBuffer*);
-    bool shapeAndPlaceItem(const UChar*, unsigned index, const FontData*, GlyphBuffer*);
-    bool shape(const UChar* str, int len, SCRIPT_ITEM item, const FontData* fontData,
+    void itemizeShapeAndPlace(const UChar*, unsigned length, const SimpleFontData*, GlyphBuffer*);
+    bool shapeAndPlaceItem(const UChar*, unsigned index, const SimpleFontData*, GlyphBuffer*);
+    bool shape(const UChar* str, int len, SCRIPT_ITEM item, const SimpleFontData* fontData,
                Vector<WORD>& glyphs, Vector<WORD>& clusters,
                Vector<SCRIPT_VISATTR>& visualAttributes);
 
index 1aa981d1fd60b804b653c80b3b50c253aa09c985..9604539e87dad17cbc528104292d61f048d9f100 100644 (file)
@@ -23,7 +23,6 @@
 #if ENABLE(SVG_FONTS)
 #include "Font.h"
 
-#include "FontData.h"
 #include "GraphicsContext.h"
 #include "RenderObject.h"
 #include "SVGGlyphElement.h"
index 53e61651568a19be36d201f1a6ef53da05904f13..a21450926713d291514a4ce9848c526f6720d220 100644 (file)
@@ -24,7 +24,6 @@
 #include "SVGFontElement.h"
 
 #include "Font.h"
-#include "FontData.h"
 #include "GlyphPageTreeNode.h"
 #include "SVGGlyphElement.h"
 #include "SVGMissingGlyphElement.h"
index e4652efb3e55f45cbdf061b680a76a2fc567b265..9a7f4978d35f8d24f5b2601a8dd85863b4111a39 100644 (file)
@@ -32,7 +32,6 @@
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
 #include "FontCache.h"
-#include "FontData.h"
 #include "FontPlatformData.h"
 #include "SVGDefinitionSrcElement.h"
 #include "SVGFontElement.h"
@@ -147,7 +146,7 @@ String SVGFontFaceElement::fontFamily() const
     return m_styleDeclaration->getPropertyValue(CSS_PROP_FONT_FAMILY);
 }
 
-FontData* SVGFontFaceElement::createFontData(const FontDescription& fontDescription) const
+SimpleFontData* SVGFontFaceElement::createFontData(const FontDescription& fontDescription) const
 {
     // We only expect to have this method called by a parent font element
     ASSERT(parentNode());
@@ -158,7 +157,7 @@ FontData* SVGFontFaceElement::createFontData(const FontDescription& fontDescript
     if (!cachedPlatformData)
         return 0;
 
-    OwnPtr<FontData> fontData(new FontData(*cachedPlatformData));
+    OwnPtr<SimpleFontData> fontData(new SimpleFontData(*cachedPlatformData));
 
     SVGFontData* svgFontData = new SVGFontData(const_cast<SVGFontFaceElement*>(this));
     fontData->m_svgFontData.set(svgFontData);
index 42446df45e1484d2483a40889a1d2b878184f8ed..b504454f8cf3250fe270d07cb19cf3427bf443d1 100644 (file)
@@ -28,8 +28,8 @@ namespace WebCore {
 
     class CSSFontFaceRule;
     class CSSMutableStyleDeclaration;
-    class FontData;
     class FontDescription;
+    class SimpleFontData;
     class SVGFontElement;
 
     class SVGFontFaceElement : public SVGElement {
@@ -46,7 +46,7 @@ namespace WebCore {
         String fontFamily() const;
 
         void rebuildFontFace();
-        FontData* createFontData(const FontDescription&) const;
+        SimpleFontData* createFontData(const FontDescription&) const;
 
         // If our parent element is <font>, it will be returned. (this is the case for a SVG Font described in the same document)
         // Otherwhise it will return the <font> element that is referenced by the first valid <font-face-src> element.
index 35f7cd5fa6349216d2729122b02cfb4e121bfe89..39d6380a803bcb6879e8a100f9fc316fe376a83a 100644 (file)
 #if ENABLE(SVG_FONTS)
 #include "SVGGlyphElement.h"
 
-#include "FontData.h"
 #include "SVGFontElement.h"
 #include "SVGFontFaceElement.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
+#include "SimpleFontData.h"
 #include "XMLNames.h"
 
 namespace WebCore {
index 10db4e4d269bb872a78f1b614c0d9ded306bf002..1d64a5c264b1d9cb715812002c8508e0a771f700 100644 (file)
@@ -1,3 +1,11 @@
+2008-01-07  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules
+
+        * Misc/WebNSAttributedStringExtras.mm:
+
 2008-01-03  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index f6661b3a67240b930113ce05fdda0068ec612241..04d907576b912666f1b8d44d601d83a3bda93817 100644 (file)
@@ -38,7 +38,6 @@
 #import <WebCore/CSSHelper.h>
 #import <WebCore/Document.h>
 #import <WebCore/Element.h>
-#import <WebCore/FontData.h>
 #import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/HTMLNames.h>
@@ -51,6 +50,7 @@
 #import <WebCore/RenderObject.h>
 #import <WebCore/RenderStyle.h>
 #import <WebCore/RenderText.h>
+#import <WebCore/SimpleFontData.h>
 #import <WebCore/Text.h>
 
 using namespace WebCore;
index 31c13b1b02bcc105fbe75a5234d2f3935d212472..706f9f1c2389e52b5f29a9c3389cb55ded8cac4b 100644 (file)
@@ -1,3 +1,12 @@
+2008-01-07  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - <rdar://problem/5665216> Support the unicode-range property in @font-face rules
+
+        * WebView.cpp:
+        (WebView::setShouldApplyMacFontAscentHack):
+
 2008-01-07  Holger Freyther  <zecke@selfish.org>
 
         Reviewed by Alp Toker.
index 650795d90481353c3b4a85cffbdd349be9e5127e..b1b7ab8bca8d127c1777699bf3c762393e3d6355 100644 (file)
@@ -65,7 +65,6 @@
 #include <WebCore/EventNames.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/FocusController.h>
-#include <WebCore/FontData.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/FrameTree.h>
 #include <WebCore/FrameView.h>
@@ -92,6 +91,7 @@
 #include <WebCore/ResourceHandleClient.h>
 #include <WebCore/SelectionController.h>
 #include <WebCore/Settings.h>
+#include <WebCore/SimpleFontData.h>
 #include <WebCore/TypingCommand.h>
 #pragma warning(pop)
 #include <JavaScriptCore/collector.h>
@@ -4270,7 +4270,7 @@ HRESULT WebView::setProhibitsMainFrameScrolling(BOOL b)
 
 HRESULT WebView::setShouldApplyMacFontAscentHack(BOOL b)
 {
-    FontData::setShouldApplyMacAscentHack(b);
+    SimpleFontData::setShouldApplyMacAscentHack(b);
     return S_OK;
 }