[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mitz at apple.com
mitz at apple.com
Wed Dec 22 11:48:41 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a5dcd1e66e7ab085f17dcd7b5b63d2f8c682c87b
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Aug 7 18:59:43 2010 +0000
Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
from SimpleFontData to FontPlatformData.
https://bugs.webkit.org/show_bug.cgi?id=43674
Reviewed by Anders Carlsson.
JavaScriptCore:
* wtf/Platform.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI here from WebCore/config.h.
WebCore:
* config.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI from here to wtf/Platform.h.
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData): Use new SimpleFontData constructor for SVG fonts.
* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::SimpleFontData): Separated into two constructors, one for
PlatformFontData-based fonts and one for SVG fonts.
* platform/graphics/SimpleFontData.h: Moved the m_CTFont member variable and the getCTFont()
accessor from here…
* platform/graphics/mac/FontPlatformData.h: …to here, renaming the latter ctFont().
* platform/graphics/mac/FontPlatformDataMac.mm:
(WebCore::FontPlatformData::FontPlatformData): Copy m_CTFont.
(WebCore::FontPlatformData::operator=): Copy m_CTFont.
(WebCore::FontPlatformData::setFont): Clear m_CTFont.
(WebCore::FontPlatformData::ctFont): Moved here from SimpleFontDataCoreText.cpp and renamed.
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::SimpleFontData::getCFStringAttributes): Updated to use FontPlatformData::ctFont().
* svg/SVGFontData.cpp:
(WebCore::SVGFontData::SVGFontData): Added an assertion.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 16162aa..0bc6f6a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-07 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
+ from SimpleFontData to FontPlatformData.
+ https://bugs.webkit.org/show_bug.cgi?id=43674
+
+ * wtf/Platform.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI here from WebCore/config.h.
+
2010-08-07 Zoltan Herczeg <zherczeg at webkit.org>
Reviewed by Eric Seidel.
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 9d8dbaa..f40f834 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -1032,8 +1032,17 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define WTF_USE_QXMLQUERY 1
#endif
-/* Accelerated compositing */
#if PLATFORM(MAC)
+/* Complex text framework */
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#define WTF_USE_ATSUI 0
+#define WTF_USE_CORE_TEXT 1
+#else
+#define WTF_USE_ATSUI 1
+#define WTF_USE_CORE_TEXT 0
+#endif
+
+/* Accelerated compositing */
#if !defined(BUILDING_ON_TIGER)
#define WTF_USE_ACCELERATED_COMPOSITING 1
#endif
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 388c15a..06b30da 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-08-07 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
+ from SimpleFontData to FontPlatformData.
+ https://bugs.webkit.org/show_bug.cgi?id=43674
+
+ * config.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI from here to wtf/Platform.h.
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::getFontData): Use new SimpleFontData constructor for SVG fonts.
+ * platform/graphics/SimpleFontData.cpp:
+ (WebCore::SimpleFontData::SimpleFontData): Separated into two constructors, one for
+ PlatformFontData-based fonts and one for SVG fonts.
+ * platform/graphics/SimpleFontData.h: Moved the m_CTFont member variable and the getCTFont()
+ accessor from here…
+ * platform/graphics/mac/FontPlatformData.h: …to here, renaming the latter ctFont().
+ * platform/graphics/mac/FontPlatformDataMac.mm:
+ (WebCore::FontPlatformData::FontPlatformData): Copy m_CTFont.
+ (WebCore::FontPlatformData::operator=): Copy m_CTFont.
+ (WebCore::FontPlatformData::setFont): Clear m_CTFont.
+ (WebCore::FontPlatformData::ctFont): Moved here from SimpleFontDataCoreText.cpp and renamed.
+ * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+ (WebCore::SimpleFontData::getCFStringAttributes): Updated to use FontPlatformData::ctFont().
+ * svg/SVGFontData.cpp:
+ (WebCore::SVGFontData::SVGFontData): Added an assertion.
+
2010-08-07 Adam Barth <abarth at webkit.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 68a671b..1c6d0f6 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1423,11 +1423,9 @@
7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; };
7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursor.cpp */; };
81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209211F4AB8D00915DFA /* IDBCursor.h */; };
81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */; };
- 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */; };
- 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209611F4AB8D00915DFA /* IDBCursorBackendInterface.h */; };
+ 81BE209911F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */; };
81BE20D211F4BC3200915DFA /* JSIDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */; };
81BE20D311F4BC3200915DFA /* JSIDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE20A811F4B66F00915DFA /* JSIDBCursor.h */; };
82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B658971189E39200E052A1 /* InspectorCSSStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7259,7 +7257,6 @@
7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; };
81BE209211F4AB8D00915DFA /* IDBCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursor.h; sourceTree = "<group>"; };
81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorBackendImpl.cpp; sourceTree = "<group>"; };
- 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendImpl.h; sourceTree = "<group>"; };
81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendInterface.h; sourceTree = "<group>"; };
81BE209C11F4ABBD00915DFA /* IDBCursor.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBCursor.idl; sourceTree = "<group>"; };
81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursor.cpp; sourceTree = "<group>"; };
@@ -10097,8 +10094,8 @@
B6566268120B115A006EA85C /* IDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransaction.h; sourceTree = "<group>"; };
B6566269120B115A006EA85C /* IDBTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransaction.idl; sourceTree = "<group>"; };
B656626D120B116B006EA85C /* IDBTransactionBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionBackendInterface.h; sourceTree = "<group>"; };
- B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIDBTransaction.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
- B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSIDBTransaction.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
+ B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
+ B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; };
@@ -11468,12 +11465,11 @@
C585A69911D4FB3D004C3E4B /* IDBAny.h */,
C585A69A11D4FB3D004C3E4B /* IDBAny.idl */,
C585A69B11D4FB3D004C3E4B /* IDBCallbacks.h */,
- 81BE209211F4AB8D00915DFA /* IDBCursor.cpp */,
+ 81BE209211F4AB8D00915DFA /* IDBCursor.h */,
81BE209211F4AB8D00915DFA /* IDBCursor.h */,
81BE209C11F4ABBD00915DFA /* IDBCursor.idl */,
81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */,
- 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */,
- 81BE209511F4AB8D00915DFA /* IDBCursorBackendInterface.h */,
+ 81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */,
C585A6A311D4FB3D004C3E4B /* IDBDatabase.cpp */,
C585A6A411D4FB3D004C3E4B /* IDBDatabase.h */,
C585A6A511D4FB3D004C3E4B /* IDBDatabase.idl */,
@@ -18715,8 +18711,7 @@
C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */,
C585A6CF11D4FB3D004C3E4B /* IDBCallbacks.h in Headers */,
81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */,
- 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */,
- 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */,
+ 81BE209911F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */,
C585A6D811D4FB3D004C3E4B /* IDBDatabase.h in Headers */,
B61762621203490800EF9114 /* IDBDatabaseBackendImpl.h in Headers */,
B61762541203374F00EF9114 /* IDBDatabaseBackendInterface.h in Headers */,
@@ -21165,7 +21160,7 @@
51E1ECC00C91C90400DC255B /* IconRecord.cpp in Sources */,
C585A6CC11D4FB3D004C3E4B /* IDBAny.cpp in Sources */,
C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */,
- 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */,
+ 81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */,
81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */,
B691C1F91206D4A00025D980 /* IDBDatabase.cpp in Sources */,
C585A6D511D4FB3D004C3E4B /* IDBDatabaseBackendImpl.cpp in Sources */,
diff --git a/WebCore/config.h b/WebCore/config.h
index 53b97d0..22e997b 100644
--- a/WebCore/config.h
+++ b/WebCore/config.h
@@ -155,15 +155,6 @@
#endif
#if PLATFORM(MAC)
-// ATSUI vs. CoreText
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-#define WTF_USE_ATSUI 0
-#define WTF_USE_CORE_TEXT 1
-#else
-#define WTF_USE_ATSUI 1
-#define WTF_USE_CORE_TEXT 0
-#endif
-
// New theme
#define WTF_USE_NEW_THEME 1
#endif // PLATFORM(MAC)
diff --git a/WebCore/css/CSSFontFaceSource.cpp b/WebCore/css/CSSFontFaceSource.cpp
index 16602c1..01b5569 100644
--- a/WebCore/css/CSSFontFaceSource.cpp
+++ b/WebCore/css/CSSFontFaceSource.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -153,8 +153,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
m_svgFontFaceElement = fontFaceElement;
}
- SVGFontData* svgFontData = new SVGFontData(fontFaceElement);
- fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.renderingMode()), true, false, svgFontData));
+ fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(fontFaceElement)), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic));
}
} else
#endif
@@ -168,10 +167,8 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
} else {
#if ENABLE(SVG_FONTS)
// In-Document SVG Fonts
- if (m_svgFontFaceElement) {
- SVGFontData* svgFontData = new SVGFontData(m_svgFontFaceElement);
- fontData.set(new SimpleFontData(FontPlatformData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic), true, false, svgFontData));
- }
+ if (m_svgFontFaceElement)
+ fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(m_svgFontFaceElement)), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic));
#endif
}
} else {
diff --git a/WebCore/platform/graphics/SimpleFontData.cpp b/WebCore/platform/graphics/SimpleFontData.cpp
index 1cc3b4c..7980643 100644
--- a/WebCore/platform/graphics/SimpleFontData.cpp
+++ b/WebCore/platform/graphics/SimpleFontData.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov
*
* Redistribution and use in source and binary forms, with or without
@@ -47,64 +47,66 @@ using namespace std;
namespace WebCore {
-SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
+SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading)
: m_maxCharWidth(-1)
, m_avgCharWidth(-1)
, m_unitsPerEm(defaultUnitsPerEm)
- , m_platformData(f)
+ , m_platformData(platformData)
, m_treatAsFixedPitch(false)
+ , m_isCustomFont(isCustomFont)
+ , m_isLoading(isLoading)
+ , m_smallCapsFontData(0)
+{
+ platformInit();
+ platformGlyphInit();
+ platformCharWidthInit();
+}
+
#if ENABLE(SVG_FONTS)
+SimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bool syntheticBold, bool syntheticItalic)
+ : m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic))
+ , m_treatAsFixedPitch(false)
, m_svgFontData(svgFontData)
-#endif
- , m_isCustomFont(customFont)
- , m_isLoading(loading)
+ , m_isCustomFont(true)
+ , m_isLoading(false)
, m_smallCapsFontData(0)
{
-#if !ENABLE(SVG_FONTS)
- UNUSED_PARAM(svgFontData);
-#else
- if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
- m_unitsPerEm = svgFontFaceElement->unitsPerEm();
+ SVGFontFaceElement* svgFontFaceElement = m_svgFontData->svgFontFaceElement();
+ m_unitsPerEm = svgFontFaceElement->unitsPerEm();
- double scale = f.size();
- if (m_unitsPerEm)
- scale /= m_unitsPerEm;
+ double scale = size;
+ if (m_unitsPerEm)
+ scale /= m_unitsPerEm;
- m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
- m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
- m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
- m_lineGap = 0.1f * f.size();
- m_lineSpacing = m_ascent + m_descent + m_lineGap;
+ m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
+ m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
+ m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
+ m_lineGap = 0.1f * size;
+ m_lineSpacing = m_ascent + m_descent + m_lineGap;
- SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
+ SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
- Vector<SVGGlyphIdentifier> spaceGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
- m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> spaceGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
+ m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
- Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
- m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
+ m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
- Vector<SVGGlyphIdentifier> letterWGlyphs;
- associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
- m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
+ Vector<SVGGlyphIdentifier> letterWGlyphs;
+ associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
+ m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
- // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
- m_spaceGlyph = 0;
- m_zeroWidthSpaceGlyph = 0;
- determinePitch();
- m_adjustedSpaceWidth = roundf(m_spaceWidth);
- m_missingGlyphData.fontData = this;
- m_missingGlyphData.glyph = 0;
- return;
- }
-#endif
-
- platformInit();
- platformGlyphInit();
- platformCharWidthInit();
+ // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
+ m_spaceGlyph = 0;
+ m_zeroWidthSpaceGlyph = 0;
+ determinePitch();
+ m_adjustedSpaceWidth = roundf(m_spaceWidth);
+ m_missingGlyphData.fontData = this;
+ m_missingGlyphData.glyph = 0;
}
+#endif
#if !PLATFORM(QT)
// Estimates of avgCharWidth and maxCharWidth for platforms that don't support accessing these values from the font.
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index ba959e4..62b9b40 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -1,7 +1,7 @@
/*
* This file is part of the internal font implementation.
*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007-2008 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -32,16 +32,12 @@
#include "TypesettingFeatures.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/RetainPtr.h>
#if USE(ATSUI)
typedef struct OpaqueATSUStyle* ATSUStyle;
#endif
-#if USE(CORE_TEXT)
-#include <ApplicationServices/ApplicationServices.h>
-#include <wtf/RetainPtr.h>
-#endif
-
#if (PLATFORM(WIN) && !OS(WINCE)) \
|| (OS(WINDOWS) && PLATFORM(WX))
#include <usp10.h>
@@ -62,7 +58,6 @@ typedef struct OpaqueATSUStyle* ATSUStyle;
namespace WebCore {
class FontDescription;
-class FontPlatformData;
class SharedBuffer;
class SVGFontData;
@@ -70,10 +65,12 @@ enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
class SimpleFontData : public FontData {
public:
- SimpleFontData(const FontPlatformData&, bool customFont = false, bool loading = false, SVGFontData* data = 0);
+ SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false);
+#if ENABLE(SVG_FONTS)
+ SimpleFontData(PassOwnPtr<SVGFontData>, int size, bool syntheticBold, bool syntheticItalic);
+#endif
virtual ~SimpleFontData();
-public:
const FontPlatformData& platformData() const { return m_platformData; }
SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) const;
@@ -131,7 +128,6 @@ public:
#endif
#if USE(CORE_TEXT)
- CTFontRef getCTFont() const;
CFDictionaryRef getCFStringAttributes(TypesettingFeatures) const;
#endif
@@ -236,7 +232,6 @@ private:
#endif
#if USE(CORE_TEXT)
- mutable RetainPtr<CTFontRef> m_CTFont;
mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
#endif
diff --git a/WebCore/platform/graphics/mac/FontPlatformData.h b/WebCore/platform/graphics/mac/FontPlatformData.h
index f4c92be..96c6efd 100644
--- a/WebCore/platform/graphics/mac/FontPlatformData.h
+++ b/WebCore/platform/graphics/mac/FontPlatformData.h
@@ -2,7 +2,7 @@
* This file is part of the internal font implementation.
* It should not be included by source files outside of it.
*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 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
@@ -114,6 +114,10 @@ class FontPlatformData {
NSFont *font() const { return m_font; }
void setFont(NSFont *font);
+#if USE(CORE_TEXT)
+ CTFontRef ctFont() const;
+#endif
+
bool roundsGlyphAdvances() const;
bool allowsLigatures() const;
bool isColorBitmapFont() const { return m_isColorBitmapFont; }
@@ -132,12 +136,17 @@ private:
static NSFont *hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); }
NSFont *m_font;
+
#ifndef BUILDING_ON_TIGER
RetainPtr<CGFontRef> m_cgFont;
#else
CGFontRef m_cgFont; // It is not necessary to refcount this, since either an NSFont owns it or some CachedFont has it referenced.
#endif
+#if USE(CORE_TEXT)
+ mutable RetainPtr<CTFontRef> m_CTFont;
+#endif
+
bool m_isColorBitmapFont;
};
diff --git a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
index aebd9f7..33de3c3 100644
--- a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
+++ b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm
@@ -61,6 +61,9 @@ FontPlatformData::FontPlatformData(const FontPlatformData& f)
m_cgFont = f.m_cgFont;
m_atsuFontID = f.m_atsuFontID;
m_isColorBitmapFont = f.m_isColorBitmapFont;
+#if USE(CORE_TEXT)
+ m_CTFont = f.m_CTFont;
+#endif
}
FontPlatformData:: ~FontPlatformData()
@@ -84,6 +87,9 @@ const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& f)
CFRelease(m_font);
m_font = f.m_font;
m_isColorBitmapFont = f.m_isColorBitmapFont;
+#if USE(CORE_TEXT)
+ m_CTFont = f.m_CTFont;
+#endif
return *this;
}
@@ -107,6 +113,9 @@ void FontPlatformData::setFont(NSFont *font)
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
m_isColorBitmapFont = CTFontGetSymbolicTraits(toCTFontRef(font)) & kCTFontColorGlyphsTrait;
#endif
+#if USE(CORE_TEXT)
+ m_CTFont = 0;
+#endif
}
bool FontPlatformData::roundsGlyphAdvances() const
@@ -119,6 +128,17 @@ bool FontPlatformData::allowsLigatures() const
return ![[m_font coveredCharacterSet] characterIsMember:'a'];
}
+#if USE(CORE_TEXT)
+CTFontRef FontPlatformData::ctFont() const
+{
+ if (m_font)
+ return toCTFontRef(m_font);
+ if (!m_CTFont)
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0));
+ return m_CTFont.get();
+}
+#endif // USE(CORE_TEXT)
+
#ifndef NDEBUG
String FontPlatformData::description() const
{
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
index fc67a19..4fb525f 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
+++ b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
@@ -41,15 +41,6 @@ using namespace std;
namespace WebCore {
-CTFontRef SimpleFontData::getCTFont() const
-{
- if (getNSFont())
- return toCTFontRef(getNSFont());
- if (!m_CTFont)
- m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_platformData.cgFont(), m_platformData.size(), 0, 0));
- return m_CTFont.get();
-}
-
CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const
{
unsigned key = typesettingFeatures + 1;
@@ -70,7 +61,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
static const float kerningAdjustmentValue = 0;
static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue);
static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
- const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures
+ const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures
? ligaturesAllowed : ligaturesNotAllowed };
attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled,
sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled),
@@ -78,7 +69,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
} else {
// By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning.
static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName };
- const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
+ const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled,
sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled),
&kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
diff --git a/WebCore/svg/SVGFontData.cpp b/WebCore/svg/SVGFontData.cpp
index fa67e96..a88de66 100644
--- a/WebCore/svg/SVGFontData.cpp
+++ b/WebCore/svg/SVGFontData.cpp
@@ -33,6 +33,7 @@ SVGFontData::SVGFontData(SVGFontFaceElement* fontFaceElement)
, m_verticalOriginY(fontFaceElement->verticalOriginY())
, m_verticalAdvanceY(fontFaceElement->verticalAdvanceY())
{
+ ASSERT_ARG(fontFaceElement, fontFaceElement);
}
SVGFontData::~SVGFontData()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list