[cairo] glyph extents
Jonathan Kew
jonathan at jfkew.plus.com
Thu Feb 19 02:56:00 PST 2009
On 18 Feb 2009, at 23:16, Jeff Muizelaar wrote:
> Does GetGlyphOutlineW return the proper extents if you change from
> GGO_METRICS to GGO_GRAY8_BITMAP?
No, that doesn't help. I still see the same clipped glyphs in my
little Cairo test program, when cairo-surface-fallback.c uses these
extents to clip its painting operation.
Very likely the extents it's returning would be correct for a
"standard-smoothing" grayscale bitmap; the trouble is that ClearType
wants to paint pixels that fall outside of that area, and they don't
seem to offer us an API for getting *those* extents. So AFAICT there's
no reasonable option except adding a "safety margin" to the results
from GetGlyphOutlineW.
JK
> a la.
>
> diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
> index e9abfda..6c03c5f 100644
> --- a/src/cairo-win32-font.c
> +++ b/src/cairo-win32-font.c
> @@ -975,7 +975,7 @@ _cairo_win32_scaled_font_init_glyph_metrics
> (cairo_win32_scaled_font_t *scaled_f
> return status;
>
> if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
> - GGO_METRICS | GGO_GLYPH_INDEX,
> + GGO_GRAY8_BITMAP | 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));
> @@ -1019,7 +1019,7 @@ _cairo_win32_scaled_font_init_glyph_metrics
> (cairo_win32_scaled_font_t *scaled_f
> return status;
>
> if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
> - GGO_METRICS | GGO_GLYPH_INDEX,
> + GGO_GRAY8_BITMAP | 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));
>
> -Jeff
More information about the cairo
mailing list