Changeset 70225 in webkit
- Timestamp:
- Oct 21, 2010 3:42:44 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70224 r70225 1 2010-10-21 takano takumi <takano1@asia.apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Need to swap glyphs for vertical writing 6 https://bugs.webkit.org/show_bug.cgi?id=46973 7 8 * fast/text/international/vertical-text-glyph-test.html: Added. 9 * fast/text/international/vertical-text-metrics-test.html: Added. 10 * platform/mac/fast/text/international/vertical-text-glyph-test-expected.checksum: Added. 11 * platform/mac/fast/text/international/vertical-text-glyph-test-expected.png: Added. 12 * platform/mac/fast/text/international/vertical-text-glyph-test-expected.txt: Added. 13 * platform/mac/fast/text/international/vertical-text-metrics-test-expected.txt: Added. 14 1 15 2010-10-21 Julie Parent <jparent@chromium.org> 2 16 -
trunk/WebCore/ChangeLog
r70223 r70225 1 2010-10-21 takano takumi <takano1@asia.apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Need to swap glyphs for vertical writing 6 https://bugs.webkit.org/show_bug.cgi?id=46973 7 8 Made changes to pass the writing-mode orientation flag in RenderStyle down to FontPlatformData, 9 and ultimately to CoreText APIs in both font complex path and fast path. 10 11 Tests: fast/text/international/vertical-text-glyph-test.html 12 fast/text/international/vertical-text-metrics-test.html 13 14 * WebCore.exp.in: 15 * WebCore.xcodeproj/project.pbxproj: Added platform/graphics/FontOrientation.h. 16 * css/CSSFontFaceSource.cpp: 17 (WebCore::CSSFontFaceSource::getFontData): Added font orientation parameter to SimpleFontData. 18 * css/CSSStyleSelector.cpp: 19 (WebCore::CSSStyleSelector::applyProperty): Set appropriate font orientation to the font description 20 when writing-mode is being specified. 21 * loader/CachedFont.cpp: 22 (WebCore::CachedFont::platformDataFromCustomData): Made to pass font orientation to FontPlatformData. 23 * loader/CachedFont.h: 24 * platform/graphics/FontCache.cpp: Added font orientation to FontPlatformDataCacheKey 25 (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey): 26 (WebCore::FontPlatformDataCacheKey::operator==): 27 (WebCore::computeHash): 28 (WebCore::FontCache::getCachedFontPlatformData): 29 * platform/graphics/FontDescription.h: Added font orientation support to FontDescription class 30 (WebCore::FontDescription::FontDescription): 31 (WebCore::FontDescription::orientation): 32 (WebCore::FontDescription::setOrientation): 33 (WebCore::FontDescription::operator==): 34 * platform/graphics/FontOrientation.h: Added. 35 * platform/graphics/SimpleFontData.h: 36 * platform/graphics/cairo/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 37 (WebCore::FontCustomPlatformData::fontPlatformData): 38 * platform/graphics/cairo/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 39 * platform/graphics/cocoa/FontPlatformData.h: Added font orientation support to FontPlatformData class 40 (WebCore::FontPlatformData::FontPlatformData): 41 (WebCore::FontPlatformData::orientation): 42 (WebCore::FontPlatformData::hash): 43 (WebCore::FontPlatformData::operator==): 44 * platform/graphics/cocoa/FontPlatformDataCocoa.mm: Added font orientation support 45 (WebCore::FontPlatformData::FontPlatformData): 46 (WebCore::FontPlatformData::operator=): 47 (WebCore::FontPlatformData::allowsLigatures): Don't allow ligatures when the font is vertical orientation. 48 (WebCore::FontPlatformData::description): 49 * platform/graphics/gtk/FontCustomPlatformDataPango.cpp: Changed to pass font orientation to fontPlatformData() 50 (WebCore::FontCustomPlatformData::fontPlatformData): 51 * platform/graphics/haiku/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 52 (WebCore::FontCustomPlatformData::fontPlatformData): 53 * platform/graphics/haiku/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 54 * platform/graphics/mac/FontCacheMac.mm: Added font orientation parameter when creating FontPlatformData object. 55 (WebCore::FontCache::getFontDataForCharacters): 56 (WebCore::FontCache::createFontPlatformData): 57 * platform/graphics/mac/FontCustomPlatformData.cpp: Added font orientation parameter when creating FontPlatformData object. 58 (WebCore::FontCustomPlatformData::fontPlatformData): 59 * platform/graphics/mac/FontCustomPlatformData.h: Changed to pass font orientation parameter to fontPlatformData() 60 * platform/graphics/mac/GlyphPageTreeNodeMac.cpp: 61 (WebCore::GlyphPage::fill): Changed to use CoreText to extract glyphs when the current font is vertical orientation. 62 CoreText automatically swaps glyphs with vertical variants when the font orientation is vertical. 63 * platform/graphics/mac/SimpleFontDataCoreText.cpp: Added vertical form attribute to the attribute dictionary for a CTLine. 64 (WebCore::SimpleFontData::getCFStringAttributes): 65 * platform/graphics/mac/SimpleFontDataMac.mm: 66 (WebCore::SimpleFontData::platformBoundsForGlyph): Changed to use CoreText (from CG) to support vertical metrics. 67 (WebCore::SimpleFontData::platformWidthForGlyph): Made to use CoreText, instead of wkGetGlyphTransformedAdvances, 68 to get vertical metrics when the font orientation is vertical. 69 * platform/graphics/qt/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 70 * platform/graphics/qt/FontCustomPlatformDataQt.cpp: Changed to pass font orientation to fontPlatformData() 71 (WebCore::FontCustomPlatformData::fontPlatformData): 72 * platform/graphics/skia/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 73 (WebCore::FontCustomPlatformData::fontPlatformData): 74 * platform/graphics/skia/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 75 * platform/graphics/win/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 76 (WebCore::FontCustomPlatformData::fontPlatformData): 77 * platform/graphics/win/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 78 * platform/graphics/win/FontCustomPlatformDataCairo.cpp: Changed to pass font orientation to fontPlatformData() 79 (WebCore::FontCustomPlatformData::fontPlatformData): 80 * platform/graphics/win/FontCustomPlatformDataCairo.h: Changed to pass font orientation to fontPlatformData() 81 * platform/graphics/wince/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 82 (WebCore::FontCustomPlatformData::fontPlatformData): 83 * platform/graphics/wince/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 84 * platform/graphics/wx/FontCustomPlatformData.cpp: Changed to pass font orientation to fontPlatformData() 85 (WebCore::FontCustomPlatformData::fontPlatformData): 86 * platform/graphics/wx/FontCustomPlatformData.h: Changed to pass font orientation to fontPlatformData() 87 1 88 2010-10-20 Nikolas Zimmermann <nzimmermann@rim.com> 2 89 -
trunk/WebCore/WebCore.exp.in
r70195 r70225 385 385 __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd 386 386 __ZN7WebCore16FontFallbackList15releaseFontDataEv 387 __ZN7WebCore16FontPlatformDataC1EP6NSFontbb 387 __ZN7WebCore16FontPlatformDataC1EP6NSFontbbNS_15FontOrientationE 388 388 __ZN7WebCore16FontPlatformDataD1Ev 389 389 __ZN7WebCore16HTMLInputElement13setAutofilledEb -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r70223 r70225 5527 5527 F5D3A57C106B83B300545297 /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5D3A57A106B83B300545297 /* DateComponents.cpp */; }; 5528 5528 F5D3A57D106B83B300545297 /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = F5D3A57B106B83B300545297 /* DateComponents.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5529 F7A034C4126BF6BE007DC19E /* FontOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = F7A034C3126BF6BE007DC19E /* FontOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5529 5530 F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; }; 5530 5531 F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; … … 11578 11579 F5D3A57A106B83B300545297 /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = "<group>"; }; 11579 11580 F5D3A57B106B83B300545297 /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; }; 11581 F7A034C3126BF6BE007DC19E /* FontOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontOrientation.h; sourceTree = "<group>"; }; 11580 11582 F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 11581 11583 F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; }; … … 16512 16514 B2C3DA590D006CD600EF6F26 /* FontFamily.h */, 16513 16515 72626E010EF022FE00A07E20 /* FontFastPath.cpp */, 16516 F7A034C3126BF6BE007DC19E /* FontOrientation.h */, 16514 16517 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */, 16515 16518 B2C3DA5A0D006CD600EF6F26 /* FontSelector.h */, … … 21123 21126 4FA3B90B125CD12200300BAD /* InspectorState.h in Headers */, 21124 21127 9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */, 21128 F7A034C4126BF6BE007DC19E /* FontOrientation.h in Headers */, 21125 21129 081CDFB8126ECFDB00D215CA /* DeprecatedSVGAnimatedProperty.h in Headers */, 21126 21130 081CDFB9126ECFDB00D215CA /* DeprecatedSVGAnimatedPropertyTraits.h in Headers */, -
trunk/WebCore/css/CSSFontFaceSource.cpp
r66963 r70225 163 163 return 0; 164 164 165 fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription. renderingMode()), true, false));165 fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.renderingMode()), true, false)); 166 166 } 167 167 } else { -
trunk/WebCore/css/CSSStyleSelector.cpp
r70209 r70225 5572 5572 5573 5573 // CSS Text Layout Module Level 3: Vertical writing support 5574 case CSSPropertyWebkitWritingMode: 5574 case CSSPropertyWebkitWritingMode: { 5575 5575 HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(writingMode, WritingMode) 5576 return; 5577 5576 FontDescription fontDescription = m_style->fontDescription(); 5577 fontDescription.setOrientation(m_style->isHorizontalWritingMode() ? Horizontal : Vertical); 5578 if (m_style->setFontDescription(fontDescription)) 5579 m_fontDirty = true; 5580 return; 5581 } 5578 5582 #if ENABLE(SVG) 5579 5583 default: -
trunk/WebCore/loader/CachedFont.cpp
r68112 r70225 118 118 } 119 119 120 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, Font RenderingMode renderingMode)120 FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, 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, renderingMode);128 return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, renderingMode); 129 129 #else 130 130 return FontPlatformData(); -
trunk/WebCore/loader/CachedFont.h
r66963 r70225 28 28 29 29 #include "CachedResource.h" 30 #include "FontOrientation.h" 30 31 #include "FontRenderingMode.h" 31 32 #include <wtf/Vector.h> … … 63 64 64 65 bool ensureCustomFontData(); 65 FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);66 FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 66 67 67 68 #if ENABLE(SVG_FONTS) -
trunk/WebCore/platform/graphics/FontCache.cpp
r65077 r70225 56 56 struct FontPlatformDataCacheKey : FastAllocBase { 57 57 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false, 58 bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode )58 bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal) 59 59 : m_size(size) 60 60 , m_weight(weight) … … 63 63 , m_printerFont(isPrinterFont) 64 64 , m_renderingMode(renderingMode) 65 , m_orientation(orientation) 65 66 { 66 67 } … … 73 74 return equalIgnoringCase(m_family, other.m_family) && m_size == other.m_size && 74 75 m_weight == other.m_weight && m_italic == other.m_italic && m_printerFont == other.m_printerFont && 75 m_renderingMode == other.m_renderingMode ;76 m_renderingMode == other.m_renderingMode && m_orientation == other.m_orientation; 76 77 } 77 78 … … 82 83 bool m_printerFont; 83 84 FontRenderingMode m_renderingMode; 85 FontOrientation m_orientation; 84 86 85 87 private: … … 93 95 fontKey.m_size, 94 96 fontKey.m_weight, 95 static_cast<unsigned>(fontKey.m_ italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode)97 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) 96 98 }; 97 99 return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar)); … … 192 194 193 195 FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription.weight(), fontDescription.italic(), 194 fontDescription.usePrinterFont(), fontDescription.renderingMode() );196 fontDescription.usePrinterFont(), fontDescription.renderingMode(), fontDescription.orientation()); 195 197 FontPlatformData* result = 0; 196 198 bool foundResult; -
trunk/WebCore/platform/graphics/FontDescription.h
r65591 r70225 27 27 28 28 #include "FontFamily.h" 29 #include "FontOrientation.h" 29 30 #include "FontRenderingMode.h" 30 31 #include "FontSmoothingMode.h" … … 56 57 : m_specifiedSize(0) 57 58 , m_computedSize(0) 59 , m_orientation(Horizontal) 58 60 , m_italic(false) 59 61 , m_smallCaps(false) … … 95 97 FontTraitsMask traitsMask() const; 96 98 bool isSpecifiedFont() const { return m_isSpecifiedFont; } 99 FontOrientation orientation() const { return m_orientation; } 97 100 98 101 void setFamily(const FontFamily& family) { m_familyList = family; } … … 114 117 void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; } 115 118 void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; } 119 void setOrientation(FontOrientation orientation) { m_orientation = orientation; } 116 120 117 121 private: … … 121 125 // rounding, minimum font sizes, and zooming. 122 126 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor. 127 128 FontOrientation m_orientation; 123 129 124 130 bool m_italic : 1; … … 156 162 && m_fontSmoothing == other.m_fontSmoothing 157 163 && m_textRendering == other.m_textRendering 158 && m_isSpecifiedFont == other.m_isSpecifiedFont; 164 && m_isSpecifiedFont == other.m_isSpecifiedFont 165 && m_orientation == other.m_orientation; 159 166 } 160 167 -
trunk/WebCore/platform/graphics/SimpleFontData.h
r64916 r70225 38 38 #endif 39 39 40 #if USE(CORE_TEXT)40 #if PLATFORM(MAC) 41 41 #include <wtf/RetainPtr.h> 42 42 #endif … … 131 131 #endif 132 132 133 #if USE(CORE_TEXT)133 #if PLATFORM(MAC) 134 134 CFDictionaryRef getCFStringAttributes(TypesettingFeatures) const; 135 135 #endif … … 235 235 #endif 236 236 237 #if USE(CORE_TEXT)237 #if PLATFORM(MAC) 238 238 mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; 239 239 #endif -
trunk/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp
r68406 r70225 59 59 } 60 60 61 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)61 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) 62 62 { 63 63 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
r68041 r70225 23 23 #define FontCustomPlatformData_h 24 24 25 #include "FontOrientation.h" 25 26 #include "FontRenderingMode.h" 26 27 #include <wtf/Forward.h> … … 39 40 FontCustomPlatformData(FT_Face, SharedBuffer*); 40 41 ~FontCustomPlatformData(); 41 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);42 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 42 43 static bool supportsFormat(const String&); 43 44 -
trunk/WebCore/platform/graphics/cocoa/FontPlatformData.h
r66574 r70225 25 25 #define FontPlatformData_h 26 26 27 #include "FontOrientation.h" 27 28 #include <wtf/text/StringImpl.h> 28 29 … … 59 60 class FontPlatformData { 60 61 public: 61 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique )62 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation = Horizontal) 62 63 : m_syntheticBold(syntheticBold) 63 64 , m_syntheticOblique(syntheticOblique) 65 , m_orientation(orientation) 64 66 , m_atsuFontID(0) 65 67 , m_size(size) … … 72 74 } 73 75 74 FontPlatformData(NSFont *nsFont, bool syntheticBold = false, bool syntheticOblique = false );76 FontPlatformData(NSFont *nsFont, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal); 75 77 76 FontPlatformData(CGFontRef cgFont, ATSUFontID fontID, float size, bool syntheticBold, bool syntheticOblique )78 FontPlatformData(CGFontRef cgFont, ATSUFontID fontID, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation) 77 79 : m_syntheticBold(syntheticBold) 78 80 , m_syntheticOblique(syntheticOblique) 81 , m_orientation(orientation) 79 82 , m_atsuFontID(fontID) 80 83 , m_size(size) … … 95 98 bool syntheticBold() const { return m_syntheticBold; } 96 99 bool syntheticOblique() const { return m_syntheticOblique; } 100 FontOrientation orientation() const { return m_orientation; } 97 101 98 102 bool m_syntheticBold; 99 103 bool m_syntheticOblique; 104 FontOrientation m_orientation; 100 105 101 106 ATSUFontID m_atsuFontID; … … 105 110 { 106 111 ASSERT(m_font != 0 || m_cgFont == 0); 107 uintptr_t hashCodes[2] = { (uintptr_t)m_font, m_ syntheticBold << 1 | m_syntheticOblique };112 uintptr_t hashCodes[2] = { (uintptr_t)m_font, m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique }; 108 113 return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar)); 109 114 } … … 114 119 { 115 120 return m_font == other.m_font && m_syntheticBold == other.m_syntheticBold && m_syntheticOblique == other.m_syntheticOblique && 116 m_cgFont == other.m_cgFont && m_size == other.m_size && m_atsuFontID == other.m_atsuFontID ;121 m_cgFont == other.m_cgFont && m_size == other.m_size && m_atsuFontID == other.m_atsuFontID && m_orientation == other.m_orientation; 117 122 } 118 123 -
trunk/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
r66574 r70225 45 45 #endif // PLATFORM(MAC) 46 46 47 FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool syntheticOblique )47 FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool syntheticOblique, FontOrientation orientation) 48 48 : m_syntheticBold(syntheticBold) 49 49 , m_syntheticOblique(syntheticOblique) 50 , m_orientation(orientation) 50 51 , m_font(nsFont) 51 52 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) … … 84 85 m_atsuFontID = f.m_atsuFontID; 85 86 m_isColorBitmapFont = f.m_isColorBitmapFont; 87 m_orientation = f.m_orientation; 86 88 #if USE(CORE_TEXT) 87 89 m_CTFont = f.m_CTFont; … … 113 115 m_font = f.m_font; 114 116 m_isColorBitmapFont = f.m_isColorBitmapFont; 117 m_orientation = f.m_orientation; 115 118 #if USE(CORE_TEXT) 116 119 m_CTFont = f.m_CTFont; … … 170 173 bool FontPlatformData::allowsLigatures() const 171 174 { 172 return ![[m_font coveredCharacterSet] characterIsMember:'a'];175 return m_orientation == Horizontal && ![[m_font coveredCharacterSet] characterIsMember:'a']; 173 176 } 174 177 … … 188 191 { 189 192 RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont())); 190 return String(cgFontDescription.get()) + " " + String::number(m_size) + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : ""); 193 return String(cgFontDescription.get()) + " " + String::number(m_size) 194 + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : ""); 191 195 } 192 196 #endif -
trunk/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp
r64434 r70225 31 31 } 32 32 33 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)33 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) 34 34 { 35 35 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
r64434 r70225 32 32 } 33 33 34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) 35 35 { 36 36 return FontPlatformData(size, bold, italic); -
trunk/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
r65021 r70225 22 22 #define FontCustomPlatformData_h 23 23 24 #include "FontOrientation.h" 24 25 #include "FontRenderingMode.h" 25 26 #include <wtf/Forward.h> … … 38 39 static bool supportsFormat(const String&); 39 40 40 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);41 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 41 42 }; 42 43 -
trunk/WebCore/platform/graphics/mac/FontCacheMac.mm
r54601 r70225 143 143 FontPlatformData alternateFont(substituteFont, 144 144 !font.isPlatformFont() && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight), 145 !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait)); 145 !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait), 146 platformData.m_orientation); 146 147 return getCachedFontData(&alternateFont); 147 148 } … … 211 212 bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); 212 213 213 return new FontPlatformData(platformFont, syntheticBold, syntheticOblique );214 return new FontPlatformData(platformFont, syntheticBold, syntheticOblique, fontDescription.orientation()); 214 215 } 215 216 -
trunk/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
r65760 r70225 39 39 } 40 40 41 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)41 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontRenderingMode) 42 42 { 43 return FontPlatformData(m_cgFont, (ATSUFontID)m_atsFont, size, bold, italic );43 return FontPlatformData(m_cgFont, (ATSUFontID)m_atsFont, size, bold, italic, orientation); 44 44 } 45 45 -
trunk/WebCore/platform/graphics/mac/FontCustomPlatformData.h
r65021 r70225 22 22 #define FontCustomPlatformData_h 23 23 24 #include "FontOrientation.h" 24 25 #include "FontRenderingMode.h" 25 26 #include <CoreFoundation/CFBase.h> … … 42 43 ~FontCustomPlatformData(); 43 44 44 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);45 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 45 46 46 47 static bool supportsFormat(const String&); -
trunk/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
r36296 r70225 41 41 42 42 #ifndef BUILDING_ON_TIGER 43 Vector<CGGlyph, 512> glyphs(bufferLength); 44 wkGetGlyphsForCharacters(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength); 43 if (fontData->platformData().orientation() == Horizontal) { 44 Vector<CGGlyph, 512> glyphs(bufferLength); 45 wkGetGlyphsForCharacters(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength); 46 for (unsigned i = 0; i < length; ++i) { 47 if (!glyphs[i]) 48 setGlyphDataForIndex(offset + i, 0, 0); 49 else { 50 setGlyphDataForIndex(offset + i, glyphs[i], fontData); 51 haveGlyphs = true; 52 } 53 } 54 } else { 55 // We ask CoreText for possible vertical variant glyphs 56 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buffer, bufferLength, kCFAllocatorNull)); 57 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0))); 58 RetainPtr<CTLineRef> line(AdoptCF, CTLineCreateWithAttributedString(attributedString.get())); 45 59 46 for (unsigned i = 0; i < length; ++i) { 47 if (!glyphs[i]) 48 setGlyphDataForIndex(offset + i, 0, 0); 49 else { 50 setGlyphDataForIndex(offset + i, glyphs[i], fontData); 51 haveGlyphs = true; 60 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); 61 CFIndex runCount = CFArrayGetCount(runArray); 62 63 // Initialize glyph entries 64 for (unsigned index = 0; index < length; ++index) 65 setGlyphDataForIndex(offset + index, 0, 0); 66 67 Vector<CGGlyph, 512> glyphVector; 68 Vector<CFIndex, 512> indexVector; 69 bool done = false; 70 for (CFIndex r = 0; r < runCount && !done ; ++r) { 71 // CTLine could map characters over multiple fonts using its own font fallback list. 72 // We need to pick runs that use the exact font we need, i.e., fontData->platformData().ctFont(). 73 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, r)); 74 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); 75 76 CFDictionaryRef attributes = CTRunGetAttributes(ctRun); 77 CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(attributes, kCTFontAttributeName)); 78 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0)); 79 // Use CGFont here as CFEqual for CTFont counts all attributes for font. 80 if (CFEqual(fontData->platformData().cgFont(), runCGFont.get())) { 81 // This run uses the font we want. Extract glyphs. 82 CFIndex glyphCount = CTRunGetGlyphCount(ctRun); 83 const CGGlyph* glyphs = CTRunGetGlyphsPtr(ctRun); 84 if (!glyphs) { 85 glyphVector.resize(glyphCount); 86 CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), glyphVector.data()); 87 glyphs = glyphVector.data(); 88 } 89 const CFIndex* stringIndices = CTRunGetStringIndicesPtr(ctRun); 90 if (!stringIndices) { 91 indexVector.resize(glyphCount); 92 CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), indexVector.data()); 93 stringIndices = indexVector.data(); 94 } 95 96 for (CFIndex i = 0; i < glyphCount; ++i) { 97 if (stringIndices[i] >= static_cast<CFIndex>(length)) { 98 done = true; 99 break; 100 } 101 if (glyphs[i]) { 102 setGlyphDataForIndex(offset + stringIndices[i], glyphs[i], fontData); 103 haveGlyphs = true; 104 } 105 } 106 } 52 107 } 53 108 } -
trunk/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
r64915 r70225 31 31 #import "SimpleFontData.h" 32 32 33 #if USE(CORE_TEXT)34 35 33 #import "Font.h" 36 34 #import "FontCache.h" … … 61 59 static const float kerningAdjustmentValue = 0; 62 60 static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue); 63 static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };61 static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; 64 62 const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures 65 ? ligaturesAllowed : ligaturesNotAllowed };63 ? ligaturesAllowed : ligaturesNotAllowed, platformData().orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; 66 64 attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled, 67 65 sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled), … … 69 67 } else { 70 68 // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning. 71 static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName };72 const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };69 static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; 70 const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, platformData().orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; 73 71 attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled, 74 72 sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled), … … 80 78 81 79 } // namespace WebCore 82 83 #endif -
trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r66440 r70225 418 418 FloatRect boundingBox; 419 419 #ifndef BUILDING_ON_TIGER 420 CGRect box; 421 CGFontGetGlyphBBoxes(platformData().cgFont(), &glyph, 1, &box); 422 float pointSize = platformData().m_size; 423 CGFloat scale = pointSize / unitsPerEm(); 424 boundingBox = CGRectApplyAffineTransform(box, CGAffineTransformMakeScale(scale, -scale)); 420 boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), 421 m_platformData.orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1); 422 boundingBox.setY(-boundingBox.bottom()); 425 423 #else 426 424 // FIXME: Custom fonts don't have NSFonts, so this function doesn't compute correct bounds for these on Tiger. … … 438 436 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const 439 437 { 440 NSFont* font = platformData().font();441 float pointSize = platformData().m_size;442 CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);443 438 CGSize advance; 444 if (!wkGetGlyphTransformedAdvances(platformData().cgFont(), font, &m, &glyph, &advance)) { 445 LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displayName], pointSize); 446 advance.width = 0; 447 } 439 if (m_platformData.orientation() == Horizontal) { 440 NSFont* font = platformData().font(); 441 float pointSize = platformData().m_size; 442 CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize); 443 if (!wkGetGlyphTransformedAdvances(platformData().cgFont(), font, &m, &glyph, &advance)) { 444 LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displayName], pointSize); 445 advance.width = 0; 446 } 447 } else 448 CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), kCTFontVerticalOrientation, &glyph, &advance, 1); 449 448 450 return advance.width + m_syntheticBoldOffset; 449 451 } -
trunk/WebCore/platform/graphics/qt/FontCustomPlatformData.h
r65021 r70225 23 23 #define FontCustomPlatformData_h 24 24 25 #include "FontOrientation.h" 25 26 #include "FontRenderingMode.h" 26 27 #include <wtf/Forward.h> … … 38 39 int m_handle; 39 40 40 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);41 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 41 42 42 43 static bool supportsFormat(const String&); -
trunk/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
r64434 r70225 35 35 } 36 36 37 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)37 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) 38 38 { 39 39 QFont font; -
trunk/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp
r68112 r70225 65 65 } 66 66 67 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode mode)67 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode mode) 68 68 { 69 69 #if OS(WINDOWS) -
trunk/WebCore/platform/graphics/skia/FontCustomPlatformData.h
r68112 r70225 33 33 #define FontCustomPlatformData_h 34 34 35 #include "FontOrientation.h" 35 36 #include "FontRenderingMode.h" 36 37 #include <wtf/Forward.h> … … 63 64 ~FontCustomPlatformData(); 64 65 65 FontPlatformData fontPlatformData(int size, bool bold, bool italic, 66 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, 66 67 FontRenderingMode = NormalRenderingMode); 67 68 -
trunk/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
r64434 r70225 60 60 } 61 61 62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode renderingMode)62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode renderingMode) 63 63 { 64 64 ASSERT(m_fontReference); -
trunk/WebCore/platform/graphics/win/FontCustomPlatformData.h
r65021 r70225 22 22 #define FontCustomPlatformData_h 23 23 24 #include "FontOrientation.h" 24 25 #include "FontRenderingMode.h" 25 26 #include "PlatformString.h" … … 43 44 ~FontCustomPlatformData(); 44 45 45 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);46 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 46 47 47 48 static bool supportsFormat(const String&); -
trunk/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
r66047 r70225 33 33 } 34 34 35 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic )35 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation) 36 36 { 37 37 return FontPlatformData(m_fontFace, size, bold, italic); -
trunk/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
r66047 r70225 23 23 #define FontCustomPlatformDataCairo_h 24 24 25 #include "FontDescription.h" 25 26 #include <wtf/Forward.h> 26 27 #include <wtf/Noncopyable.h> … … 40 41 ~FontCustomPlatformData(); 41 42 42 FontPlatformData fontPlatformData(int size, bool bold, bool italic );43 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal); 43 44 44 45 static bool supportsFormat(const String&); -
trunk/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
r64434 r70225 46 46 } 47 47 48 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode renderingMode)48 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode renderingMode) 49 49 { 50 50 FontDescription fontDesc; -
trunk/WebCore/platform/graphics/wince/FontCustomPlatformData.h
r64434 r70225 22 22 #define FontCustomPlatformData_h 23 23 24 #include "FontDescription.h" 24 25 #include "FontRenderingMode.h" 25 26 #include "PlatformString.h" … … 45 46 ~FontCustomPlatformData(); 46 47 47 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);48 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation fontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 48 49 49 50 static bool supportsFormat(const String&); -
trunk/WebCore/platform/graphics/wx/FontCustomPlatformData.cpp
r64528 r70225 32 32 } 33 33 34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, Font RenderingMode)34 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) 35 35 { 36 36 return FontPlatformData(size, bold, italic); -
trunk/WebCore/platform/graphics/wx/FontCustomPlatformData.h
r65021 r70225 22 22 #define FontCustomPlatformData_h 23 23 24 #include "FontOrientation.h" 24 25 #include "FontRenderingMode.h" 25 26 #include <wtf/Forward.h> … … 38 39 static bool supportsFormat(const String&); 39 40 40 FontPlatformData fontPlatformData(int size, bool bold, bool italic, Font RenderingMode = NormalRenderingMode);41 FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); 41 42 }; 42 43
Note: See TracChangeset
for help on using the changeset viewer.