Bug 454098. Fix signs for baseline offsets for glyphs on Windows. r+sr=roc
authorJonathan Kew <jfkthame@gmail.com>
Wed, 28 Jan 2009 22:39:35 +1300
changeset 24333 a6690fa2baba68d4accbbc3a36779c7dc145c398
parent 24332 3c88df5744389465f26f60d423eec4a809ed98fd
child 24334 360b4a2d0aa8fa46670fd304276cfab140bbdabf
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs454098
milestone1.9.2a1pre
Bug 454098. Fix signs for baseline offsets for glyphs on Windows. r+sr=roc
gfx/cairo/README
gfx/cairo/cairo/src/cairo-win32-surface.c
gfx/cairo/win32-vertically-offset-glyph.patch
gfx/thebes/src/gfxWindowsFonts.cpp
--- a/gfx/cairo/README
+++ b/gfx/cairo/README
@@ -35,17 +35,19 @@ win32-ddb-dib.patch: fix for bug 455513;
 qpainter-type.patch: add SURFACE_TYPE_QPAINTER to cairo.h
 
 wince-fixes.patch: stubs out win32 functions we use but are not supported on win32.  Also implements ExtSelectClipRgn in terms of other functions available on wince.
 
 ft-done-face.patch: bug 467874; only destroy FT_Faces created by cairo
 
 wince-fontconfig.patch: bug 462908; fixes required to compile for windows ce.  Also allows for building without fontconfig
 
-gfx/cairo/glyph-safety-margin.patch: Change the glyph dropping safety margin from 2em to 10em for bug 460023.  Upstream commit: 28a72648ba7abe02ebd4df7234424e333b85dc9c.
+glyph-safety-margin.patch: Change the glyph dropping safety margin from 2em to 10em for bug 460023.  Upstream commit: 28a72648ba7abe02ebd4df7234424e333b85dc9c.
+
+win32-vertically-offset-glyph.patch: bug 454098; vertical positioning errors when drawing glyph runs including delta-y offsets on screen via GDI
 
 ==== pixman patches ====
 
 endian.patch: include cairo-platform.h for endian macros
 
 ==== disable printing patch ====
 
 disable-printing.patch:  allows us to use NS_PRINTING to disable printing.
--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
+++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
@@ -1742,17 +1742,18 @@ cairo_int_status_t
 
             cairo_matrix_transform_point(&device_to_logical,
                                          &next_user_x, &next_user_y);
 
             next_logical_x = _cairo_lround (next_user_x);
             next_logical_y = _cairo_lround (next_user_y);
 
             dxy_buf[j] = _cairo_lround (next_logical_x - logical_x);
-            dxy_buf[j+1] = _cairo_lround (next_logical_y - logical_y);
+            dxy_buf[j+1] = _cairo_lround (logical_y - next_logical_y);
+                /* note that GDI coordinate system is inverted */
 
             logical_x = next_logical_x;
             logical_y = next_logical_y;
         }
     }
 
     /* Using glyph indices for a Type 1 font does not work on a
      * printer DC. The win32 printing surface will convert the the
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/win32-vertically-offset-glyph.patch
@@ -0,0 +1,23 @@
+diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
+--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
++++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
+@@ -1742,17 +1742,18 @@ _cairo_win32_surface_show_glyphs (void		
+ 
+             cairo_matrix_transform_point(&device_to_logical,
+                                          &next_user_x, &next_user_y);
+ 
+             next_logical_x = _cairo_lround (next_user_x);
+             next_logical_y = _cairo_lround (next_user_y);
+ 
+             dxy_buf[j] = _cairo_lround (next_logical_x - logical_x);
+-            dxy_buf[j+1] = _cairo_lround (next_logical_y - logical_y);
++            dxy_buf[j+1] = _cairo_lround (logical_y - next_logical_y);
++                /* note that GDI coordinate system is inverted */
+ 
+             logical_x = next_logical_x;
+             logical_y = next_logical_y;
+         }
+     }
+ 
+     /* Using glyph indices for a Type 1 font does not work on a
+      * printer DC. The win32 printing surface will convert the the
--- a/gfx/thebes/src/gfxWindowsFonts.cpp
+++ b/gfx/thebes/src/gfxWindowsFonts.cpp
@@ -1927,17 +1927,17 @@ public:
                             return;
                     }
                     PRUint32 i;
                     for (i = 0; i < glyphCount; ++i) {
                         gfxTextRun::DetailedGlyph *details = &detailedGlyphs[i];
                         details->mGlyphID = mGlyphs[k + i];
                         details->mAdvance = mAdvances[k + i]*appUnitsPerDevUnit;
                         details->mXOffset = float(mOffsets[k + i].du)*appUnitsPerDevUnit*aRun->GetDirection();
-                        details->mYOffset = float(mOffsets[k + i].dv)*appUnitsPerDevUnit;
+                        details->mYOffset = - float(mOffsets[k + i].dv)*appUnitsPerDevUnit;
                     }
                     aRun->SetGlyphs(runOffset,
                         g.SetComplex(PR_TRUE, PR_TRUE, glyphCount), detailedGlyphs.Elements());
                 }
             }
             ++offset;
         }
     }