Changeset 80582 in webkit
- Timestamp:
- Mar 8, 2011 12:53:58 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80579 r80582 1 2011-03-08 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48540, support the text-orientation CSS property. 6 7 This patch adds support for two values of the text-orientation property (the ones that actually matter): vertical-right and upright. 8 The TextOrientation is part of the FontDescription and used to look up fonts (similar to FontOrientation). 9 10 Orientation of non-CJK characters is done using fallback font data of the appropriate orientation type, e.g., verticalRightOrientation and 11 uprightOrientation fallback font data. Vertical right is just implemented as a normal horizontal font. Upright is implemented as a 12 vertically oriented font that rotates all glyphs. 13 14 The main complication implementing text-orientation is that fonts have "baked-in" vertical glyphs for letters that are hardcoded to 15 a vertical right facing. This means that you can use those special vertical glyphs for vertical-right orientation without having to 16 fall back, but then for upright orientation you have to ignore them and still fall back. As you can see from the test case, this doesn't 17 work very well, but hopefully it won't be all that common. Limitations of CoreText prevent this case from rendering properly in either the 18 simple or complex code paths, although the simple code path at least gets close. 19 20 Added fast/blockflow/text-orientation-basic.html 21 22 * fast/blockflow/text-orientation-basic.html: Added. 23 * platform/mac/fast/blockflow/text-orientation-basic-expected.checksum: Added. 24 * platform/mac/fast/blockflow/text-orientation-basic-expected.png: Added. 25 * platform/mac/fast/blockflow/text-orientation-basic-expected.txt: Added. 26 1 27 2011-03-08 Nico Weber <thakis@chromium.org> 2 28 -
trunk/Source/WebCore/ChangeLog
r80580 r80582 1 2011-03-08 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48540, support the text-orientation CSS property. 6 7 This patch adds support for two values of the text-orientation property (the ones that actually matter): vertical-right and upright. 8 The TextOrientation is part of the FontDescription and used to look up fonts (similar to FontOrientation). 9 10 Orientation of non-CJK characters is done using fallback font data of the appropriate orientation type, e.g., verticalRightOrientation and 11 uprightOrientation fallback font data. Vertical right is just implemented as a normal horizontal font. Upright is implemented as a 12 vertically oriented font that rotates all glyphs. 13 14 The main complication implementing text-orientation is that fonts have "baked-in" vertical glyphs for letters that are hardcoded to 15 a vertical right facing. This means that you can use those special vertical glyphs for vertical-right orientation without having to 16 fall back, but then for upright orientation you have to ignore them and still fall back. As you can see from the test case, this doesn't 17 work very well, but hopefully it won't be all that common. Limitations of CoreText prevent this case from rendering properly in either the 18 simple or complex code paths, although the simple code path at least gets close. 19 20 Added fast/blockflow/text-orientation-basic.html 21 22 * WebCore.exp.in: 23 * WebCore.xcodeproj/project.pbxproj: 24 * css/CSSComputedStyleDeclaration.cpp: 25 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 26 * css/CSSFontFaceSource.cpp: 27 (WebCore::CSSFontFaceSource::getFontData): 28 * css/CSSParser.cpp: 29 (WebCore::CSSParser::parseValue): 30 * css/CSSPrimitiveValueMappings.h: 31 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 32 (WebCore::CSSPrimitiveValue::operator TextOrientation): 33 * css/CSSPropertyNames.in: 34 * css/CSSStyleSelector.cpp: 35 (WebCore::CSSStyleSelector::applyDeclarations): 36 (WebCore::CSSStyleSelector::applyProperty): 37 * css/CSSValueKeywords.in: 38 * loader/cache/CachedFont.cpp: 39 (WebCore::CachedFont::platformDataFromCustomData): 40 * loader/cache/CachedFont.h: 41 * platform/graphics/FontCache.cpp: 42 (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey): 43 (WebCore::FontPlatformDataCacheKey::operator==): 44 (WebCore::computeHash): 45 (WebCore::FontCache::getCachedFontPlatformData): 46 * platform/graphics/FontDescription.h: 47 (WebCore::FontDescription::FontDescription): 48 (WebCore::FontDescription::textOrientation): 49 (WebCore::FontDescription::setTextOrientation): 50 (WebCore::FontDescription::operator==): 51 * platform/graphics/FontFastPath.cpp: 52 (WebCore::Font::glyphDataForCharacter): 53 (WebCore::offsetToMiddleOfGlyph): 54 * platform/graphics/SimpleFontData.cpp: 55 (WebCore::SimpleFontData::SimpleFontData): 56 (WebCore::SimpleFontData::verticalRightOrientationFontData): 57 (WebCore::SimpleFontData::uprightOrientationFontData): 58 (WebCore::SimpleFontData::brokenIdeographFontData): 59 (WebCore::SimpleFontData::DerivedFontData::~DerivedFontData): 60 * platform/graphics/SimpleFontData.h: 61 (WebCore::SimpleFontData::hasVerticalGlyphs): 62 (WebCore::SimpleFontData::isTextOrientationFallback): 63 * platform/graphics/cairo/FontCustomPlatformData.h: 64 * platform/graphics/cocoa/FontPlatformData.h: 65 (WebCore::FontPlatformData::FontPlatformData): 66 (WebCore::FontPlatformData::textOrientation): 67 (WebCore::FontPlatformData::hash): 68 (WebCore::FontPlatformData::operator==): 69 * platform/graphics/cocoa/FontPlatformDataCocoa.mm: 70 (WebCore::FontPlatformData::FontPlatformData): 71 (WebCore::FontPlatformData::operator=): 72 * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: 73 (WebCore::FontCustomPlatformData::fontPlatformData): 74 * platform/graphics/haiku/FontCustomPlatformData.cpp: 75 (WebCore::FontCustomPlatformData::fontPlatformData): 76 * platform/graphics/haiku/FontCustomPlatformData.h: 77 * platform/graphics/mac/ComplexTextControllerCoreText.cpp: 78 (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): 79 * platform/graphics/mac/FontCacheMac.mm: 80 (WebCore::FontCache::createFontPlatformData): 81 * platform/graphics/mac/FontCustomPlatformData.cpp: 82 (WebCore::FontCustomPlatformData::fontPlatformData): 83 * platform/graphics/mac/FontCustomPlatformData.h: 84 * platform/graphics/mac/FontMac.mm: 85 (WebCore::showGlyphsWithAdvances): 86 (WebCore::Font::drawGlyphs): 87 * platform/graphics/mac/GlyphPageTreeNodeMac.cpp: 88 (WebCore::shouldUseCoreText): 89 (WebCore::GlyphPage::fill): 90 * platform/graphics/mac/SimpleFontDataCoreText.cpp: 91 (WebCore::SimpleFontData::getCFStringAttributes): 92 * platform/graphics/mac/SimpleFontDataMac.mm: 93 (WebCore::SimpleFontData::platformInit): 94 (WebCore::SimpleFontData::platformBoundsForGlyph): 95 (WebCore::SimpleFontData::platformWidthForGlyph): 96 * platform/graphics/pango/FontCustomPlatformDataPango.cpp: 97 (WebCore::FontCustomPlatformData::fontPlatformData): 98 * platform/graphics/qt/FontCustomPlatformData.h: 99 * platform/graphics/qt/FontCustomPlatformDataQt.cpp: 100 (WebCore::FontCustomPlatformData::fontPlatformData): 101 * platform/graphics/skia/FontCustomPlatformData.cpp: 102 (WebCore::FontCustomPlatformData::fontPlatformData): 103 * platform/graphics/skia/FontCustomPlatformData.h: 104 * platform/graphics/win/FontCustomPlatformData.cpp: 105 (WebCore::FontCustomPlatformData::fontPlatformData): 106 * platform/graphics/win/FontCustomPlatformData.h: 107 * platform/graphics/win/FontCustomPlatformDataCairo.cpp: 108 (WebCore::FontCustomPlatformData::fontPlatformData): 109 * platform/graphics/win/FontCustomPlatformDataCairo.h: 110 * platform/graphics/wince/FontCustomPlatformData.cpp: 111 (WebCore::FontCustomPlatformData::fontPlatformData): 112 * platform/graphics/wince/FontCustomPlatformData.h: 113 * platform/text/TextOrientation.h: Added. 114 * rendering/InlineFlowBox.cpp: 115 (WebCore::InlineFlowBox::requiresIdeographicBaseline): 116 * rendering/style/RenderStyle.h: 117 (WebCore::InheritedFlags::initialTextOrientation): 118 1 119 2011-03-08 Ryosuke Niwa <rniwa@webkit.org> 2 120 -
trunk/Source/WebCore/WebCore.exp.in
r80559 r80582 422 422 __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd 423 423 __ZN7WebCore16FontFallbackList15releaseFontDataEv 424 __ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationENS_1 6FontWidthVariantE424 __ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationENS_15TextOrientationENS_16FontWidthVariantE 425 425 __ZN7WebCore16FontPlatformDataD1Ev 426 426 __ZN7WebCore16HTMLInputElement13setAutofilledEb -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r80536 r80582 5162 5162 BCD0FBD00DBD625E00B2F630 /* DOMAbstractView.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD0FBCF0DBD625E00B2F630 /* DOMAbstractView.mm */; }; 5163 5163 BCD0FC4F0DBD720B00B2F630 /* DOMRGBColorInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD0FC4E0DBD720B00B2F630 /* DOMRGBColorInternal.h */; }; 5164 BCD3F9831326C93700098A60 /* TextOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD3F9821326C93700098A60 /* TextOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5164 5165 BCD41ABB0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */; }; 5165 5166 BCD533640ED6848900887468 /* CachedScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */; }; … … 11549 11550 BCD0FBCF0DBD625E00B2F630 /* DOMAbstractView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMAbstractView.mm; sourceTree = "<group>"; }; 11550 11551 BCD0FC4E0DBD720B00B2F630 /* DOMRGBColorInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRGBColorInternal.h; sourceTree = "<group>"; }; 11552 BCD3F9821326C93700098A60 /* TextOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextOrientation.h; sourceTree = "<group>"; }; 11551 11553 BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameSetElementCustom.cpp; sourceTree = "<group>"; }; 11552 11554 BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedScriptSourceProvider.h; sourceTree = "<group>"; }; … … 17677 17679 B2C3DA180D006C1D00EF6F26 /* TextEncodingRegistry.cpp */, 17678 17680 B2C3DA190D006C1D00EF6F26 /* TextEncodingRegistry.h */, 17681 BCD3F9821326C93700098A60 /* TextOrientation.h */, 17679 17682 B2C3DA1A0D006C1D00EF6F26 /* TextStream.cpp */, 17680 17683 B2C3DA1B0D006C1D00EF6F26 /* TextStream.h */, … … 22569 22572 598D77DF132541FA00761B22 /* JavaArrayJSC.h in Headers */, 22570 22573 598D77E31325420E00761B22 /* JavaFieldJSC.h in Headers */, 22574 BCD3F9831326C93700098A60 /* TextOrientation.h in Headers */, 22571 22575 ); 22572 22576 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r80463 r80582 229 229 CSSPropertyWebkitTextEmphasisStyle, 230 230 CSSPropertyWebkitTextFillColor, 231 CSSPropertyWebkitTextOrientation, 231 232 CSSPropertyWebkitTextSecurity, 232 233 CSSPropertyWebkitTextStrokeColor, … … 1634 1635 case CSSPropertyWebkitTextCombine: 1635 1636 return primitiveValueCache->createValue(style->textCombine()); 1637 case CSSPropertyWebkitTextOrientation: 1638 return CSSPrimitiveValue::create(style->fontDescription().textOrientation()); 1636 1639 1637 1640 case CSSPropertyContent: -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r77153 r80582 116 116 117 117 // See if we have a mapping in our FontData cache. 118 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); 118 unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 6 | fontDescription.widthVariant() << 4 119 | (fontDescription.textOrientation() == TextOrientationUpright ? 8 : 0) | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); 119 120 if (SimpleFontData* cachedData = m_fontDataTable.get(hashKey)) 120 121 return cachedData; … … 163 164 return 0; 164 165 165 fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); 166 fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), 167 fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); 166 168 } 167 169 } else { -
trunk/Source/WebCore/css/CSSParser.cpp
r80463 r80582 1832 1832 case CSSPropertyWebkitTextEmphasisStyle: 1833 1833 return parseTextEmphasisStyle(important); 1834 1835 case CSSPropertyWebkitTextOrientation: 1836 // FIXME: For now just support upright and vertical-right. 1837 if (id == CSSValueVerticalRight || id == CSSValueUpright) 1838 validPrimitive = true; 1839 break; 1834 1840 1835 1841 #if ENABLE(SVG) -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r74098 r80582 40 40 #include "SVGRenderStyleDefs.h" 41 41 #include "TextDirection.h" 42 #include "TextOrientation.h" 42 43 #include "TextRenderingMode.h" 43 44 #include "ThemeTypes.h" … … 2178 2179 } 2179 2180 2181 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e) 2182 : m_type(CSS_IDENT) 2183 , m_hasCachedCSSText(false) 2184 { 2185 switch (e) { 2186 case TextOrientationVerticalRight: 2187 m_value.ident = CSSValueVerticalRight; 2188 break; 2189 case TextOrientationUpright: 2190 m_value.ident = CSSValueUpright; 2191 break; 2192 } 2193 } 2194 2195 template<> inline CSSPrimitiveValue::operator TextOrientation() const 2196 { 2197 switch (m_value.ident) { 2198 case CSSValueVerticalRight: 2199 return TextOrientationVerticalRight; 2200 case CSSValueUpright: 2201 return TextOrientationUpright; 2202 default: 2203 ASSERT_NOT_REACHED(); 2204 return TextOrientationVerticalRight; 2205 } 2206 } 2207 2180 2208 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e) 2181 2209 : m_type(CSS_IDENT) -
trunk/Source/WebCore/css/CSSPropertyNames.in
r80438 r80582 22 22 text-rendering 23 23 -webkit-font-smoothing 24 -webkit-text-orientation 24 25 -webkit-text-size-adjust 25 26 -webkit-writing-mode -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r80438 r80582 3407 3407 if (applyFirst) { 3408 3408 COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); 3409 COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 1 3, CSS_zoom_is_end_of_first_prop_range);3409 COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 14, CSS_zoom_is_end_of_first_prop_range); 3410 3410 COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom); 3411 3411 … … 6208 6208 return; 6209 6209 6210 case CSSPropertyWebkitTextOrientation: { 6211 if (!isInherit && !isInitial && !primitiveValue) 6212 return; 6213 6214 TextOrientation result; 6215 if (isInherit) 6216 result = m_parentStyle->fontDescription().textOrientation(); 6217 else if (isInitial) 6218 result = RenderStyle::initialTextOrientation(); 6219 else 6220 result = *primitiveValue; 6221 6222 FontDescription fontDescription = m_style->fontDescription(); 6223 if (fontDescription.textOrientation() != result) { 6224 fontDescription.setTextOrientation(result); 6225 if (m_style->setFontDescription(fontDescription)) 6226 m_fontDirty = true; 6227 } 6228 return; 6229 } 6230 6210 6231 #if ENABLE(SVG) 6211 6232 default: -
trunk/Source/WebCore/css/CSSValueKeywords.in
r74915 r80582 791 791 # contain 792 792 # cover 793 794 # -webkit-text-orientation 795 upright 796 vertical-right -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r77153 r80582 118 118 } 119 119 120 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)120 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, TextOrientation textOrientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode) 121 121 { 122 122 #if ENABLE(SVG_FONTS) … … 126 126 #ifdef STORE_FONT_CUSTOM_PLATFORM_DATA 127 127 ASSERT(m_fontData); 128 return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);128 return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, textOrientation, widthVariant, renderingMode); 129 129 #else 130 130 return FontPlatformData(); -
trunk/Source/WebCore/loader/cache/CachedFont.h
r77153 r80582 31 31 #include "FontRenderingMode.h" 32 32 #include "FontWidthVariant.h" 33 #include "TextOrientation.h" 33 34 #include <wtf/Vector.h> 34 35 … … 65 66 66 67 bool ensureCustomFontData(); 67 FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);68 FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 68 69 69 70 #if ENABLE(SVG_FONTS) -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r79402 r80582 58 58 public: 59 59 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false, 60 bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal, FontWidthVariant widthVariant = RegularWidth) 60 bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal, 61 TextOrientation textOrientation = TextOrientationVerticalRight, FontWidthVariant widthVariant = RegularWidth) 61 62 : m_size(size) 62 63 , m_weight(weight) … … 66 67 , m_renderingMode(renderingMode) 67 68 , m_orientation(orientation) 69 , m_textOrientation(textOrientation) 68 70 , m_widthVariant(widthVariant) 69 71 { … … 77 79 return equalIgnoringCase(m_family, other.m_family) && m_size == other.m_size && 78 80 m_weight == other.m_weight && m_italic == other.m_italic && m_printerFont == other.m_printerFont && 79 m_renderingMode == other.m_renderingMode && m_orientation == other.m_orientation && m_ widthVariant == other.m_widthVariant;81 m_renderingMode == other.m_renderingMode && m_orientation == other.m_orientation && m_textOrientation == other.m_textOrientation && m_widthVariant == other.m_widthVariant; 80 82 } 81 83 … … 87 89 FontRenderingMode m_renderingMode; 88 90 FontOrientation m_orientation; 91 TextOrientation m_textOrientation; 89 92 FontWidthVariant m_widthVariant; 90 93 … … 100 103 fontKey.m_weight, 101 104 fontKey.m_widthVariant, 102 static_cast<unsigned>(fontKey.m_ orientation) << 3 | static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode)105 static_cast<unsigned>(fontKey.m_textOrientation) << 4 | static_cast<unsigned>(fontKey.m_orientation) << 3 | static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode) 103 106 }; 104 107 return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes); … … 199 202 200 203 FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription.weight(), fontDescription.italic(), 201 fontDescription.usePrinterFont(), fontDescription.renderingMode(), fontDescription.orientation(), fontDescription.widthVariant()); 204 fontDescription.usePrinterFont(), fontDescription.renderingMode(), fontDescription.orientation(), 205 fontDescription.textOrientation(), fontDescription.widthVariant()); 202 206 FontPlatformData* result = 0; 203 207 bool foundResult; -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r77153 r80582 32 32 #include "FontTraitsMask.h" 33 33 #include "FontWidthVariant.h" 34 #include "TextOrientation.h" 34 35 #include "TextRenderingMode.h" 35 36 … … 59 60 , m_computedSize(0) 60 61 , m_orientation(Horizontal) 62 , m_textOrientation(TextOrientationVerticalRight) 61 63 , m_widthVariant(RegularWidth) 62 64 , m_italic(false) … … 100 102 bool isSpecifiedFont() const { return m_isSpecifiedFont; } 101 103 FontOrientation orientation() const { return m_orientation; } 104 TextOrientation textOrientation() const { return m_textOrientation; } 102 105 FontWidthVariant widthVariant() const { return m_widthVariant; } 103 106 … … 121 124 void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; } 122 125 void setOrientation(FontOrientation orientation) { m_orientation = orientation; } 126 void setTextOrientation(TextOrientation textOrientation) { m_textOrientation = textOrientation; } 123 127 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; } 124 128 … … 130 134 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor. 131 135 132 FontOrientation m_orientation; 133 136 FontOrientation m_orientation; // Whether the font is rendering on a horizontal line or a vertical line. 137 TextOrientation m_textOrientation; // Only used by vertical text. Determines the default orientation for non-ideograph glyphs. 138 134 139 FontWidthVariant m_widthVariant; 135 140 … … 170 175 && m_isSpecifiedFont == other.m_isSpecifiedFont 171 176 && m_orientation == other.m_orientation 177 && m_textOrientation == other.m_textOrientation 172 178 && m_widthVariant == other.m_widthVariant; 173 179 } -
trunk/Source/WebCore/platform/graphics/FontFastPath.cpp
r78846 r80582 78 78 if (page) { 79 79 GlyphData data = page->glyphDataForCharacter(c); 80 if (data.fontData && (data.fontData->platformData().orientation() == Horizontal || data.fontData->isTextOrientationFallback())) 81 return data; 82 80 83 if (data.fontData) { 81 if (data.fontData->platformData().orientation() == Vertical && data.fontData->orientation() == Horizontal && Font::isCJKIdeographOrSymbol(c)) { 82 const SimpleFontData* ideographFontData = data.fontData->brokenIdeographFontData(); 83 GlyphPageTreeNode* ideographNode = GlyphPageTreeNode::getRootChild(ideographFontData, pageNumber); 84 const GlyphPage* ideographPage = ideographNode->page(); 85 if (ideographPage) { 86 GlyphData data = ideographPage->glyphDataForCharacter(c); 87 if (data.fontData) 88 return data; 84 if (isCJKIdeographOrSymbol(c)) { 85 if (!data.fontData->hasVerticalGlyphs()) { 86 // Use the broken ideograph font data. The broken ideograph font will use the horizontal width of glyphs 87 // to make sure you get a square (even for broken glyphs like symbols used for punctuation). 88 const SimpleFontData* brokenIdeographFontData = data.fontData->brokenIdeographFontData(); 89 GlyphPageTreeNode* brokenIdeographNode = GlyphPageTreeNode::getRootChild(brokenIdeographFontData, pageNumber); 90 const GlyphPage* brokenIdeographPage = brokenIdeographNode->page(); 91 if (brokenIdeographPage) { 92 GlyphData brokenIdeographData = brokenIdeographPage->glyphDataForCharacter(c); 93 if (brokenIdeographData.fontData) 94 return brokenIdeographData; 95 } 96 97 // Shouldn't be possible to even reach this point. 98 ASSERT_NOT_REACHED(); 99 return data; 89 100 } 90 101 } else { 102 if (m_fontDescription.textOrientation() == TextOrientationVerticalRight) { 103 const SimpleFontData* verticalRightFontData = data.fontData->verticalRightOrientationFontData(); 104 GlyphPageTreeNode* verticalRightNode = GlyphPageTreeNode::getRootChild(verticalRightFontData, pageNumber); 105 const GlyphPage* verticalRightPage = verticalRightNode->page(); 106 if (verticalRightPage) { 107 GlyphData verticalRightData = verticalRightPage->glyphDataForCharacter(c); 108 // If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked 109 // into it. 110 if (data.glyph != verticalRightData.glyph) 111 return data; 112 // The glyphs are identical, meaning that we should just use the horizontal glyph. 113 if (verticalRightData.fontData) 114 return verticalRightData; 115 } 116 } else if (m_fontDescription.textOrientation() == TextOrientationUpright) { 117 const SimpleFontData* uprightFontData = data.fontData->uprightOrientationFontData(); 118 GlyphPageTreeNode* uprightNode = GlyphPageTreeNode::getRootChild(uprightFontData, pageNumber); 119 const GlyphPage* uprightPage = uprightNode->page(); 120 if (uprightPage) { 121 GlyphData uprightData = uprightPage->glyphDataForCharacter(c); 122 // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright. 123 if (data.glyph == uprightData.glyph) 124 return data; 125 // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that 126 // glyph, so we fall back to the upright data and use the horizontal glyph. 127 if (uprightData.fontData) 128 return uprightData; 129 } 130 } 131 91 132 // Shouldn't be possible to even reach this point. 92 133 ASSERT_NOT_REACHED(); 134 return data; 93 135 } 94 return data;95 136 } 96 137 … … 365 406 inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph) 366 407 { 367 if (fontData-> orientation() == Horizontal) {408 if (fontData->platformData().orientation() == Horizontal) { 368 409 FloatRect bounds = fontData->boundsForGlyph(glyph); 369 410 return bounds.x() + bounds.width() / 2; -
trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp
r78846 r80582 48 48 namespace WebCore { 49 49 50 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading )50 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback) 51 51 : m_maxCharWidth(-1) 52 52 , m_avgCharWidth(-1) 53 , m_orientation(platformData.orientation())54 53 , m_platformData(platformData) 55 54 , m_treatAsFixedPitch(false) 56 55 , m_isCustomFont(isCustomFont) 57 56 , m_isLoading(isLoading) 58 , m_isBrokenIdeographFont(false) 57 , m_isTextOrientationFallback(isTextOrientationFallback) 58 , m_isBrokenIdeographFallback(false) 59 , m_hasVerticalGlyphs(false) 59 60 { 60 61 platformInit(); … … 65 66 #if ENABLE(SVG_FONTS) 66 67 SimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bool syntheticBold, bool syntheticItalic) 67 : m_orientation(Horizontal) 68 , m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic)) 68 : m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic)) 69 69 , m_treatAsFixedPitch(false) 70 70 , m_svgFontData(svgFontData) 71 71 , m_isCustomFont(true) 72 72 , m_isLoading(false) 73 , m_isBrokenIdeographFont(false) 73 , m_isTextOrientationFallback(false) 74 , m_isBrokenIdeographFallback(false) 75 , m_hasVerticalGlyphs(false) 74 76 { 75 77 SVGFontFaceElement* svgFontFaceElement = m_svgFontData->svgFontFaceElement(); … … 203 205 } 204 206 207 SimpleFontData* SimpleFontData::verticalRightOrientationFontData() const 208 { 209 if (!m_derivedFontData) 210 m_derivedFontData = DerivedFontData::create(isCustomFont()); 211 if (!m_derivedFontData->verticalRightOrientation) { 212 FontPlatformData verticalRightPlatformData(m_platformData); 213 verticalRightPlatformData.m_orientation = Horizontal; 214 m_derivedFontData->verticalRightOrientation = new SimpleFontData(verticalRightPlatformData, isCustomFont(), false, true); 215 } 216 return m_derivedFontData->verticalRightOrientation.get(); 217 } 218 219 SimpleFontData* SimpleFontData::uprightOrientationFontData() const 220 { 221 if (!m_derivedFontData) 222 m_derivedFontData = DerivedFontData::create(isCustomFont()); 223 if (!m_derivedFontData->uprightOrientation) 224 m_derivedFontData->uprightOrientation = new SimpleFontData(m_platformData, isCustomFont(), false, true); 225 return m_derivedFontData->uprightOrientation.get(); 226 } 227 205 228 SimpleFontData* SimpleFontData::brokenIdeographFontData() const 206 229 { … … 209 232 if (!m_derivedFontData->brokenIdeograph) { 210 233 m_derivedFontData->brokenIdeograph = new SimpleFontData(m_platformData, isCustomFont(), false); 211 m_derivedFontData->brokenIdeograph->m_orientation = Vertical; 212 m_derivedFontData->brokenIdeograph->m_isBrokenIdeographFont = true; 234 m_derivedFontData->brokenIdeograph->m_isBrokenIdeographFallback = true; 213 235 } 214 236 return m_derivedFontData->brokenIdeograph.get(); … … 243 265 if (brokenIdeograph) 244 266 GlyphPageTreeNode::pruneTreeCustomFontData(brokenIdeograph.get()); 267 if (verticalRightOrientation) 268 GlyphPageTreeNode::pruneTreeCustomFontData(verticalRightOrientation.get()); 269 if (uprightOrientation) 270 GlyphPageTreeNode::pruneTreeCustomFontData(uprightOrientation.get()); 245 271 } 246 272 -
trunk/Source/WebCore/platform/graphics/SimpleFontData.h
r78846 r80582 72 72 class SimpleFontData : public FontData { 73 73 public: 74 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false );74 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false); 75 75 #if ENABLE(SVG_FONTS) 76 76 SimpleFontData(PassOwnPtr<SVGFontData>, int size, bool syntheticBold, bool syntheticItalic); … … 98 98 } 99 99 100 SimpleFontData* verticalRightOrientationFontData() const; 101 SimpleFontData* uprightOrientationFontData() const; 100 102 SimpleFontData* brokenIdeographFontData() const; 101 102 // FIXME: Use the actual metrics for fonts with vertical tables instead of just hard-coding. If the font is horizontally oriented or103 // a broken ideographic font, then just hard-code to split ascent/descent down the middle. Otherwise we should actually use the metrics104 // from the font itself. 103 104 bool hasVerticalGlyphs() const { return m_hasVerticalGlyphs; } 105 bool isTextOrientationFallback() const { return m_isTextOrientationFallback; } 106 105 107 const FontMetrics& fontMetrics() const { return m_fontMetrics; } 106 108 float maxCharWidth() const { return m_maxCharWidth; } … … 138 140 virtual bool isSegmented() const; 139 141 140 bool isBrokenIdeographFont() const { return m_isBrokenIdeographFont; }141 142 142 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } 143 143 … … 153 153 154 154 #if PLATFORM(MAC) || USE(CORE_TEXT) 155 CFDictionaryRef getCFStringAttributes(TypesettingFeatures ) const;155 CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; 156 156 #endif 157 157 … … 184 184 #endif 185 185 186 FontOrientation orientation() const { return m_orientation; }187 188 186 private: 189 187 void platformInit(); … … 210 208 float m_avgCharWidth; 211 209 212 FontOrientation m_orientation; // This is our supported orientation according to the tables in the font. FontPlatformData will just always have the desired orientation.213 // This value represents what we actually support.214 215 210 FontPlatformData m_platformData; 216 211 … … 226 221 bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face 227 222 bool m_isLoading; // Whether or not this custom font is still in the act of loading. 228 bool m_isBrokenIdeographFont; 229 223 224 bool m_isTextOrientationFallback; 225 bool m_isBrokenIdeographFallback; 226 bool m_hasVerticalGlyphs; 227 230 228 Glyph m_spaceGlyph; 231 229 float m_spaceWidth; … … 243 241 OwnPtr<SimpleFontData> emphasisMark; 244 242 OwnPtr<SimpleFontData> brokenIdeograph; 243 OwnPtr<SimpleFontData> verticalRightOrientation; 244 OwnPtr<SimpleFontData> uprightOrientation; 245 245 246 246 private: -
trunk/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
r77153 r80582 26 26 #include "FontRenderingMode.h" 27 27 #include "FontWidthVariant.h" 28 #include "TextOrientation.h" 28 29 #include <wtf/Forward.h> 29 30 #include <wtf/Noncopyable.h> … … 42 43 FontCustomPlatformData(FT_Face, SharedBuffer*); 43 44 ~FontCustomPlatformData(); 44 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);45 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 45 46 static bool supportsFormat(const String&); 46 47 -
trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformData.h
r77153 r80582 27 27 #include "FontOrientation.h" 28 28 #include "FontWidthVariant.h" 29 #include "TextOrientation.h" 29 30 #include <wtf/text/StringImpl.h> 30 31 … … 61 62 class FontPlatformData { 62 63 public: 63 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation = Horizontal, FontWidthVariant widthVariant = RegularWidth) 64 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation = Horizontal, 65 TextOrientation textOrientation = TextOrientationVerticalRight, FontWidthVariant widthVariant = RegularWidth) 64 66 : m_syntheticBold(syntheticBold) 65 67 , m_syntheticOblique(syntheticOblique) 66 68 , m_orientation(orientation) 69 , m_textOrientation(textOrientation) 67 70 , m_size(size) 68 71 , m_widthVariant(widthVariant) … … 75 78 } 76 79 77 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 80 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, 81 TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth); 78 82 79 FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant) 83 FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, 84 TextOrientation textOrientation, FontWidthVariant widthVariant) 80 85 : m_syntheticBold(syntheticBold) 81 86 , m_syntheticOblique(syntheticOblique) 82 87 , m_orientation(orientation) 88 , m_textOrientation(textOrientation) 83 89 , m_size(size) 84 90 , m_widthVariant(widthVariant) … … 100 106 bool syntheticOblique() const { return m_syntheticOblique; } 101 107 FontOrientation orientation() const { return m_orientation; } 108 TextOrientation textOrientation() const { return m_textOrientation; } 102 109 FontWidthVariant widthVariant() const { return m_widthVariant; } 103 110 … … 105 112 bool m_syntheticOblique; 106 113 FontOrientation m_orientation; 114 TextOrientation m_textOrientation; 107 115 108 116 float m_size; … … 113 121 { 114 122 ASSERT(m_font != 0 || m_cgFont == 0); 115 uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, m_ orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique };123 uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, m_textOrientation << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique }; 116 124 return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes); 117 125 } … … 121 129 bool operator==(const FontPlatformData& other) const 122 130 { 123 return m_font == other.m_font && m_syntheticBold == other.m_syntheticBold && m_syntheticOblique == other.m_syntheticOblique && 124 m_cgFont == other.m_cgFont && m_size == other.m_size && m_orientation == other.m_orientation && m_widthVariant == other.m_widthVariant; 131 return m_font == other.m_font && m_syntheticBold == other.m_syntheticBold && m_syntheticOblique == other.m_syntheticOblique 132 && m_cgFont == other.m_cgFont && m_size == other.m_size && m_orientation == other.m_orientation 133 && m_textOrientation == other.m_textOrientation && m_widthVariant == other.m_widthVariant; 125 134 } 126 135 -
trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
r77153 r80582 46 46 #endif // PLATFORM(MAC) 47 47 48 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant) 48 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, 49 TextOrientation textOrientation, FontWidthVariant widthVariant) 49 50 : m_syntheticBold(syntheticBold) 50 51 , m_syntheticOblique(syntheticOblique) 52 , m_orientation(orientation) 53 , m_textOrientation(textOrientation) 51 54 , m_size(size) 52 55 , m_widthVariant(widthVariant) … … 65 68 loadFont(nsFont, size, m_font, cgFont); 66 69 67 m_orientation = orientation;68 69 70 if (m_font) 70 71 CFRetain(m_font); … … 88 89 m_isColorBitmapFont = f.m_isColorBitmapFont; 89 90 m_orientation = f.m_orientation; 91 m_textOrientation = f.m_textOrientation; 90 92 m_CTFont = f.m_CTFont; 91 93 #if PLATFORM(CHROMIUM) && OS(DARWIN) … … 116 118 m_isColorBitmapFont = f.m_isColorBitmapFont; 117 119 m_orientation = f.m_orientation; 120 m_textOrientation = f.m_textOrientation; 118 121 m_CTFont = f.m_CTFont; 119 122 #if PLATFORM(CHROMIUM) && OS(DARWIN) -
trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
r77153 r80582 60 60 } 61 61 62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode) 63 63 { 64 64 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
r77153 r80582 32 32 } 33 33 34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode) 35 35 { 36 36 return FontPlatformData(size, bold, italic); -
trunk/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
r77153 r80582 25 25 #include "FontRenderingMode.h" 26 26 #include "FontWidthVariant.h" 27 #include "TextOrientation.h" 27 28 #include <wtf/Forward.h> 28 29 … … 40 41 static bool supportsFormat(const String&); 41 42 42 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);43 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 43 44 }; 44 45 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
r76674 r80582 149 149 #else 150 150 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); 151 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures() )));151 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation()))); 152 152 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); 153 153 #endif … … 155 155 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))); 156 156 } else { 157 ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures() ) };157 ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation()) }; 158 158 159 159 line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info)); -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r77153 r80582 212 212 bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); 213 213 214 return new FontPlatformData(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription. widthVariant());214 return new FontPlatformData(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.textOrientation(), fontDescription.widthVariant()); 215 215 } 216 216 -
trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
r77153 r80582 39 39 } 40 40 41 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode)41 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, TextOrientation textOrientation, FontWidthVariant widthVariant, FontRenderingMode) 42 42 { 43 return FontPlatformData(m_cgFont, size, bold, italic, orientation, widthVariant);43 return FontPlatformData(m_cgFont, size, bold, italic, orientation, textOrientation, widthVariant); 44 44 } 45 45 -
trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
r77153 r80582 25 25 #include "FontRenderingMode.h" 26 26 #include "FontWidthVariant.h" 27 #include "TextOrientation.h" 27 28 #include <CoreFoundation/CFBase.h> 28 29 #include <wtf/Forward.h> … … 49 50 ~FontCustomPlatformData(); 50 51 51 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);52 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 52 53 53 54 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/mac/FontMac.mm
r76743 r80582 53 53 } 54 54 55 static void showGlyphsWithAdvances(const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count) 56 { 55 static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count) 56 { 57 CGContextSetTextPosition(context, point.x(), point.y()); 58 57 59 const FontPlatformData& platformData = font->platformData(); 58 60 if (!platformData.isColorBitmapFont()) { 59 61 CGAffineTransform savedMatrix; 60 bool isVertical = font->orientation() == Vertical; 61 62 bool isVertical = font->platformData().orientation() == Vertical; 62 63 if (isVertical) { 63 64 CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0); 64 65 65 savedMatrix = CGContextGetTextMatrix(context); 66 66 CGAffineTransform runMatrix = CGAffineTransformConcat(savedMatrix, rotateLeftTransform); 67 // Move start point to put glyphs into original region.68 runMatrix.tx = savedMatrix.tx + font->fontMetrics().ascent();69 runMatrix.ty = savedMatrix.ty + font->fontMetrics().descent();70 67 CGContextSetTextMatrix(context, runMatrix); 71 } 72 73 CGContextShowGlyphsWithAdvances(context, glyphs, advances, count); 74 75 if (isVertical) 68 69 CGAffineTransform translationsTransform = CGAffineTransformMake(platformData.m_size, 0, 0, platformData.m_size, 0, 0); 70 translationsTransform = CGAffineTransformConcat(translationsTransform, rotateLeftTransform); 71 CGFloat unitsPerEm = CGFontGetUnitsPerEm(platformData.cgFont()); 72 translationsTransform = CGAffineTransformConcat(translationsTransform, CGAffineTransformMakeScale(1 / unitsPerEm, 1 / unitsPerEm)); 73 74 Vector<CGSize, 256> translations(count); 75 CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count); 76 77 CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context)); 78 79 CGPoint position = FloatPoint(point.x(), point.y() + font->fontMetrics().floatAscent(IdeographicBaseline) - font->fontMetrics().floatAscent()); 80 Vector<CGPoint, 256> positions(count); 81 for (size_t i = 0; i < count; ++i) { 82 CGSize translation = CGSizeApplyAffineTransform(translations[i], translationsTransform); 83 positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform); 84 position.x += advances[i].width; 85 position.y += advances[i].height; 86 } 87 CGContextShowGlyphsAtPositions(context, glyphs, positions.data(), count); 76 88 CGContextSetTextMatrix(context, savedMatrix); 89 } else 90 CGContextShowGlyphsWithAdvances(context, glyphs, advances, count); 77 91 } 78 92 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) … … 189 203 // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative. 190 204 float shadowTextY = point.y() + shadowOffset.height() * (context->shadowsIgnoreTransforms() ? -1 : 1); 191 CGContextSetTextPosition(cgContext, shadowTextX, shadowTextY); 192 showGlyphsWithAdvances(font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 193 if (font->syntheticBoldOffset()) { 194 CGContextSetTextPosition(cgContext, shadowTextX + font->syntheticBoldOffset(), shadowTextY); 195 showGlyphsWithAdvances(font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 196 } 205 showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 206 if (font->syntheticBoldOffset()) 207 showGlyphsWithAdvances(FloatPoint(shadowTextX + font->syntheticBoldOffset(), shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 197 208 context->setFillColor(fillColor, fillColorSpace); 198 209 } 199 210 200 CGContextSetTextPosition(cgContext, point.x(), point.y()); 201 showGlyphsWithAdvances(font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 202 if (font->syntheticBoldOffset()) { 203 CGContextSetTextPosition(cgContext, point.x() + font->syntheticBoldOffset(), point.y()); 204 showGlyphsWithAdvances(font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 205 } 211 showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 212 if (font->syntheticBoldOffset()) 213 showGlyphsWithAdvances(FloatPoint(point.x() + font->syntheticBoldOffset(), point.y()), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); 206 214 207 215 if (hasSimpleShadow) -
trunk/Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
r80414 r80582 40 40 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) 41 41 { 42 if (fontData->platformData().widthVariant() != RegularWidth || (fontData->orientation() == Vertical && !fontData->isBrokenIdeographFont())) {42 if (fontData->platformData().widthVariant() != RegularWidth || fontData->hasVerticalGlyphs()) { 43 43 // Ideographs don't have a vertical variant or width variants. 44 44 for (unsigned i = 0; i < bufferLength; ++i) { … … 71 71 // We ask CoreText for possible vertical variant glyphs 72 72 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buffer, bufferLength, kCFAllocatorNull)); 73 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0 )));73 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0, fontData->hasVerticalGlyphs() ? Vertical : Horizontal))); 74 74 RetainPtr<CTLineRef> line(AdoptCF, CTLineCreateWithAttributedString(attributedString.get())); 75 75 -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
r72498 r80582 40 40 namespace WebCore { 41 41 42 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures ) const42 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const 43 43 { 44 44 unsigned key = typesettingFeatures + 1; … … 47 47 if (!addResult.second) 48 48 return attributesDictionary.get(); 49 50 bool treatLineAsVertical = orientation == Vertical; 49 51 50 bool allowLigatures = ( orientation() == Horizontal && platformData().allowsLigatures()) || (typesettingFeatures & Ligatures);52 bool allowLigatures = (!treatLineAsVertical && platformData().allowsLigatures()) || (typesettingFeatures & Ligatures); 51 53 52 54 static const int ligaturesNotAllowedValue = 0; … … 61 63 static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; 62 64 const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures 63 ? ligaturesAllowed : ligaturesNotAllowed, orientation() ==Vertical ? kCFBooleanTrue : kCFBooleanFalse };65 ? ligaturesAllowed : ligaturesNotAllowed, treatLineAsVertical ? kCFBooleanTrue : kCFBooleanFalse }; 64 66 attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled, 65 67 WTF_ARRAY_LENGTH(keysWithKerningDisabled), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); … … 67 69 // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning. 68 70 static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; 69 const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, orientation() ==Vertical ? kCFBooleanTrue : kCFBooleanFalse };71 const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, treatLineAsVertical ? kCFBooleanTrue : kCFBooleanFalse }; 70 72 attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled, 71 73 WTF_ARRAY_LENGTH(keysWithKerningEnabled), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r77530 r80582 260 260 } 261 261 262 if (m_orientation == Vertical) { 263 // Ignore vertical orientation when the font doesn't support vertical metrics. 262 if (platformData().orientation() == Vertical && !isTextOrientationFallback()) { 264 263 // The check doesn't look neat but this is what AppKit does for vertical writing... 265 264 RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(m_platformData.ctFont(), kCTFontTableOptionExcludeSynthetic)); 266 265 CFIndex numTables = CFArrayGetCount(tableTags.get()); 267 bool found = false;268 266 for (CFIndex index = 0; index < numTables; ++index) { 269 267 CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index); 270 268 if (tag == kCTFontTableVhea || tag == kCTFontTableVORG) { 271 found= true;269 m_hasVerticalGlyphs = true; 272 270 break; 273 271 } 274 272 } 275 276 if (found == false)277 m_orientation = Horizontal;278 273 } 279 274 … … 476 471 FloatRect boundingBox; 477 472 #ifndef BUILDING_ON_TIGER 478 boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), 479 orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1); 473 boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1); 480 474 boundingBox.setY(-boundingBox.maxY()); 481 475 #else … … 495 489 { 496 490 CGSize advance; 497 if ( orientation() == Horizontal || m_isBrokenIdeographFont) {491 if (platformData().orientation() == Horizontal || m_isBrokenIdeographFallback) { 498 492 NSFont* font = platformData().font(); 499 493 float pointSize = platformData().m_size; -
trunk/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp
r77153 r80582 31 31 } 32 32 33 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)33 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode) 34 34 { 35 35 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h
r77153 r80582 26 26 #include "FontRenderingMode.h" 27 27 #include "FontWidthVariant.h" 28 #include "TextOrientation.h" 28 29 #include <wtf/FastAllocBase.h> 29 30 #include <wtf/Forward.h> … … 44 45 int m_handle; 45 46 46 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 47 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, 48 FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 47 49 48 50 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
r77153 r80582 35 35 } 36 36 37 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)37 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode) 38 38 { 39 39 QFont font; -
trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
r79174 r80582 66 66 } 67 67 68 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant, FontRenderingMode mode) 68 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, 69 TextOrientation, FontWidthVariant, FontRenderingMode mode) 69 70 { 70 71 #if OS(WINDOWS) -
trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h
r77153 r80582 36 36 #include "FontRenderingMode.h" 37 37 #include "FontWidthVariant.h" 38 #include "TextOrientation.h" 38 39 #include <wtf/Forward.h> 39 40 #include <wtf/Noncopyable.h> … … 67 68 ~FontCustomPlatformData(); 68 69 69 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth,70 Font RenderingMode = NormalRenderingMode);70 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, 71 FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 71 72 72 73 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
r77153 r80582 60 60 } 61 61 62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode renderingMode)62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode renderingMode) 63 63 { 64 64 ASSERT(m_fontReference); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
r77153 r80582 26 26 #include "FontWidthVariant.h" 27 27 #include "PlatformString.h" 28 #include "TextOrientation.h" 28 29 #include <wtf/Forward.h> 29 30 #include <wtf/Noncopyable.h> … … 47 48 ~FontCustomPlatformData(); 48 49 49 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 50 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, 51 FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 50 52 51 53 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
r77153 r80582 33 33 } 34 34 35 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant)35 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant) 36 36 { 37 37 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
r77153 r80582 43 43 ~FontCustomPlatformData(); 44 44 45 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);45 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth); 46 46 47 47 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
r77153 r80582 46 46 } 47 47 48 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode renderingMode)48 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode renderingMode) 49 49 { 50 50 FontDescription fontDesc; -
trunk/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
r77153 r80582 25 25 #include "FontRenderingMode.h" 26 26 #include "FontWidthVariant.h" 27 #include "TextOrientation.h" 27 28 #include "PlatformString.h" 28 29 #include <wtf/Noncopyable.h> … … 49 50 ~FontCustomPlatformData(); 50 51 51 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);52 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode); 52 53 53 54 static bool supportsFormat(const String&); -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r79734 r80582 326 326 return false; 327 327 328 if (renderer()->style(m_firstLine)->font().primaryFont()->orientation() == Vertical) 328 if (renderer()->style(m_firstLine)->fontDescription().textOrientation() == TextOrientationUpright 329 || renderer()->style(m_firstLine)->font().primaryFont()->hasVerticalGlyphs()) 329 330 return true; 330 331 … … 337 338 return true; 338 339 } else { 339 if (curr->renderer()->style(m_firstLine)->font().primaryFont()-> orientation() == Vertical)340 if (curr->renderer()->style(m_firstLine)->font().primaryFont()->hasVerticalGlyphs()) 340 341 return true; 341 342 … … 348 349 if (usedFonts) { 349 350 for (size_t i = 0; i < usedFonts->size(); ++i) { 350 if (usedFonts->at(i)-> orientation() == Vertical)351 if (usedFonts->at(i)->hasVerticalGlyphs()) 351 352 return true; 352 353 } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r80438 r80582 59 59 #include "StyleVisualData.h" 60 60 #include "TextDirection.h" 61 #include "TextOrientation.h" 61 62 #include "ThemeTypes.h" 62 63 #include "TransformOperations.h" … … 1212 1213 static WritingMode initialWritingMode() { return TopToBottomWritingMode; } 1213 1214 static TextCombine initialTextCombine() { return TextCombineNone; } 1215 static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; } 1214 1216 static EDisplay initialDisplay() { return INLINE; } 1215 1217 static EEmptyCell initialEmptyCells() { return SHOW; }
Note: See TracChangeset
for help on using the changeset viewer.