Comment 19 for bug 185700

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

(In reply to comment #3)
> If I understand postscript and pdf surfaces correctly, they usually only
> position a glyph, without rendering it, essentially making a guess about how
> the glyph will be rendered on the final device. We should probably guess the
> rendering options to use for measuring rather than looking at fontconfig
> settings.

PS/PDF can position each individual glyph or draw strings of glyphs where each glyph is positioned at its natural glyph advance. All hinting should be disabled when generating PDF/PS output as it is a device independent format and no assumptions can be made about what devices it will be rendered on.

The cairo PDF and PS surfaces default to all hinting off:

static void
_cairo_pdf_surface_get_font_options (void *abstract_surface,
         cairo_font_options_t *options)
{
    _cairo_font_options_init_default (options);

    cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
    cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
    cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
}

> When fonts can't be embedded, I assume the glyph is rendered to an image with
> pixels. In this case we probably should use (some of) the fontconfig
> settings, though I'm not sure it's worth the effort.

I'm not sure what you mean by "When fonts can't be embedded" as cairo PDF/PS always embeds (and subsets) the fonts used. If subsetting fails it will fallback to embedding a font generated from the unhinted outlines of the glyphs. Only bitmap fonts result in a embedded bitmap font generated from the glyphs rendered at 72dpi.