Changeset 58068 in webkit
- Timestamp:
- Apr 22, 2010 12:29:58 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58061 r58068 1 2010-04-22 Stephan Aßmus <superstippi@gmx.de> 2 3 Reviewed by David Levin. 4 5 [Haiku] Improve SimpleFontDataHaiku 6 https://bugs.webkit.org/show_bug.cgi?id=37411 7 8 Covered by existing tests. 9 10 * platform/graphics/haiku/SimpleFontDataHaiku.cpp: 11 - Cleaned up includes 12 - Removed prototype "charUnicodeToUTF8HACK" 13 (WebCore::SimpleFontData::platformInit): 14 - Use const BFont pointer 15 (WebCore::SimpleFontData::smallCapsFontData): 16 - "fontPlatformData" was leaked. It is only 17 used as the key for the font cache lookup. 18 (WebCore::SimpleFontData::platformMetricsForGlyph): 19 - Use existing WebCore encoding infrastructure 20 instead of adding a hack for Haiku. 21 1 22 2010-04-21 Steve Block <steveblock@google.com> 2 23 -
trunk/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp
r57215 r58068 35 35 #include "FontDescription.h" 36 36 #include "NotImplemented.h" 37 #include <Rect.h> 38 #include <unicode/uchar.h> 39 #include <unicode/unorm.h> 37 #include "TextEncoding.h" 38 #include <wtf/text/CString.h> 40 39 41 42 extern int charUnicodeToUTF8HACK(unsigned short, char*);43 40 44 41 namespace WebCore { … … 46 43 void SimpleFontData::platformInit() 47 44 { 48 BFont* font = m_platformData.font();45 const BFont* font = m_platformData.font(); 49 46 if (!font) 50 47 return; … … 77 74 FontDescription desc = FontDescription(fontDescription); 78 75 desc.setSpecifiedSize(0.70f * fontDescription.computedSize()); 79 const FontPlatformData* fontPlatformData = new FontPlatformData(desc, desc.family().family());80 m_smallCapsFontData = new SimpleFontData( *fontPlatformData);76 FontPlatformData fontPlatformData(desc, desc.family().family()); 77 m_smallCapsFontData = new SimpleFontData(fontPlatformData); 81 78 } 82 79 return m_smallCapsFontData; … … 96 93 GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const 97 94 { 95 GlyphMetrics metrics; 98 96 if (!m_platformData.font()) 99 return 0;97 return metrics; 100 98 101 char charArray[4]; 99 CString encoded = UTF8Encoding().encode(static_cast<UChar*>(&glyph), 1, 100 URLEncodedEntitiesForUnencodables); 102 101 float escapements[1]; 103 104 charUnicodeToUTF8HACK(glyph, charArray); 105 m_platformData.font()->GetEscapements(charArray, 1, escapements); 106 GlyphMetrics metrics; 102 m_platformData.font()->GetEscapements(encoded.data(), 1, escapements); 107 103 metrics.horizontalAdvance = escapements[0] * m_platformData.font()->Size(); 108 104 return metrics;
Note: See TracChangeset
for help on using the changeset viewer.