summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-op-run.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2015-02-20 14:56:40 +0000
committerRobin Watts <robin.watts@artifex.com>2015-02-24 10:09:51 +0000
commit61de5ad4c1afb03cbec8a239162a7e657d57fc2d (patch)
tree449a7f6ddba624b1682cd0c7f5f067b03290cf12 /source/pdf/pdf-op-run.c
parent8a8b535da2461ba858a32c4f346f08abca875daa (diff)
downloadmupdf-61de5ad4c1afb03cbec8a239162a7e657d57fc2d.tar.xz
Bug 695843: Tweak bboxes of type3 fonts; honour the d1 values.
The example file for this bug has an invalid font bbox. The current code uses this bbox (or some multiple of it) to clip the glyphs size. In the new code, when we convert the glyphs to display lists we watch for the bbox given in any d1 operator used. If we find one, we gather the rectangle specified and store it as the glyph rectangle in the fz_font. If we then attempt to bound a glyph that used d1, it happens instantly without needing to run the list. This seems to match acrobats behaviour. Tests indicate that Acrobat never clips d0 glyphs, so our behaviour is still different here, but I am not changing this at the moment. Also, I note that t3flags should be a un unsigned short but are currently just a char. Fix that too. Also fix some missing code in fz_new_font that would cause leaks if mallocs failed.
Diffstat (limited to 'source/pdf/pdf-op-run.c')
-rw-r--r--source/pdf/pdf-op-run.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index c09abb45..204d3c23 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -2367,7 +2367,7 @@ static void pdf_run_d1(pdf_csi *csi, void *state)
if (pr->nested_depth > 1)
return;
- pr->dev->flags |= FZ_DEVFLAG_MASK;
+ pr->dev->flags |= FZ_DEVFLAG_MASK | FZ_DEVFLAG_BBOX_DEFINED;
pr->dev->flags &= ~(FZ_DEVFLAG_FILLCOLOR_UNDEFINED |
FZ_DEVFLAG_STROKECOLOR_UNDEFINED |
FZ_DEVFLAG_STARTCAP_UNDEFINED |
@@ -2376,6 +2376,11 @@ static void pdf_run_d1(pdf_csi *csi, void *state)
FZ_DEVFLAG_LINEJOIN_UNDEFINED |
FZ_DEVFLAG_MITERLIMIT_UNDEFINED |
FZ_DEVFLAG_LINEWIDTH_UNDEFINED);
+
+ pr->dev->d1_rect.x0 = fz_min(csi->stack[2], csi->stack[4]);
+ pr->dev->d1_rect.y0 = fz_min(csi->stack[3], csi->stack[5]);
+ pr->dev->d1_rect.x1 = fz_max(csi->stack[2], csi->stack[4]);
+ pr->dev->d1_rect.y1 = fz_max(csi->stack[3], csi->stack[5]);
}
static void pdf_run_f(pdf_csi *csi, void *state)