[win32-font] Non-fatal error from GetGlyphOutlineW(GGO_METRICS)

If GetGlyphOutlineW(GGO_METRICS) fails to retreive the metrics for the
specified glyph it returns GDI_ERROR. Like ft, do not interpret this as a
fatal error but just mark the glyph as empty.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20255
Bug 20255 -- cairo_scaled_font_glyph_extents breaks with invalid glyph id
This commit is contained in:
Chris Wilson 2009-06-10 12:59:36 +01:00
parent 81b5dc42b0
commit 610da573e9

View file

@ -977,12 +977,9 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
GGO_METRICS | GGO_GLYPH_INDEX,
&metrics, 0, NULL, &matrix) == GDI_ERROR) {
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
memset (&metrics, 0, sizeof (GLYPHMETRICS));
memset (&metrics, 0, sizeof (GLYPHMETRICS));
}
cairo_win32_scaled_font_done_font (&scaled_font->base);
if (status)
return status;
if (scaled_font->swap_axes) {
extents.x_bearing = - metrics.gmptGlyphOrigin.y / scaled_font->y_scale;
@ -1021,12 +1018,9 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
GGO_METRICS | GGO_GLYPH_INDEX,
&metrics, 0, NULL, &matrix) == GDI_ERROR) {
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
memset (&metrics, 0, sizeof (GLYPHMETRICS));
memset (&metrics, 0, sizeof (GLYPHMETRICS));
}
_cairo_win32_scaled_font_done_unscaled_font (&scaled_font->base);
if (status)
return status;
extents.x_bearing = (double)metrics.gmptGlyphOrigin.x / scaled_font->em_square;
extents.y_bearing = - (double)metrics.gmptGlyphOrigin.y / scaled_font->em_square;