Changeset 96378 in webkit
- Timestamp:
- Sep 29, 2011 4:47:40 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96376 r96378 1 2011-09-29 Martin Robinson <mrobinson@igalia.com> 2 3 [Freetype] Some text in Planet GNOME renders in the wrong place 4 https://bugs.webkit.org/show_bug.cgi?id=69099 5 6 Reviewed by Dirk Schulze. 7 8 Add a test which exercises this issue. It seems the problem grows worse 9 as the y component of the text position increases, so position the text 10 about halfway down the page. 11 12 * platform/gtk/fonts/synthetic-oblique-positioning-expected.png: Added. 13 * platform/gtk/fonts/synthetic-oblique-positioning-expected.txt: Added. 14 * platform/gtk/fonts/synthetic-oblique-positioning.html: Added. 15 1 16 2011-09-29 Adam Barth <abarth@webkit.org> 2 17 -
trunk/Source/WebCore/ChangeLog
r96374 r96378 1 2011-09-29 Martin Robinson <mrobinson@igalia.com> 2 3 [Freetype] Some text in Planet GNOME renders in the wrong place 4 https://bugs.webkit.org/show_bug.cgi?id=69099 5 6 Reviewed by Dirk Schulze. 7 8 Test: platform/gtk/fonts/synthetic-oblique-positioning.html 9 10 Fold the oblique transform into the font matrix itself rather than transforming 11 the CTM of the context at render time. Not only does this fix the issue, it 12 prevents unnecessary work on every paint. 13 14 * platform/graphics/cairo/FontCairo.cpp: 15 No longer set the synthetic oblique transformation matrix on the context 16 when rendering the text. Instead it is now folded into the TM of the font 17 itself. 18 * platform/graphics/freetype/FontPlatformDataFreeType.cpp: 19 (WebCore::FontPlatformData::initializeWithFontFace): Fold the oblique transform into the scaled font. 20 * platform/graphics/win/FontPlatformDataCairoWin.cpp: 21 (WebCore::FontPlatformData::FontPlatformData): Ditto. 22 1 23 2011-09-29 Dan Bernstein <mitz@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp
r95901 r96378 44 44 namespace WebCore { 45 45 46 static const float gSyntheticObliqueSkew = -tanf(14 * acosf(0) / 90);47 48 static void prepareContextForGlyphDrawing(cairo_t* context, const SimpleFontData* font)49 {50 cairo_set_scaled_font(context, font->platformData().scaledFont());51 52 if (font->platformData().syntheticOblique()) {53 cairo_matrix_t mat = {1, 0, gSyntheticObliqueSkew, 1, 0, 0};54 cairo_transform(context, &mat);55 }56 }57 58 46 static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs) 59 47 { 60 48 cairo_matrix_t originalTransform; 61 49 float syntheticBoldOffset = font->syntheticBoldOffset(); 62 if ( font->platformData().syntheticOblique() ||syntheticBoldOffset)50 if (syntheticBoldOffset) 63 51 cairo_get_matrix(context, &originalTransform); 64 52 65 prepareContextForGlyphDrawing(context, font);53 cairo_set_scaled_font(context, font->platformData().scaledFont()); 66 54 cairo_show_glyphs(context, glyphs, numGlyphs); 67 55 … … 71 59 } 72 60 73 if ( font->platformData().syntheticOblique() ||syntheticBoldOffset)61 if (syntheticBoldOffset) 74 62 cairo_set_matrix(context, &originalTransform); 75 63 } … … 140 128 141 129 // This may disturb the CTM, but we are going to call cairo_restore soon after. 142 prepareContextForGlyphDrawing(cr, font);130 cairo_set_scaled_font(cr, font->platformData().scaledFont()); 143 131 cairo_glyph_path(cr, glyphs, numGlyphs); 144 132 cairo_stroke(cr); -
trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
r90041 r96378 271 271 } 272 272 273 if (syntheticOblique()) { 274 static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90); 275 cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0}; 276 cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix); 277 } 278 273 279 m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options); 274 280 cairo_font_options_destroy(options); -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
r95901 r96378 80 80 cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY); 81 81 82 if (syntheticOblique()) { 83 static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90); 84 cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0}; 85 cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix); 86 } 87 82 88 m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options); 83 89 cairo_font_options_destroy(options);
Note: See TracChangeset
for help on using the changeset viewer.