Fix a minor bug with the computation of glyph offsets in Cairo/Win32.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2006 08:33:32 +0000 (08:33 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2006 08:33:32 +0000 (08:33 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14559 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/GlyphBuffer.h
WebCore/platform/win/FontWin.cpp

index 5dcb32a..d5bcc3f 100644 (file)
@@ -1,3 +1,31 @@
+2006-05-24  Dave Hyatt <hyatt@apple.com>
+
+        Fix a bug with the computation of the Cairo glyph offsets
+        on the Win32 code path.
+
+        * ChangeLog:
+        * platform/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::add):
+        * platform/win/FontWin.cpp:
+        (WebCore::Font::drawGlyphs):
+
+2006-05-23  Dave Hyatt <hyatt@apple.com>
+
+        Disable some code in Cairo that is attempting to clip
+        runs of text to their glyph boundaries, since:
+
+        (a) Why re-measure text again when I just gave you
+        the glyph bounds anyway.
+        (b) It gets the measurements wrong.
+
+        * platform/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::add):
+        * platform/cairo/cairo/src/cairo-surface-fallback.c:
+        (_cairo_surface_fallback_show_glyphs):
+        * platform/cairo/clipping-cleartype-font-bug-patch.txt: Added.
+        * platform/win/FontWin.cpp:
+        (WebCore::Font::drawGlyphs):
+
 2006-05-23  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Eric.
 2006-05-23  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Eric.
index 7554832..94aafa6 100644 (file)
@@ -121,7 +121,6 @@ public:
 #elif PLATFORM(WIN)
         cairo_glyph_t cairoGlyph;
         cairoGlyph.index = glyph;
 #elif PLATFORM(WIN)
         cairo_glyph_t cairoGlyph;
         cairoGlyph.index = glyph;
-        cairoGlyph.x = (m_glyphs.size() ? m_glyphs[m_glyphs.size() - 1].x + m_advances[m_glyphs.size() - 1].width() : 0);
         cairoGlyph.y = 0;
         m_glyphs.append(cairoGlyph);
         m_advances.append(FloatSize(width, 0));
         cairoGlyph.y = 0;
         m_glyphs.append(cairoGlyph);
         m_advances.append(FloatSize(width, 0));
index 9c4e9b7..f6cde18 100644 (file)
@@ -40,6 +40,13 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, co
                       int from, int numGlyphs, const FloatPoint& point) const
 {
     cairo_t* context = graphicsContext->platformContext();
                       int from, int numGlyphs, const FloatPoint& point) const
 {
     cairo_t* context = graphicsContext->platformContext();
+
+    // Set the text color to use for drawing.
+    float red, green, blue, alpha;
+    Color penColor = graphicsContext->pen().color();
+    penColor.getRGBA(red, green, blue, alpha);
+    cairo_set_source_rgba(context, red, green, blue, alpha);
+    
     cairo_surface_t* surface = cairo_get_target(context);
     HDC dc = cairo_win32_surface_get_dc(surface);
 
     cairo_surface_t* surface = cairo_get_target(context);
     HDC dc = cairo_win32_surface_get_dc(surface);
 
@@ -51,12 +58,6 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, co
     cairo_set_font_face(context, font->m_font.fontFace());
     cairo_set_font_size(context, font->m_font.size());
 
     cairo_set_font_face(context, font->m_font.fontFace());
     cairo_set_font_size(context, font->m_font.size());
 
-    // Set the text color to use for drawing.
-    float red, green, blue, alpha;
-    Color penColor = graphicsContext->pen().color();
-    penColor.getRGBA(red, green, blue, alpha);
-    cairo_set_source_rgba(context, red, green, blue, alpha);
-
     SaveDC(dc);
 
     // Select the scaled font.
     SaveDC(dc);
 
     // Select the scaled font.
@@ -68,9 +69,12 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, co
 
     GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
 
 
     GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
 
+    float offset = point.x();
+
     for (unsigned i = 0; i < numGlyphs; i++) {
     for (unsigned i = 0; i < numGlyphs; i++) {
-        glyphs[i].x += point.x();
-        glyphs[i].y += point.y();
+        glyphs[i].x = offset;
+        glyphs[i].y = point.y();
+        offset += glyphBuffer.advanceAt(from + i);
     }
 
     cairo_show_glyphs(context, glyphs, numGlyphs);
     }
 
     cairo_show_glyphs(context, glyphs, numGlyphs);