From 7c268bc8382350ab803eecb898d4650999a3a6bb Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 1 Oct 2010 18:01:07 +0930 Subject: [PATCH] PS: Enable support for latin subsets Make PS TrueType embedding use the winansi glyph mapping for latin subsets. Enable use of latin subsets in PS. --- src/cairo-ps-surface.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index c73214e00..1c5d7a90a 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -426,14 +426,29 @@ _cairo_ps_surface_emit_truetype_font_subset (cairo_ps_surface_t *surface, /* FIXME: Figure out how subset->x_max etc maps to the /FontBBox */ - for (i = 1; i < font_subset->num_glyphs; i++) { - if (font_subset->glyph_names != NULL) { - _cairo_output_stream_printf (surface->final_stream, - "Encoding %d /%s put\n", - i, font_subset->glyph_names[i]); - } else { - _cairo_output_stream_printf (surface->final_stream, - "Encoding %d /g%d put\n", i, i); + if (font_subset->is_latin) { + for (i = 1; i < 256; i++) { + if (font_subset->latin_to_subset_glyph_index[i] > 0) { + if (font_subset->glyph_names != NULL) { + _cairo_output_stream_printf (surface->final_stream, + "Encoding %d /%s put\n", + i, font_subset->glyph_names[font_subset->latin_to_subset_glyph_index[i]]); + } else { + _cairo_output_stream_printf (surface->final_stream, + "Encoding %d /g%ld put\n", i, font_subset->latin_to_subset_glyph_index[i]); + } + } + } + } else { + for (i = 1; i < font_subset->num_glyphs; i++) { + if (font_subset->glyph_names != NULL) { + _cairo_output_stream_printf (surface->final_stream, + "Encoding %d /%s put\n", + i, font_subset->glyph_names[i]); + } else { + _cairo_output_stream_printf (surface->final_stream, + "Encoding %d /g%d put\n", i, i); + } } } @@ -956,6 +971,7 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream, goto CLEANUP_OUTPUT_STREAM; } + _cairo_scaled_font_subsets_enable_latin_subset (surface->font_subsets, TRUE); surface->has_creation_date = FALSE; surface->eps = FALSE; surface->ps_level = CAIRO_PS_LEVEL_3;