diff options
-rw-r--r-- | fitz/res_font.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index 9200df1b..105dd917 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -380,51 +380,51 @@ extern fz_colorspace *pdf_devicegray; fz_error fz_rendert3glyph(fz_glyph *glyph, fz_font *font, int gid, fz_matrix trm) { - fz_error error; - fz_renderer *gc; - fz_tree *tree; - fz_matrix ctm; - fz_irect bbox; - - /* TODO: make it reentrant */ - static fz_pixmap *pixmap = nil; - if (pixmap) - { - fz_droppixmap(pixmap); - pixmap = nil; - } - - if (gid < 0 || gid > 255) - return fz_throw("assert: glyph out of range"); - - tree = font->t3procs[gid]; - if (!tree) - { - glyph->w = 0; - glyph->h = 0; - return fz_okay; - } + fz_error error; + fz_renderer *gc; + fz_tree *tree; + fz_matrix ctm; + fz_irect bbox; + + /* TODO: make it reentrant */ + static fz_pixmap *pixmap = nil; + if (pixmap) + { + fz_droppixmap(pixmap); + pixmap = nil; + } + + if (gid < 0 || gid > 255) + return fz_throw("assert: glyph out of range"); - ctm = fz_concat(font->t3matrix, trm); - bbox = fz_roundrect(fz_boundtree(tree, ctm)); + tree = font->t3procs[gid]; + if (!tree) + { + glyph->w = 0; + glyph->h = 0; + return fz_okay; + } - error = fz_newrenderer(&gc, pdf_devicegray, 1, 4096); - if (error) - return fz_rethrow(error, "cannot create renderer"); - error = fz_rendertree(&pixmap, gc, tree, ctm, bbox, 0); - fz_droprenderer(gc); - if (error) - return fz_rethrow(error, "cannot render glyph"); + ctm = fz_concat(font->t3matrix, trm); + bbox = fz_roundrect(fz_boundtree(tree, ctm)); - assert(pixmap->n == 1); + error = fz_newrenderer(&gc, pdf_devicegray, 1, 4096); + if (error) + return fz_rethrow(error, "cannot create renderer"); + error = fz_rendertree(&pixmap, gc, tree, ctm, bbox, 0); + fz_droprenderer(gc); + if (error) + return fz_rethrow(error, "cannot render glyph"); + + assert(pixmap->n == 1); - glyph->x = pixmap->x; - glyph->y = pixmap->y; - glyph->w = pixmap->w; - glyph->h = pixmap->h; - glyph->samples = pixmap->samples; + glyph->x = pixmap->x; + glyph->y = pixmap->y; + glyph->w = pixmap->w; + glyph->h = pixmap->h; + glyph->samples = pixmap->samples; - return fz_okay; + return fz_okay; } void |