summaryrefslogtreecommitdiff
path: root/src/cairo-type1-fallback.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2010-10-01 17:58:40 +0930
committerAdrian Johnson <ajohnson@redneon.com>2010-10-01 19:15:30 +0930
commit52f3db92a747eb694b94f28d6862abd573f3b378 (patch)
tree37d7c27de3067cbd083e75927abb38bc8b391b55 /src/cairo-type1-fallback.c
parent4a0e5b7ced989b2c1a17757ba17142eb55e3924d (diff)
Type 1 fallback: add support for latin subsets
For latin subsets the /Encoding array maps the latin encoding to the font glyphs.
Diffstat (limited to 'src/cairo-type1-fallback.c')
-rw-r--r--src/cairo-type1-fallback.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index b93c42348..c2d0fa6d4 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -514,12 +514,27 @@ cairo_type1_font_write_header (cairo_type1_font_t *font,
"} readonly def\n"
"/Encoding 256 array\n"
"0 1 255 {1 index exch /.notdef put} for\n");
- for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) {
- if (font->scaled_font_subset->glyph_names != NULL) {
- _cairo_output_stream_printf (font->output, "dup %d /%s put\n",
- i, font->scaled_font_subset->glyph_names[i]);
- } else {
- _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, i);
+ if (font->scaled_font_subset->is_latin) {
+ for (i = 1; i < 256; i++) {
+ int subset_glyph = font->scaled_font_subset->latin_to_subset_glyph_index[i];
+
+ if (subset_glyph > 0) {
+ if (font->scaled_font_subset->glyph_names != NULL) {
+ _cairo_output_stream_printf (font->output, "dup %d /%s put\n",
+ i, font->scaled_font_subset->glyph_names[subset_glyph]);
+ } else {
+ _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, subset_glyph);
+ }
+ }
+ }
+ } else {
+ for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) {
+ if (font->scaled_font_subset->glyph_names != NULL) {
+ _cairo_output_stream_printf (font->output, "dup %d /%s put\n",
+ i, font->scaled_font_subset->glyph_names[i]);
+ } else {
+ _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, i);
+ }
}
}
_cairo_output_stream_printf (font->output,