diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-05-11 05:38:03 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-05-11 05:38:03 +0200 |
commit | 7f06f984d64216cac990186d1aaf6e72fc4f62f6 (patch) | |
tree | 7031813e5b3393d5c25417f1fecb320dd136d970 /fitz/res_font.c | |
parent | 40fbb05a738dfe1161b46f3fb15614327833cd34 (diff) | |
download | mupdf-7f06f984d64216cac990186d1aaf6e72fc4f62f6.tar.xz |
Use the bbox device to get an accurate bounding box for type 3 font glyphs.
Diffstat (limited to 'fitz/res_font.c')
-rw-r--r-- | fitz/res_font.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index 90321523..145acea1 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -352,7 +352,7 @@ fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm) fz_error error; fz_matrix ctm; fz_buffer *contents; - fz_rect bbox; + fz_bbox bbox; fz_device *dev; fz_glyphcache *cache; fz_pixmap *glyph; @@ -365,11 +365,12 @@ fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm) return NULL; ctm = fz_concat(font->t3matrix, trm); - bbox = fz_transformrect(ctm, font->bbox); - bbox.x0 = floor(bbox.x0); - bbox.y0 = floor(bbox.y0); - bbox.x1 = ceil(bbox.x1); - bbox.y1 = ceil(bbox.y1); + dev = fz_newbboxdevice(&bbox); + error = font->t3runcontentstream(dev, ctm, font->t3xref, font->t3resources, contents); + if (error) + fz_catch(error, "cannot draw type3 glyph"); + fz_freedevice(dev); + glyph = fz_newpixmap(nil, bbox.x0, bbox.y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0); fz_clearpixmap(glyph, 0x00); |