Changeset 112642 in webkit
- Timestamp:
- Mar 29, 2012 8:44:14 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112641 r112642 1 2012-03-29 Koji Ishii <kojiishi@gmail.com> 2 3 4 Vertical flow support for OpenType fonts with the least platform dependencies 5 https://bugs.webkit.org/show_bug.cgi?id=81326 6 7 Reviewed by Dan Bernstein. 8 9 This patch introduces a new class OpenTypeVerticalData to read 10 vertical font metrics from OpenType fonts. 11 12 Currently, WebKit relies on platform APIs to do the work. However, 13 some platforms such as Windows lack support for all the capabilities 14 WebKit requires for vertical flow and the text-orientation property 15 to work correctly. Reading OpenType tables directly also gives 16 benefits in consistent behavior among the WebKit platforms. 17 18 This patch is for any platforms that want to parse OpenType tables 19 directly, but it's currently included only in CGWin and isn't on any 20 code path even on CGWin yet. Caller's side change for CGWin and 21 support for other platforms will be in separate bugs. 22 23 No new tests are required. No behavior changes. 24 25 * WebCore.vcproj/WebCore.vcproj: Added OpenTypeTypes.h and OpenTypeVerticalData.h/cpp. 26 * platform/SharedBuffer.cpp: Add create(size_t) 27 (WebCore::SharedBuffer::SharedBuffer): 28 (WebCore): 29 * platform/SharedBuffer.h: Add create(size_t) 30 (WebCore::SharedBuffer::create): 31 (SharedBuffer): 32 * platform/graphics/FontPlatformData.h: Added openTypeTable(). 33 (WebCore): 34 (FontPlatformData): 35 * platform/graphics/SimpleFontData.h: Added sizePerUnit(). 36 (WebCore::SimpleFontData::sizePerUnit): size() / unitsPerEm() for less multiplication. 37 * platform/graphics/opentype/OpenTypeTypes.h: Added OpenType basic type definitions. 38 (OpenType): 39 (WebCore::OpenType::BigEndianShort::operator short): 40 (WebCore::OpenType::BigEndianShort::BigEndianShort): 41 (BigEndianShort): 42 (WebCore::OpenType::BigEndianUShort::operator unsigned short): 43 (WebCore::OpenType::BigEndianUShort::BigEndianUShort): 44 (BigEndianUShort): 45 (WebCore::OpenType::BigEndianLong::operator int): 46 (WebCore::OpenType::BigEndianLong::BigEndianLong): 47 (BigEndianLong): 48 (WebCore::OpenType::BigEndianULong::operator unsigned): 49 (WebCore::OpenType::BigEndianULong::BigEndianULong): 50 (BigEndianULong): 51 * platform/graphics/opentype/OpenTypeVerticalData.cpp: Added. 52 (OpenType): 53 (HheaTable): 54 (VheaTable): 55 (Entry): 56 (VORGTable): 57 (VertOriginYMetrics): 58 (WebCore::OpenType::VORGTable::requiredSize): 59 (WebCore): 60 (WebCore::validatedPtr): 61 (WebCore::OpenTypeVerticalData::OpenTypeVerticalData): 62 (WebCore::OpenTypeVerticalData::advanceHeight): Advance height for a glyph. 63 (WebCore::OpenTypeVerticalData::getVerticalTranslationsForGlyphs): Vertical origin. 64 * platform/graphics/opentype/OpenTypeVerticalData.h: Added. 65 (WebCore): 66 (OpenTypeVerticalData): A new class to handle vertical flow data in OpenType. 67 (WebCore::OpenTypeVerticalData::isOpenType): 68 (WebCore::OpenTypeVerticalData::hasVerticalMetrics): 69 (WebCore::OpenTypeVerticalData::hasVORG): 70 * platform/graphics/win/FontPlatformDataWin.cpp: 71 (WebCore): 72 (WebCore::FontPlatformData::openTypeTable): Implemented openTypeTable() for Win32. 73 1 74 2012-03-29 Leo Yang <leo.yang@torchmobile.com.cn> 2 75 -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r112490 r112642 29261 29261 </File> 29262 29262 <File 29263 RelativePath="..\platform\graphics\opentype\OpenTypeTypes.h" 29264 > 29265 </File> 29266 <File 29263 29267 RelativePath="..\platform\graphics\opentype\OpenTypeUtilities.cpp" 29264 29268 > … … 29266 29270 <File 29267 29271 RelativePath="..\platform\graphics\opentype\OpenTypeUtilities.h" 29272 > 29273 </File> 29274 <File 29275 RelativePath="..\platform\graphics\opentype\OpenTypeVerticalData.cpp" 29276 > 29277 </File> 29278 <File 29279 RelativePath="..\platform\graphics\opentype\OpenTypeVerticalData.h" 29268 29280 > 29269 29281 </File> -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r109132 r112642 63 63 } 64 64 65 SharedBuffer::SharedBuffer(size_t size) 66 : m_size(size) 67 , m_buffer(size) 68 { 69 } 70 65 71 SharedBuffer::SharedBuffer(const char* data, int size) 66 72 : m_size(0) -
trunk/Source/WebCore/platform/SharedBuffer.h
r107648 r112642 49 49 public: 50 50 static PassRefPtr<SharedBuffer> create() { return adoptRef(new SharedBuffer); } 51 static PassRefPtr<SharedBuffer> create(size_t size) { return adoptRef(new SharedBuffer(size)); } 51 52 static PassRefPtr<SharedBuffer> create(const char* c, int i) { return adoptRef(new SharedBuffer(c, i)); } 52 53 static PassRefPtr<SharedBuffer> create(const unsigned char* c, int i) { return adoptRef(new SharedBuffer(c, i)); } … … 116 117 private: 117 118 SharedBuffer(); 119 SharedBuffer(size_t); 118 120 SharedBuffer(const char*, int); 119 121 SharedBuffer(const unsigned char*, int); -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r110910 r112642 92 92 93 93 class FontDescription; 94 class SharedBuffer; 94 95 95 96 #if OS(DARWIN) … … 277 278 } 278 279 280 #if PLATFORM(WIN) && USE(CG) 281 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; 282 #endif 279 283 280 284 #ifndef NDEBUG -
trunk/Source/WebCore/platform/graphics/SimpleFontData.h
r104545 r112642 119 119 FontMetrics& fontMetrics() { return m_fontMetrics; } 120 120 const FontMetrics& fontMetrics() const { return m_fontMetrics; } 121 float sizePerUnit() const { return platformData().size() / (fontMetrics().unitsPerEm() ? fontMetrics().unitsPerEm() : 1); } 121 122 122 123 float maxCharWidth() const { return m_maxCharWidth; } -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
r105661 r112642 28 28 #include "HWndDC.h" 29 29 #include "PlatformString.h" 30 #include "SharedBuffer.h" 30 31 #include <wtf/HashMap.h> 31 32 #include <wtf/RetainPtr.h> … … 75 76 } 76 77 78 #if USE(CG) 79 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const 80 { 81 HWndDC hdc(0); 82 HGDIOBJ oldFont = SelectObject(hdc, hfont()); 83 84 DWORD size = GetFontData(hdc, table, 0, 0, 0); 85 RefPtr<SharedBuffer> buffer; 86 if (size != GDI_ERROR) { 87 buffer = SharedBuffer::create(size); 88 DWORD result = GetFontData(hdc, table, 0, (PVOID)buffer->data(), size); 89 ASSERT(result == size); 90 } 91 92 SelectObject(hdc, oldFont); 93 return buffer.release(); 94 } 95 #endif 96 77 97 #ifndef NDEBUG 78 98 String FontPlatformData::description() const
Note: See TracChangeset
for help on using the changeset viewer.