[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
mitz at apple.com
mitz at apple.com
Wed Jan 20 22:18:23 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit a4e25465c82169a44bd052f3113f9139fddaf777
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 9 18:45:06 2010 +0000
<rdar://problem/7525778> Font fallback kills SVG kerning
https://bugs.webkit.org/show_bug.cgi?id=33400
Reviewed by Nikolas Zimmermann.
WebCore:
Test: platform/mac/fast/text/sticky-typesetting-features.html
Cache font attributes separately for different typesetting features.
* platform/graphics/SimpleFontData.h: Replaced single-element caches
with maps.
* platform/graphics/mac/ComplexTextControllerATSUI.cpp:
(WebCore::disableLigatures): Added an ATSUStyle parameter.
(WebCore::initializeATSUStyle): Look up the ATSUStyle in the map and
initialize if necessary. Return the ATSUStyle.
(WebCore::ComplexTextController::collectComplexTextRunsForCharactersATSUI):
Use the ATSUStyle returned from initializeATSUStyle().
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformInit):
(WebCore::SimpleFontData::platformDestroy): Destroy the ATSUStyles in the
map.
(WebCore::SimpleFontData::getCFStringAttributes): Look up the attributes
dictionary in the map and initialize if necessary.
LayoutTests:
* platform/mac/fast/text/sticky-typesetting-features-expected.checksum: Added.
* platform/mac/fast/text/sticky-typesetting-features-expected.png: Added.
* platform/mac/fast/text/sticky-typesetting-features-expected.txt: Added.
* platform/mac/fast/text/sticky-typesetting-features.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ce64036..e279a85 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-09 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ <rdar://problem/7525778> Font fallback kills SVG kerning
+ https://bugs.webkit.org/show_bug.cgi?id=33400
+
+ * platform/mac/fast/text/sticky-typesetting-features-expected.checksum: Added.
+ * platform/mac/fast/text/sticky-typesetting-features-expected.png: Added.
+ * platform/mac/fast/text/sticky-typesetting-features-expected.txt: Added.
+ * platform/mac/fast/text/sticky-typesetting-features.html: Added.
+
2010-01-08 Simon Fraser <simon.fraser at apple.com>
No review.
diff --git a/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.checksum b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.checksum
new file mode 100644
index 0000000..66b2ee7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.checksum
@@ -0,0 +1 @@
+53f164b9b8cd1455b7e3e249c6353a4c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png
new file mode 100644
index 0000000..094d7f4
Binary files /dev/null and b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.txt b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.txt
new file mode 100644
index 0000000..5a406a4
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 344x18
+ text run at (0,0) width 344: "This should be rendered without kerning and ligatures:"
+ RenderBlock {DIV} at (0,34) size 784x166
+ RenderText {#text} at (0,0) size 772x166
+ text run at (0,0) width 772: "Office\x{301} Today"
+ RenderBlock {P} at (0,216) size 784x18
+ RenderText {#text} at (0,0) size 324x18
+ text run at (0,0) width 324: "This should be rendered with kerning and ligatures:"
+ RenderBlock {DIV} at (0,250) size 784x166
+ RenderText {#text} at (0,0) size 754x166
+ text run at (0,0) width 754: "Office Today"
diff --git a/LayoutTests/platform/mac/fast/text/sticky-typesetting-features.html b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features.html
new file mode 100644
index 0000000..a2d3669
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features.html
@@ -0,0 +1,12 @@
+<p>
+ This should be rendered without kerning and ligatures:
+</p>
+<div style="font-size: 144px;">
+ Officé Today
+</div>
+<p>
+ This should be rendered with kerning and ligatures:
+</p>
+<div style="font-size: 144px; text-rendering: optimizelegibility">
+ Office Today
+</div>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e41b74a..173ea2b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-01-09 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ <rdar://problem/7525778> Font fallback kills SVG kerning
+ https://bugs.webkit.org/show_bug.cgi?id=33400
+
+ Test: platform/mac/fast/text/sticky-typesetting-features.html
+
+ Cache font attributes separately for different typesetting features.
+
+ * platform/graphics/SimpleFontData.h: Replaced single-element caches
+ with maps.
+ * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
+ (WebCore::disableLigatures): Added an ATSUStyle parameter.
+ (WebCore::initializeATSUStyle): Look up the ATSUStyle in the map and
+ initialize if necessary. Return the ATSUStyle.
+ (WebCore::ComplexTextController::collectComplexTextRunsForCharactersATSUI):
+ Use the ATSUStyle returned from initializeATSUStyle().
+ * platform/graphics/mac/SimpleFontDataMac.mm:
+ (WebCore::SimpleFontData::platformInit):
+ (WebCore::SimpleFontData::platformDestroy): Destroy the ATSUStyles in the
+ map.
+ (WebCore::SimpleFontData::getCFStringAttributes): Look up the attributes
+ dictionary in the map and initialize if necessary.
+
2010-01-08 Adam Barth <abarth at webkit.org>
Unreviewed. Fix namespace indent for SecurityOrigin.h.
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index 1ee158d..09ed0fc 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -211,8 +211,7 @@ private:
#if USE(ATSUI)
public:
- mutable ATSUStyle m_ATSUStyle;
- mutable bool m_ATSUStyleInitialized;
+ mutable HashMap<unsigned, ATSUStyle> m_ATSUStyleMap;
mutable bool m_ATSUMirrors;
mutable bool m_checkedShapesArabic;
mutable bool m_shapesArabic;
@@ -222,7 +221,7 @@ private:
#if USE(CORE_TEXT)
mutable RetainPtr<CTFontRef> m_CTFont;
- mutable RetainPtr<CFDictionaryRef> m_CFStringAttributes;
+ mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
#endif
#if PLATFORM(WIN)
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index c8aae87..48aa174 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -257,7 +257,7 @@ static bool fontHasMirroringInfo(ATSUFontID fontID)
return false;
}
-static void disableLigatures(const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures)
+static void disableLigatures(const SimpleFontData* fontData, ATSUStyle atsuStyle, TypesettingFeatures typesettingFeatures)
{
// Don't be too aggressive: if the font doesn't contain 'a', then assume that any ligatures it contains are
// in characters that always go through ATSUI, and therefore allow them. Geeza Pro is an example.
@@ -267,23 +267,27 @@ static void disableLigatures(const SimpleFontData* fontData, TypesettingFeatures
ATSUFontFeatureType featureTypes[] = { kLigaturesType };
ATSUFontFeatureSelector featureSelectors[] = { kCommonLigaturesOffSelector };
- OSStatus status = ATSUSetFontFeatures(fontData->m_ATSUStyle, 1, featureTypes, featureSelectors);
+ OSStatus status = ATSUSetFontFeatures(atsuStyle, 1, featureTypes, featureSelectors);
if (status != noErr)
LOG_ERROR("ATSUSetFontFeatures failed (%d) -- ligatures remain enabled", static_cast<int>(status));
}
-static void initializeATSUStyle(const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures)
+static ATSUStyle initializeATSUStyle(const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures)
{
- if (fontData->m_ATSUStyleInitialized)
- return;
+ unsigned key = typesettingFeatures + 1;
+ pair<HashMap<unsigned, ATSUStyle>::iterator, bool> addResult = fontData->m_ATSUStyleMap.add(key, 0);
+ ATSUStyle& atsuStyle = addResult.first->second;
+ if (!addResult.second)
+ return atsuStyle;
ATSUFontID fontID = fontData->platformData().m_atsuFontID;
if (!fontID) {
LOG_ERROR("unable to get ATSUFontID for %p", fontData->platformData().font());
- return;
+ fontData->m_ATSUStyleMap.remove(addResult.first);
+ return 0;
}
- OSStatus status = ATSUCreateStyle(&fontData->m_ATSUStyle);
+ OSStatus status = ATSUCreateStyle(&atsuStyle);
if (status != noErr)
LOG_ERROR("ATSUCreateStyle failed (%d)", static_cast<int>(status));
@@ -296,15 +300,14 @@ static void initializeATSUStyle(const SimpleFontData* fontData, TypesettingFeatu
ATSUAttributeValuePtr styleValues[4] = { &fontSize, &fontID, &verticalFlip, &kerningInhibitFactor };
bool allowKerning = typesettingFeatures & Kerning;
- status = ATSUSetAttributes(fontData->m_ATSUStyle, allowKerning ? 3 : 4, styleTags, styleSizes, styleValues);
+ status = ATSUSetAttributes(atsuStyle, allowKerning ? 3 : 4, styleTags, styleSizes, styleValues);
if (status != noErr)
LOG_ERROR("ATSUSetAttributes failed (%d)", static_cast<int>(status));
fontData->m_ATSUMirrors = fontHasMirroringInfo(fontID);
- disableLigatures(fontData, typesettingFeatures);
-
- fontData->m_ATSUStyleInitialized = true;
+ disableLigatures(fontData, atsuStyle, typesettingFeatures);
+ return atsuStyle;
}
void ComplexTextController::collectComplexTextRunsForCharactersATSUI(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
@@ -318,13 +321,13 @@ void ComplexTextController::collectComplexTextRunsForCharactersATSUI(const UChar
if (m_fallbackFonts && fontData != m_font.primaryFont())
m_fallbackFonts->add(fontData);
- initializeATSUStyle(fontData, m_font.typesettingFeatures());
+ ATSUStyle atsuStyle = initializeATSUStyle(fontData, m_font.typesettingFeatures());
OSStatus status;
ATSUTextLayout atsuTextLayout;
UniCharCount runLength = length;
- status = ATSUCreateTextLayoutWithTextPtr(cp, 0, length, length, 1, &runLength, &fontData->m_ATSUStyle, &atsuTextLayout);
+ status = ATSUCreateTextLayoutWithTextPtr(cp, 0, length, length, 1, &runLength, &atsuStyle, &atsuTextLayout);
if (status != noErr) {
LOG_ERROR("ATSUCreateTextLayoutWithTextPtr failed with error %d", static_cast<int>(status));
return;
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index 0c496a4..ef7c58f 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -148,7 +148,6 @@ void SimpleFontData::platformInit()
m_styleGroup = 0;
#endif
#if USE(ATSUI)
- m_ATSUStyleInitialized = false;
m_ATSUMirrors = false;
m_checkedShapesArabic = false;
m_shapesArabic = false;
@@ -317,8 +316,9 @@ void SimpleFontData::platformDestroy()
wkReleaseStyleGroup(m_styleGroup);
#endif
#if USE(ATSUI)
- if (m_ATSUStyleInitialized)
- ATSUDisposeStyle(m_ATSUStyle);
+ HashMap<unsigned, ATSUStyle>::iterator end = m_ATSUStyleMap.end();
+ for (HashMap<unsigned, ATSUStyle>::iterator it = m_ATSUStyleMap.begin(); it != end; ++it)
+ ATSUDisposeStyle(it->second);
#endif
}
@@ -446,8 +446,11 @@ CTFontRef SimpleFontData::getCTFont() const
CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const
{
- if (m_CFStringAttributes)
- return m_CFStringAttributes.get();
+ unsigned key = typesettingFeatures + 1;
+ pair<HashMap<unsigned, RetainPtr<CFDictionaryRef> >::iterator, bool> addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>());
+ RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.first->second;
+ if (!addResult.second)
+ return attributesDictionary.get();
bool allowLigatures = platformData().allowsLigatures() || (typesettingFeatures & Ligatures);
@@ -463,19 +466,19 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures
? ligaturesAllowed : ligaturesNotAllowed };
- m_CFStringAttributes.adoptCF(CFDictionaryCreate(NULL, keysWithKerningDisabled, valuesWithKerningDisabled,
+ attributesDictionary.adoptCF(CFDictionaryCreate(NULL, keysWithKerningDisabled, valuesWithKerningDisabled,
sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled),
&kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
} 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 };
- m_CFStringAttributes.adoptCF(CFDictionaryCreate(NULL, keysWithKerningEnabled, valuesWithKerningEnabled,
+ attributesDictionary.adoptCF(CFDictionaryCreate(NULL, keysWithKerningEnabled, valuesWithKerningEnabled,
sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled),
&kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
}
- return m_CFStringAttributes.get();
+ return attributesDictionary.get();
}
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list