void
fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid)
{
- fz_buffer *contents;
fz_device *dev;
fz_rect d1_rect;
- contents = font->t3procs[gid];
- if (!contents)
- return;
-
/* We've not already loaded this one! */
assert(font->t3lists[gid] == NULL);
FZ_DEVFLAG_MITERLIMIT_UNDEFINED |
FZ_DEVFLAG_LINEWIDTH_UNDEFINED;
- /* Avoid cycles in glyph content streams referring to the glyph itself.
- * Remember to restore the content stream below, regardless of exceptions
- * or a successful run of the glyph. */
- font->t3procs[gid] = NULL;
-
fz_try(ctx)
{
- font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, fz_identity, NULL, NULL);
+ font->t3run(ctx, font->t3doc, font->t3resources, font->t3procs[gid], dev, fz_identity, NULL, NULL);
fz_close_device(ctx, dev);
font->t3flags[gid] = dev->flags;
d1_rect = dev->d1_rect;
fz_always(ctx)
{
fz_drop_device(ctx, dev);
- font->t3procs[gid] = contents;
}
fz_catch(ctx)
fz_rethrow(ctx);
fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, fz_matrix trm, void *gstate, fz_default_colorspaces *def_cs)
{
fz_matrix ctm;
- void *contents;
if (gid < 0 || gid > 255)
return;
- contents = font->t3procs[gid];
- if (!contents)
- return;
-
if (font->t3flags[gid] & FZ_DEVFLAG_MASK)
{
if (font->t3flags[gid] & FZ_DEVFLAG_COLOR)
fz_warn(ctx, "type3 glyph doesn't specify masked or colored");
}
- /* Avoid cycles in glyph content streams referring to the glyph itself.
- * Remember to restore the content stream below, regardless of exceptions
- * or a successful run of the glyph. */
- font->t3procs[gid] = NULL;
-
- fz_try(ctx)
- {
- ctm = fz_concat(font->t3matrix, trm);
- font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, ctm, gstate, def_cs);
- }
- fz_always(ctx)
- font->t3procs[gid] = contents;
- fz_catch(ctx)
- fz_rethrow(ctx);
+ ctm = fz_concat(font->t3matrix, trm);
+ font->t3run(ctx, font->t3doc, font->t3resources, font->t3procs[gid], dev, ctm, gstate, def_cs);
}
fz_rect