[cairo-commit] 2 commits - src/cairo-ft-font.c
src/cairo-scaled-font.c src/cairo-xlib-surface.c
Vladimir Vukicevic
vladimir at kemper.freedesktop.org
Tue Feb 28 16:30:04 PST 2006
src/cairo-ft-font.c | 22 +---------------------
src/cairo-scaled-font.c | 6 +++---
src/cairo-xlib-surface.c | 4 ++--
3 files changed, 6 insertions(+), 26 deletions(-)
New commits:
diff-tree f5566c9b20edf04b44f60bba164c226f2718a935 (from parents)
Merge: 49b4fe10d0acdf6b9776d2908e98f2f0c596fbe5 d985a9d6696f1ed653a48d95bc401ede3ba86d5f
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Tue Feb 28 16:29:45 2006 +0100
Merge branch 'master' of git+ssh://git.cairographics.org/git/cairo
diff-tree 49b4fe10d0acdf6b9776d2908e98f2f0c596fbe5 (from 6fe93cbf5b368a9a6daf54370aa0e7735b411474)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Tue Feb 28 16:21:46 2006 +0100
Remove ft-font's usage of device offset surface fields for storing bearings
cairo-ft-font was being naughty and storing glyph bearings in the
surface device_[xy]_offset fields -- this had no effect previously,
because _cairo_surface_composite ignored those fields, but once it
starts handling device offsets itself, this causes ft text rendering
to break.
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 092838a..92b60c7 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1021,14 +1021,6 @@ _render_glyph_outline (FT_Face
return status;
}
- /*
- * Note: the font's coordinate system is upside down from ours, so the
- * Y coordinate of the control box needs to be negated.
- */
-
- (*surface)->base.device_x_offset = floor ((double) cbox.xMin / 64.0);
- (*surface)->base.device_y_offset = floor (-(double) cbox.yMax / 64.0);
-
return CAIRO_STATUS_SUCCESS;
}
@@ -1067,19 +1059,7 @@ _render_glyph_bitmap (FT_Face fac
if (error)
return CAIRO_STATUS_NO_MEMORY;
- status = _get_bitmap_surface (&glyphslot->bitmap, FALSE, font_options, surface);
- if (status)
- return status;
-
- /*
- * Note: the font's coordinate system is upside down from ours, so the
- * Y coordinate of the control box needs to be negated.
- */
-
- (*surface)->base.device_x_offset = glyphslot->bitmap_left;
- (*surface)->base.device_y_offset = -glyphslot->bitmap_top;
-
- return status;
+ return _get_bitmap_surface (&glyphslot->bitmap, FALSE, font_options, surface);
}
#if 0
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index a046904..cb0171b 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -858,7 +858,7 @@ _cairo_scaled_font_show_glyphs (cairo_sc
* they are implemented in terms of other operators in cairo-gstate.c
*/
assert (op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_CLEAR);
-
+
if (scaled_font->status)
return scaled_font->status;
@@ -920,10 +920,10 @@ _cairo_scaled_font_show_glyphs (cairo_sc
/* round glyph locations to the nearest pixel */
x = (int) floor (glyphs[i].x +
- glyph_surface->base.device_x_offset +
+ scaled_glyph->metrics.x_bearing +
0.5);
y = (int) floor (glyphs[i].y +
- glyph_surface->base.device_y_offset +
+ scaled_glyph->metrics.y_bearing +
0.5);
_cairo_pattern_init_for_surface (&glyph_pattern, &glyph_surface->base);
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index dc7d394..a62afed 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2119,8 +2119,8 @@ _cairo_xlib_surface_add_glyph (Display *
* sitting around for x and y.
*/
- glyph_info.x = -(int) glyph_surface->base.device_x_offset;
- glyph_info.y = -(int) glyph_surface->base.device_y_offset;
+ glyph_info.x = -(int) floor(scaled_glyph->metrics.x_bearing + 0.5);
+ glyph_info.y = -(int) floor(scaled_glyph->metrics.y_bearing + 0.5);
glyph_info.width = glyph_surface->width;
glyph_info.height = glyph_surface->height;
glyph_info.xOff = 0;
More information about the cairo-commit
mailing list