diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2007-10-14 00:04:21 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2007-10-14 00:11:57 +0930 |
commit | 5af1b2280b2cf952624d587496158a98df0ee504 (patch) | |
tree | 93b3e6577237990b05effdecdb435eaf3fd1031a /src/cairo-type1-fallback.c | |
parent | e347a7a7c394fc2638faa2ff52e4b96545ac1ee3 (diff) | |
download | cairo-5af1b2280b2cf952624d587496158a98df0ee504.tar.gz |
Make PostScript output text selectable
The glyph names used in the Type42 and Type1 fallback fonts are now of
the form "/uniXXXX" where XXXX is the unicode character for each
glyph. When converted to pdf (eg using ps2pdf), pdf viewers are now
able to correctly extract the text.
Diffstat (limited to 'src/cairo-type1-fallback.c')
-rw-r--r-- | src/cairo-type1-fallback.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c index 37aa22cfb..626c7b5d3 100644 --- a/src/cairo-type1-fallback.c +++ b/src/cairo-type1-fallback.c @@ -465,7 +465,13 @@ cairo_type1_font_write_charstrings (cairo_type1_font_t *font, goto fail; charstring_encrypt (&data); length = _cairo_array_num_elements (&data); - _cairo_output_stream_printf (encrypted_output, "/g%d %d RD ", i, length); + if (font->scaled_font_subset->glyph_names != NULL) { + _cairo_output_stream_printf (encrypted_output, "/%s %d RD ", + font->scaled_font_subset->glyph_names[i], + length); + } else { + _cairo_output_stream_printf (encrypted_output, "/g%d %d RD ", i, length); + } _cairo_output_stream_write (encrypted_output, _cairo_array_index (&data, 0), length); @@ -527,8 +533,14 @@ 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 = 0; i < font->scaled_font_subset->num_glyphs; i++) - _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, i); + 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, "readonly def\n" "currentdict end\n" |