commit 2a1a24b8d1b67ba087d0e70c15125a8dabe72608 Author: Brian Ewins Date: Sat Jan 20 13:21:43 2007 +0000 [ATSUI] Handle deleted glyphs correctly. This code ensures that deleted glyphs are not drawn. diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 49b44c8..130dfda 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -522,6 +522,13 @@ _cairo_atsui_font_init_glyph_metrics (cairo_atsui_font_t *scaled_font, CGPoint device_advance, font_advance; CGRect rect; + if (theGlyph == kATSDeletedGlyphcode) { + _cairo_scaled_glyph_set_metrics (scaled_glyph, + &scaled_font->base, + &extents); + return CAIRO_STATUS_SUCCESS; + } + /* We calculate the advance from the screen metrics. We * could probably take this from the glyph path. */ @@ -663,6 +670,7 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font, static ATSCubicLineToUPP lineProc = NULL; static ATSCubicCurveToUPP curveProc = NULL; static ATSCubicClosePathUPP closePathProc = NULL; + GlyphID theGlyph = _cairo_scaled_glyph_index (scaled_glyph); OSStatus err; cairo_atsui_scaled_path_t scaled_path; cairo_matrix_t *font_to_device = &scaled_font->base.scale; @@ -670,6 +678,17 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font, double xscale; double yscale; + scaled_path.path = _cairo_path_fixed_create (); + if (!scaled_path.path) + return CAIRO_STATUS_NO_MEMORY; + + if (theGlyph == kATSDeletedGlyphcode) { + _cairo_scaled_glyph_set_path (scaled_glyph, &scaled_font->base, + scaled_path.path); + + return CAIRO_STATUS_SUCCESS; + } + /* extract the rotation/shear component of the scale matrix. */ _cairo_matrix_compute_scale_factors (font_to_device, &xscale, &yscale, 1); cairo_matrix_init (&unscaled_font_to_device, @@ -680,9 +699,6 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font, cairo_matrix_scale (&unscaled_font_to_device, 1.0/xscale, 1.0/yscale); scaled_path.scale = &unscaled_font_to_device; - scaled_path.path = _cairo_path_fixed_create (); - if (!scaled_path.path) - return CAIRO_STATUS_NO_MEMORY; if (moveProc == NULL) { moveProc = NewATSCubicMoveToUPP(_move_to); @@ -692,7 +708,7 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font, } err = ATSUGlyphGetCubicPaths(scaled_font->style, - _cairo_scaled_glyph_index (scaled_glyph), + theGlyph, moveProc, lineProc, curveProc, @@ -723,6 +739,16 @@ _cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font, double left, bottom; CGRect bbox; + if (theGlyph == kATSDeletedGlyphcode) { + surface = (cairo_image_surface_t *)cairo_image_surface_create (CAIRO_FORMAT_A8, 2, 2); + if (!surface) + return CAIRO_STATUS_NO_MEMORY; + _cairo_scaled_glyph_set_surface (scaled_glyph, + &base, + surface); + return CAIRO_STATUS_SUCCESS; + } + /* Compute a box to contain the glyph mask. * Horizontal sizes come from the glyph typographic metrics. * It is possible that this might result in clipped text