Skip to content

Commit

Permalink
Type 1 fallback: add support for latin subsets
Browse files Browse the repository at this point in the history
For latin subsets the /Encoding array maps the latin encoding to the
font glyphs.
  • Loading branch information
Adrian Johnson committed Oct 1, 2010
1 parent 4a0e5b7 commit 52f3db9
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/cairo-type1-fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 52f3db9

Please sign in to comment.