diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-03 17:49:32 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-03 17:49:32 +0200 |
commit | a85b58e0548fb4e45f35bcbb7d0ee6e35bde35b4 (patch) | |
tree | 5edf7dc19d85531d7f681fbc81772f123a33ad9e | |
parent | cb1f58e1e204eab0995b57d1a973714f024e70ad (diff) | |
download | mupdf-a85b58e0548fb4e45f35bcbb7d0ee6e35bde35b4.tar.xz |
xps: Fix bugs uncovered by QualityLogicMinBar tests.
-rw-r--r-- | fitz/res_font.c | 28 | ||||
-rw-r--r-- | xps/xps_image.c | 2 | ||||
-rw-r--r-- | xps/xps_path.c | 2 | ||||
-rw-r--r-- | xps/xps_xml.c | 2 |
4 files changed, 21 insertions, 13 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index 1df8b2e6..44046451 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -176,6 +176,7 @@ fz_finalizefreetype(void) fz_error fz_newfontfromfile(fz_font **fontp, char *path, int index) { + FT_Face face; fz_error error; fz_font *font; int fterr; @@ -184,14 +185,16 @@ fz_newfontfromfile(fz_font **fontp, char *path, int index) if (error) return fz_rethrow(error, "cannot init freetype library"); - font = fz_newfont(); - - fterr = FT_New_Face(fz_ftlib, path, index, (FT_Face*)&font->ftface); + fterr = FT_New_Face(fz_ftlib, path, index, &face); if (fterr) - { - fz_free(font); return fz_throw("freetype: cannot load font: %s", ft_errorstring(fterr)); - } + + font = fz_newfont(); + font->ftface = face; + font->bbox.x0 = face->bbox.xMin * 1000 / face->units_per_EM; + font->bbox.y0 = face->bbox.yMin * 1000 / face->units_per_EM; + font->bbox.x1 = face->bbox.xMax * 1000 / face->units_per_EM; + font->bbox.y1 = face->bbox.yMax * 1000 / face->units_per_EM; *fontp = font; return fz_okay; @@ -200,6 +203,7 @@ fz_newfontfromfile(fz_font **fontp, char *path, int index) fz_error fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index) { + FT_Face face; fz_error error; fz_font *font; int fterr; @@ -210,12 +214,16 @@ fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index) font = fz_newfont(); - fterr = FT_New_Memory_Face(fz_ftlib, data, len, index, (FT_Face*)&font->ftface); + fterr = FT_New_Memory_Face(fz_ftlib, data, len, index, &face); if (fterr) - { - fz_free(font); return fz_throw("freetype: cannot load font: %s", ft_errorstring(fterr)); - } + + font = fz_newfont(); + font->ftface = face; + font->bbox.x0 = face->bbox.xMin * 1000 / face->units_per_EM; + font->bbox.y0 = face->bbox.yMin * 1000 / face->units_per_EM; + font->bbox.x1 = face->bbox.xMax * 1000 / face->units_per_EM; + font->bbox.y1 = face->bbox.yMax * 1000 / face->units_per_EM; *fontp = font; return fz_okay; diff --git a/xps/xps_image.c b/xps/xps_image.c index a5d54fea..f4b75a1b 100644 --- a/xps/xps_image.c +++ b/xps/xps_image.c @@ -47,7 +47,7 @@ xps_paint_image_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, char *base_ fz_matrix im = fz_scale(xs, -ys); im.f = ys; ctm = fz_concat(im, ctm); - ctx->dev->fillimage(ctx->dev->user, pixmap, ctm, 1.0); + ctx->dev->fillimage(ctx->dev->user, pixmap, ctm, ctx->opacity[ctx->opacity_top]); } static xps_part * diff --git a/xps/xps_path.c b/xps/xps_path.c index 5674eac2..28b34894 100644 --- a/xps/xps_path.c +++ b/xps/xps_path.c @@ -758,7 +758,7 @@ xps_clip(xps_context *ctx, fz_matrix ctm, xps_resource *dict, char *clip_att, xm path = xps_parse_path_geometry(ctx, dict, clip_tag, 0, &fill_rule); else path = fz_newpath(); - ctx->dev->clippath(ctx->dev->user, path, fill_rule, ctm); + ctx->dev->clippath(ctx->dev->user, path, fill_rule == 0, ctm); fz_freepath(path); } diff --git a/xps/xps_xml.c b/xps/xps_xml.c index 6373b6c6..8448ecef 100644 --- a/xps/xps_xml.c +++ b/xps/xps_xml.c @@ -103,7 +103,7 @@ static int xml_parse_entity(int *c, char *a) else *c = strtol(a + 2, &b, 10); if (*b == ';') - return b - a; + return b - a + 1; } else if (a[1] == 'l' && a[2] == 't' && a[3] == ';') { *c = '<'; |