Index: third_party/WebKit/WebCore/platform/graphics/SimpleFontData.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/platform/graphics/SimpleFontData.cpp (revision 8457) |
+++ third_party/WebKit/WebCore/platform/graphics/SimpleFontData.cpp (working copy) |
@@ -52,8 +52,6 @@ |
, m_isCustomFont(customFont) |
, m_isLoading(loading) |
, m_smallCapsFontData(0) |
- , m_zeroWidthFontData(new ZeroWidthFontData()) |
- , m_cjkWidthFontData(new CJKWidthFontData()) |
{ |
#if ENABLE(SVG_FONTS) |
if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) { |
@@ -80,8 +78,6 @@ |
determinePitch(); |
m_missingGlyphData.fontData = this; |
m_missingGlyphData.glyph = 0; |
- m_zeroWidthFontData->init(this); |
- m_cjkWidthFontData->init(this); |
return; |
} |
#endif |
@@ -102,8 +98,6 @@ |
determinePitch(); |
m_missingGlyphData.fontData = this; |
m_missingGlyphData.glyph = 0; |
- m_zeroWidthFontData->init(this); |
- m_cjkWidthFontData->init(this); |
return; |
} |
@@ -117,13 +111,6 @@ |
determinePitch(); |
m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(width) : roundf(width); |
- // TODO(dglazkov): Investigate and implement across platforms, if needed |
-#if PLATFORM(WIN_OS) |
- // ZERO WIDTH SPACES are explicitly mapped to share the glyph |
- // with SPACE (with width adjusted to 0) during GlyphPage::fill |
- // This is currently only implemented for Windows port. The FontData |
- // remapping may very well be needed for other platforms. |
-#else |
// Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE. |
// Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph. |
// See <http://bugs.webkit.org/show_bug.cgi?id=13178> |
@@ -136,26 +123,12 @@ |
else |
LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width not overridden."); |
} |
-#endif |
m_missingGlyphData.fontData = this; |
m_missingGlyphData.glyph = 0; |
- m_zeroWidthFontData->init(this); |
- m_cjkWidthFontData->init(this); |
} |
#endif |
-SimpleFontData::SimpleFontData() |
- : m_treatAsFixedPitch(false) |
-#if ENABLE(SVG_FONTS) |
- , m_svgFontData(0) |
-#endif |
- , m_isCustomFont(0) |
- , m_isLoading(0) |
- , m_smallCapsFontData(0) |
-{ |
-} |
- |
SimpleFontData::~SimpleFontData() |
{ |
if (!isCustomFont()) { |
@@ -194,78 +167,4 @@ |
return false; |
} |
-const SimpleFontData* SimpleFontData::zeroWidthFontData() const |
-{ |
- return m_zeroWidthFontData.get(); |
-} |
- |
-const SimpleFontData* SimpleFontData::cjkWidthFontData() const |
-{ |
- return m_cjkWidthFontData.get(); |
-} |
- |
-void ZeroWidthFontData::init(SimpleFontData* fontData) |
-{ |
- m_font = fontData->m_font; |
- m_smallCapsFontData = fontData->m_smallCapsFontData; |
- m_ascent = fontData->m_ascent; |
- m_descent = fontData->m_descent; |
- m_lineSpacing = fontData->m_lineSpacing; |
- m_lineGap = fontData->m_lineGap; |
- m_maxCharWidth = 0; |
- m_avgCharWidth = 0; |
- m_xHeight = fontData->m_xHeight; |
- m_unitsPerEm = fontData->m_unitsPerEm; |
- m_spaceWidth = 0; |
- m_spaceGlyph = 0; |
- m_adjustedSpaceWidth = fontData->m_adjustedSpaceWidth; |
-#if PLATFORM(WIN) |
- m_scriptCache = 0; |
- m_scriptFontProperties = 0; |
-#elif USE(ATSUI) |
- m_ATSUStyle = 0; |
- m_ATSUStyleInitialized = false; |
- m_ATSUMirrors = false; |
- m_checkedShapesArabic = false; |
- m_shapesArabic = false; |
-#endif |
-} |
- |
-CJKWidthFontData::CJKWidthFontData() |
- : m_cjkGlyphWidth(cGlyphWidthUnknown) |
-{ |
-} |
- |
-float CJKWidthFontData::widthForGlyph(Glyph glyph) const |
-{ |
- if (m_cjkGlyphWidth != cGlyphWidthUnknown) |
- return m_cjkGlyphWidth; |
- |
- float width = platformWidthForGlyph(glyph); |
- m_cjkGlyphWidth = width; |
- |
-#ifndef NDEBUG |
- // Test our optimization that assuming all CGK glyphs have the same width |
- const float actual_width = platformWidthForGlyph(glyph); |
- ASSERT((cGlyphWidthUnknown == width) || (actual_width == width)); |
-#endif |
- |
- return width; |
-} |
- |
-// static |
-// TODO(dglazkov): Move to Font::isCJKCodePoint for consistency |
-bool SimpleFontData::isCJKCodePoint(UChar32 c) |
-{ |
- // AC00..D7AF; Hangul Syllables |
- if ((0xAC00 <= c) && (c <= 0xD7AF)) |
- return true; |
- |
- // CJK ideographs |
- UErrorCode errorCode = U_ZERO_ERROR; // has to be initialized. |
- return uscript_getScript(c, &errorCode) == USCRIPT_HAN && |
- U_SUCCESS(errorCode); |
-} |
- |
- |
} // namespace WebCore |