Changeset 44268 in webkit
- Timestamp:
- May 29, 2009 12:53:41 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r44266 r44268 1 2009-05-29 Alexander Macdonald <alexmac@adobe.com> 2 3 Reviewed by Darin Adler. 4 5 Added support for synthetic bold/oblique font rendering 6 on platforms that use cairo. 7 8 * platform/graphics/SimpleFontData.h: 9 * platform/graphics/cairo/FontCairo.cpp: 10 (WebCore::Font::drawGlyphs): 11 * platform/graphics/gtk/SimpleFontDataGtk.cpp: 12 (WebCore::SimpleFontData::platformInit): 13 * platform/graphics/gtk/SimpleFontDataPango.cpp: 14 (WebCore::SimpleFontData::platformInit): 15 * platform/graphics/win/SimpleFontDataCairoWin.cpp: 16 (WebCore::SimpleFontData::platformInit): 17 1 18 2009-05-29 Chris Fleizach <cfleizach@apple.com> 2 19 -
trunk/WebCore/platform/graphics/SimpleFontData.h
r43007 r44268 184 184 mutable SimpleFontData* m_smallCapsFontData; 185 185 186 #if PLATFORM(CG) || PLATFORM( WIN)186 #if PLATFORM(CG) || PLATFORM(CAIRO) 187 187 float m_syntheticBoldOffset; 188 188 #endif -
trunk/WebCore/platform/graphics/cairo/FontCairo.cpp
r41279 r44268 37 37 #include "TransformationMatrix.h" 38 38 39 #define SYNTHETIC_OBLIQUE_ANGLE 14 40 39 41 namespace WebCore { 40 42 … … 49 51 GlyphBufferGlyph* glyphs = (GlyphBufferGlyph*)glyphBuffer.glyphs(from); 50 52 51 float offset = point.x();53 float offset = 0.0f; 52 54 for (int i = 0; i < numGlyphs; i++) { 53 55 glyphs[i].x = offset; 54 glyphs[i].y = point.y();56 glyphs[i].y = 0.0f; 55 57 offset += glyphBuffer.advanceAt(from + i); 56 58 } 57 59 58 60 Color fillColor = context->fillColor(); 61 62 // Synthetic Oblique 63 if(font->platformData().syntheticOblique()) { 64 cairo_matrix_t mat = {1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, point.x(), point.y()}; 65 cairo_transform(cr, &mat); 66 } else { 67 cairo_translate(cr, point.x(), point.y()); 68 } 59 69 60 70 // Text shadow, inspired by FontMac … … 78 88 cairo_translate(cr, shadowSize.width(), shadowSize.height()); 79 89 cairo_show_glyphs(cr, glyphs, numGlyphs); 90 if (font->m_syntheticBoldOffset) { 91 cairo_save(cr); 92 cairo_translate(cr, font->m_syntheticBoldOffset, 0); 93 cairo_show_glyphs(cr, glyphs, numGlyphs); 94 cairo_restore(cr); 95 } 80 96 81 97 cairo_restore(cr); … … 104 120 } 105 121 cairo_show_glyphs(cr, glyphs, numGlyphs); 122 if (font->m_syntheticBoldOffset) { 123 cairo_save(cr); 124 cairo_translate(cr, font->m_syntheticBoldOffset, 0); 125 cairo_show_glyphs(cr, glyphs, numGlyphs); 126 cairo_restore(cr); 127 } 106 128 } 107 129 -
trunk/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp
r43007 r44268 66 66 m_spaceWidth = static_cast<int>(text_extents.x_advance); 67 67 m_lineGap = m_lineSpacing - m_ascent - m_descent; 68 m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f; 68 69 } 69 70 -
trunk/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp
r43007 r44268 65 65 m_spaceWidth = static_cast<int>(text_extents.x_advance); 66 66 m_lineGap = m_lineSpacing - m_ascent - m_descent; 67 m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f; 67 68 } 68 69 -
trunk/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
r43007 r44268 49 49 m_isSystemFont = false; 50 50 m_syntheticBoldOffset = 0; 51 52 m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f; 51 53 52 54 if (m_font.useGDI())
Note: See TracChangeset
for help on using the changeset viewer.