Changeset 84989 in webkit
- Timestamp:
- Apr 26, 2011 5:17:41 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84988 r84989 1 2011-04-26 Chun-Lung Huang <alvincl.huang@gmail.com> 2 3 Reviewed by Adele Peterson. 4 5 On WebKit (Windows), glyphs in vertical text tests are rotated 90 6 degrees clockwise. https://bugs.webkit.org/show_bug.cgi?id=48459 7 8 This platform dependent patch makes WebKit (Windows) show the 9 vertical writing text correctly. Job was done by adding a prefix '@' 10 in front of the font family name (Windows Only). No new tests added. 11 Some layout tests images: 12 http://www.flickr.com/photos/burorly/sets/72157625585506341/ 13 14 * platform/graphics/FontPlatformData.h: 15 * platform/graphics/win/FontCacheWin.cpp: 16 (WebCore::FontCache::getFontDataForCharacters): 17 (WebCore::FontCache::createFontPlatformData): 18 * platform/graphics/win/FontCustomPlatformData.cpp: 19 (WebCore::FontCustomPlatformData::fontPlatformData): 20 * platform/graphics/win/FontPlatformDataCGWin.cpp: 21 (WebCore::FontPlatformData::FontPlatformData): 22 * platform/graphics/win/FontPlatformDataWin.cpp: 23 (WebCore::FontPlatformData::FontPlatformData): 24 1 25 2011-04-26 Jer Noble <jer.noble@apple.com> 2 26 -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r84101 r84989 197 197 #endif 198 198 #if PLATFORM(WIN) 199 FontPlatformData(HFONT, float size, bool syntheticBold, bool syntheticOblique, bool useGDI );199 FontPlatformData(HFONT, float size, bool syntheticBold, bool syntheticOblique, bool useGDI, FontOrientation = Horizontal); 200 200 #if USE(CG) 201 FontPlatformData(HFONT, CGFontRef, float size, bool syntheticBold, bool syntheticOblique, bool useGDI );201 FontPlatformData(HFONT, CGFontRef, float size, bool syntheticBold, bool syntheticOblique, bool useGDI, FontOrientation = Horizontal); 202 202 #endif 203 203 #endif -
trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp
r84101 r84989 284 284 if (hfont) { 285 285 if (!familyName.isEmpty()) { 286 FontPlatformData* result = getCachedFontPlatformData(font.fontDescription(), familyName); 286 FontPlatformData* result; 287 // Take the orientation into consideration. For vertical: add "@" in front of the family name. 288 // "@" is a built-in behaviour for Windows platform. http://msdn.microsoft.com/en-us/goglobal/bb688137 289 if (font.fontDescription().orientation() == Vertical && !familyName.startsWith("@")) 290 result = getCachedFontPlatformData(font.fontDescription(), "@" + String(familyName)); 291 else 292 result = getCachedFontPlatformData(font.fontDescription(), familyName); 293 287 294 if (result) 288 295 fontData = getCachedFontData(result); … … 560 567 bool useGDI = fontDescription.renderingMode() == AlternateRenderingMode && !isLucidaGrande; 561 568 569 // Take the orientation into consideration. For vertical: add "@" in front of the family name. 570 // "@" is a built-in behaviour for Windows platform. http://msdn.microsoft.com/en-us/goglobal/bb688137 571 AtomicString updatedFamilyName; 572 if (fontDescription.orientation() == Vertical && !family.startsWith("@")) 573 updatedFamilyName = "@" + String(family); 574 else 575 updatedFamilyName = family; 576 562 577 // The logical size constant is 32. We do this for subpixel precision when rendering using Uniscribe. 563 578 // This masks rounding errors related to the HFONT metrics being different from the CGFont metrics. 564 579 // FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't 565 580 // look as nice. That may be solvable though. 566 LONG weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family);567 HFONT hfont = createGDIFont( family, weight, fontDescription.italic(),581 LONG weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), updatedFamilyName); 582 HFONT hfont = createGDIFont(updatedFamilyName, weight, fontDescription.italic(), 568 583 fontDescription.computedPixelSize() * (useGDI ? 1 : 32), useGDI); 584 585 // Some fonts do not need to be rotated when displayed vertically. 586 // Or "@font-family-name" is not supported on user's platform. 587 // (e.g. no "@Times New Romain" or "@Arial"). Try to create hfont with original family name. 588 if (updatedFamilyName.startsWith("@") && !hfont) { 589 weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family); 590 hfont = createGDIFont(family, weight, fontDescription.italic(), 591 fontDescription.computedPixelSize() * (useGDI ? 1 : 32), useGDI); 592 } 569 593 570 594 if (!hfont) … … 580 604 bool synthesizeItalic = fontDescription.italic() && !logFont.lfItalic; 581 605 582 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.computedPixelSize(), synthesizeBold, synthesizeItalic, useGDI );606 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.computedPixelSize(), synthesizeBold, synthesizeItalic, useGDI, fontDescription.orientation()); 583 607 584 608 #if USE(CG) -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
r80582 r84989 60 60 } 61 61 62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation , TextOrientation, FontWidthVariant, FontRenderingMode renderingMode)62 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, TextOrientation, FontWidthVariant, FontRenderingMode renderingMode) 63 63 { 64 64 ASSERT(m_fontReference); … … 66 66 67 67 LOGFONT& logFont = *static_cast<LOGFONT*>(malloc(sizeof(LOGFONT))); 68 if (m_name.isNull()) 68 if (m_name.isNull()) { 69 69 TTGetNewFontName(&m_fontReference, logFont.lfFaceName, LF_FACESIZE, 0, 0); 70 m_name = logFont.lfFaceName; 71 } 72 73 // Take the orientation into consideration. For vertical: add "@" in front of the family name. (Windows) 74 String newName; 75 if (orientation == Vertical && !m_name.startsWith("@")) 76 newName = "@" + m_name; 70 77 else 71 memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(), sizeof(logFont.lfFaceName[0]) * min(static_cast<size_t>(LF_FACESIZE), 1 + m_name.length())); 78 newName = m_name; 79 memcpy(logFont.lfFaceName, newName.charactersWithNullTermination(), sizeof(logFont.lfFaceName[0]) * min(static_cast<size_t>(LF_FACESIZE), 1 + newName.length())); 72 80 73 81 logFont.lfHeight = -size; … … 89 97 90 98 RetainPtr<CGFontRef> cgFont(AdoptCF, CGFontCreateWithPlatformFont(&logFont)); 91 return FontPlatformData(hfont, cgFont.get(), size, bold, italic, renderingMode == AlternateRenderingMode );99 return FontPlatformData(hfont, cgFont.get(), size, bold, italic, renderingMode == AlternateRenderingMode, orientation); 92 100 } 93 101 -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
r81977 r84989 115 115 } 116 116 117 FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI )117 FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI, FontOrientation orientation) 118 118 : m_syntheticBold(bold) 119 119 , m_syntheticOblique(oblique) 120 , m_orientation( Horizontal)120 , m_orientation(orientation) 121 121 , m_textOrientation(TextOrientationVerticalRight) 122 122 , m_size(size) -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
r84101 r84989 36 36 namespace WebCore { 37 37 38 FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI )38 FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI, FontOrientation orientation) 39 39 : m_font(RefCountedGDIHandle<HFONT>::create(font)) 40 40 , m_size(size) 41 , m_orientation( Horizontal)41 , m_orientation(orientation) 42 42 , m_textOrientation(TextOrientationVerticalRight) 43 43 , m_widthVariant(RegularWidth)
Note: See TracChangeset
for help on using the changeset viewer.