summaryrefslogtreecommitdiff
path: root/fitz/res_font.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-05-11 05:38:03 +0200
committerTor Andersson <tor@ghostscript.com>2010-05-11 05:38:03 +0200
commit7f06f984d64216cac990186d1aaf6e72fc4f62f6 (patch)
tree7031813e5b3393d5c25417f1fecb320dd136d970 /fitz/res_font.c
parent40fbb05a738dfe1161b46f3fb15614327833cd34 (diff)
downloadmupdf-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.c13
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);