[cairo-bugs] [Bug 20779] text improperly positioned - scaled font glyph device transform misapplied

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Mar 24 12:51:39 PDT 2009


http://bugs.freedesktop.org/show_bug.cgi?id=20779





--- Comment #10 from Behdad Esfahbod <freedesktop at behdad.org>  2009-03-24 12:51:37 PST ---
These snippets are from cairo-ft.c in master:
...
    /*
     * Note: the font's coordinate system is upside down from ours, so the
     * Y coordinate of the control box needs to be negated.  Moreover, device
     * offsets are position of glyph origin relative to top left while xMin
     * and yMax are offsets of top left relative to origin.  Another negation.
     */
    cairo_surface_set_device_offset (&(*surface)->base,
                                     floor (-(double) cbox.xMin / 64.0),
                                     floor (+(double) cbox.yMax / 64.0));
...
    /*
     * Note: the font's coordinate system is upside down from ours, so the
     * Y coordinate of the control box needs to be negated.  Moreover, device
     * offsets are position of glyph origin relative to top left while
     * bitmap_left and bitmap_top are offsets of top left relative to origin.
     * Another negation.
     */
    cairo_surface_set_device_offset (&(*surface)->base,
                                     -glyphslot->bitmap_left,
                                     +glyphslot->bitmap_top);
...
    cairo_surface_set_device_offset (&(*surface)->base,
                                     _cairo_lround (origin_x),
                                     _cairo_lround (origin_y));
...


These ones are in the patch you are using:
...
+    /*
+     * Note: the font's coordinate system is upside down from ours, so the
+     * Y coordinate of the control box needs to be negated.
+     */
+    cairo_surface_set_device_offset (&(*surface)->base,
+                                    floor ((double) cbox.xMin / 64.0),
+                                    floor (-(double) cbox.yMax / 64.0));
...
+    /*
+     * Note: the font's coordinate system is upside down from ours, so the
+     * Y coordinate of the control box needs to be negated.
+     */
+    cairo_surface_set_device_offset (&(*surface)->base,
+                                    glyphslot->bitmap_left,
+                                    -glyphslot->bitmap_top);
...
+    cairo_surface_set_device_offset (&(*surface)->base,
+                                    - _cairo_lround (origin_x),
+                                    - _cairo_lround (origin_y));
...

Just search for cairo_surface_set_device_offset in your patch and negate both
arguments and voila.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list