Revert "Remove ft-font's usage of device offset surface fields for storing bearings"

Bogus fix; misunderstood the relationship between the font bearings
and the computed device offsets.  Real fix on my device offsets branch.

This reverts 49b4fe10d0 commit.
This commit is contained in:
Vladimir Vukicevic 2006-03-01 11:26:30 +01:00 committed by Vladimir Vukicevic
parent f5566c9b20
commit 8176c93bc4
3 changed files with 26 additions and 6 deletions

View file

@ -1021,6 +1021,14 @@ _render_glyph_outline (FT_Face 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;
}
@ -1059,7 +1067,19 @@ _render_glyph_bitmap (FT_Face face,
if (error)
return CAIRO_STATUS_NO_MEMORY;
return _get_bitmap_surface (&glyphslot->bitmap, FALSE, font_options, surface);
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;
}
#if 0

View file

@ -858,7 +858,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
* 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_scaled_font_t *scaled_font,
/* round glyph locations to the nearest pixel */
x = (int) floor (glyphs[i].x +
scaled_glyph->metrics.x_bearing +
glyph_surface->base.device_x_offset +
0.5);
y = (int) floor (glyphs[i].y +
scaled_glyph->metrics.y_bearing +
glyph_surface->base.device_y_offset +
0.5);
_cairo_pattern_init_for_surface (&glyph_pattern, &glyph_surface->base);

View file

@ -2119,8 +2119,8 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
* sitting around for x and y.
*/
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.x = -(int) glyph_surface->base.device_x_offset;
glyph_info.y = -(int) glyph_surface->base.device_y_offset;
glyph_info.width = glyph_surface->width;
glyph_info.height = glyph_surface->height;
glyph_info.xOff = 0;