diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2012-02-18 21:46:31 +1030 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2012-02-18 21:49:47 +1030 |
commit | 01ea2d31cbbc12dafbe7831ef8c08a1bc78046a7 (patch) | |
tree | 99ecce54a092d7a4689c3d5a465f1f1958d76822 /src/cairo-type1-subset.c | |
parent | 09b90611a1bca771968417c589df00c0b2d3c0e6 (diff) | |
download | cairo-01ea2d31cbbc12dafbe7831ef8c08a1bc78046a7.tar.gz |
type1-subset: ensure additional glyphs required by seac operator are parsed
Diffstat (limited to 'src/cairo-type1-subset.c')
-rw-r--r-- | src/cairo-type1-subset.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index 2b837ba58..607ac8e46 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -1124,6 +1124,7 @@ cairo_type1_font_subset_write_private_dict (cairo_type1_font_subset_t *font, int length; const cairo_scaled_font_backend_t *backend; unsigned int i; + int glyph, j; /* The private dict holds hint information, common subroutines and * the actual glyph definitions (charstrings). @@ -1241,18 +1242,18 @@ skip_subrs: /* Go through the charstring of each glyph in use, get the glyph * width and figure out which extra glyphs may be required by the - * seac operator. Also subset the Subrs. */ - for (i = 0; i < font->base.num_glyphs; i++) { - if (font->glyphs[i].subset_index >= 0) { - font->build_stack.sp = 0; - font->ps_stack.num_other_subr_args = 0; - status = cairo_type1_font_subset_parse_charstring (font, - i, - font->glyphs[i].encrypted_charstring, - font->glyphs[i].encrypted_charstring_length); - if (unlikely (status)) - return status; - } + * seac operator (which may cause font->num_glyphs to increase + * while this loop is executing). Also subset the Subrs. */ + for (j = 0; j < font->num_glyphs; j++) { + glyph = font->subset_index_to_glyphs[j]; + font->build_stack.sp = 0; + font->ps_stack.num_other_subr_args = 0; + status = cairo_type1_font_subset_parse_charstring (font, + glyph, + font->glyphs[glyph].encrypted_charstring, + font->glyphs[glyph].encrypted_charstring_length); + if (unlikely (status)) + return status; } closefile_token = find_token (dict_end, font->cleartext_end, "closefile"); |