summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--draw/draw_device.c4
-rw-r--r--fitz/dev_bbox.c4
-rw-r--r--fitz/dev_list.c12
-rw-r--r--fitz/fitz-internal.h6
-rw-r--r--fitz/res_path.c4
-rw-r--r--fitz/res_text.c6
-rw-r--r--xps/xps_glyphs.c2
7 files changed, 20 insertions, 18 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c
index 1a807a4c..0c95cbca 100644
--- a/draw/draw_device.c
+++ b/draw/draw_device.c
@@ -678,7 +678,7 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, int accu
/* make the mask the exact size needed */
fz_rect rect;
- fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect));
+ fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, NULL, ctm, &rect));
fz_intersect_irect(&bbox, &state->scissor);
}
else
@@ -810,7 +810,7 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke
fz_rect rect;
/* make the mask the exact size needed */
- fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect));
+ fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, stroke, ctm, &rect));
fz_intersect_irect(&bbox, &state->scissor);
fz_try(ctx)
diff --git a/fitz/dev_bbox.c b/fitz/dev_bbox.c
index 14372abe..94c88144 100644
--- a/fitz/dev_bbox.c
+++ b/fitz/dev_bbox.c
@@ -26,7 +26,7 @@ fz_bbox_fill_text(fz_device *dev, fz_text *text, const fz_matrix *ctm,
{
fz_rect *result = dev->user;
fz_rect r;
- fz_union_rect(result, fz_bound_text(dev->ctx, text, ctm, &r));
+ fz_union_rect(result, fz_bound_text(dev->ctx, text, NULL, ctm, &r));
}
static void
@@ -35,7 +35,7 @@ fz_bbox_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke,
{
fz_rect *result = dev->user;
fz_rect r;
- fz_union_rect(result, fz_bound_text(dev->ctx, text, ctm, &r));
+ fz_union_rect(result, fz_bound_text(dev->ctx, text, stroke, ctm, &r));
}
static void
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index bd96381d..826d0c46 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -314,7 +314,7 @@ fz_list_fill_text(fz_device *dev, fz_text *text, const fz_matrix *ctm,
node = fz_new_display_node(ctx, FZ_CMD_FILL_TEXT, ctm, colorspace, color, alpha);
fz_try(ctx)
{
- fz_bound_text(dev->ctx, text, ctm, &node->rect);
+ fz_bound_text(dev->ctx, text, NULL, ctm, &node->rect);
node->item.text = fz_clone_text(dev->ctx, text);
}
fz_catch(ctx)
@@ -335,8 +335,7 @@ fz_list_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, cons
node->item.text = NULL;
fz_try(ctx)
{
- fz_bound_text(dev->ctx, text, ctm, &node->rect);
- fz_adjust_rect_for_stroke(&node->rect, stroke, ctm);
+ fz_bound_text(dev->ctx, text, stroke, ctm, &node->rect);
node->item.text = fz_clone_text(dev->ctx, text);
node->stroke = fz_keep_stroke_state(dev->ctx, stroke);
}
@@ -356,7 +355,7 @@ fz_list_clip_text(fz_device *dev, fz_text *text, const fz_matrix *ctm, int accum
node = fz_new_display_node(ctx, FZ_CMD_CLIP_TEXT, ctm, NULL, NULL, 0);
fz_try(ctx)
{
- fz_bound_text(dev->ctx, text, ctm, &node->rect);
+ fz_bound_text(dev->ctx, text, NULL, ctm, &node->rect);
node->item.text = fz_clone_text(dev->ctx, text);
node->flag = accumulate;
/* when accumulating, be conservative about culling */
@@ -379,8 +378,7 @@ fz_list_clip_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke,
node = fz_new_display_node(ctx, FZ_CMD_CLIP_STROKE_TEXT, ctm, NULL, NULL, 0);
fz_try(ctx)
{
- fz_bound_text(dev->ctx, text, ctm, &node->rect);
- fz_adjust_rect_for_stroke(&node->rect, stroke, ctm);
+ fz_bound_text(dev->ctx, text, stroke, ctm, &node->rect);
node->item.text = fz_clone_text(dev->ctx, text);
node->stroke = fz_keep_stroke_state(dev->ctx, stroke);
}
@@ -400,7 +398,7 @@ fz_list_ignore_text(fz_device *dev, fz_text *text, const fz_matrix *ctm)
node = fz_new_display_node(ctx, FZ_CMD_IGNORE_TEXT, ctm, NULL, NULL, 0);
fz_try(ctx)
{
- fz_bound_text(dev->ctx, text, ctm, &node->rect);
+ fz_bound_text(dev->ctx, text, NULL, ctm, &node->rect);
node->item.text = fz_clone_text(dev->ctx, text);
}
fz_catch(ctx)
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 17a919d3..22947cf4 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -1202,8 +1202,8 @@ void fz_transform_path(fz_context *ctx, fz_path *path, const fz_matrix *transfor
fz_path *fz_clone_path(fz_context *ctx, fz_path *old);
-fz_rect *fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r);
-fz_rect *fz_adjust_rect_for_stroke(fz_rect *r, fz_stroke_state *stroke, const fz_matrix *ctm);
+fz_rect *fz_bound_path(fz_context *ctx, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r);
+fz_rect *fz_adjust_rect_for_stroke(fz_rect *r, const fz_stroke_state *stroke, const fz_matrix *ctm);
fz_stroke_state *fz_new_stroke_state(fz_context *ctx);
fz_stroke_state *fz_new_stroke_state_with_len(fz_context *ctx, int len);
@@ -1304,7 +1304,7 @@ struct fz_text_s
fz_text *fz_new_text(fz_context *ctx, fz_font *face, const fz_matrix *trm, int wmode);
void fz_add_text(fz_context *ctx, fz_text *text, int gid, int ucs, float x, float y);
void fz_free_text(fz_context *ctx, fz_text *text);
-fz_rect *fz_bound_text(fz_context *ctx, fz_text *text, const fz_matrix *ctm, fz_rect *r);
+fz_rect *fz_bound_text(fz_context *ctx, fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r);
fz_text *fz_clone_text(fz_context *ctx, fz_text *old);
void fz_print_text(fz_context *ctx, FILE *out, fz_text*);
diff --git a/fitz/res_path.c b/fitz/res_path.c
index f8d1e8ce..b2e4f6f5 100644
--- a/fitz/res_path.c
+++ b/fitz/res_path.c
@@ -253,7 +253,7 @@ static inline fz_rect *bound_expand(fz_rect *r, const fz_point *p)
}
fz_rect *
-fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r)
+fz_bound_path(fz_context *ctx, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r)
{
fz_point p;
int i = 0;
@@ -321,7 +321,7 @@ fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, const fz_
}
fz_rect *
-fz_adjust_rect_for_stroke(fz_rect *r, fz_stroke_state *stroke, const fz_matrix *ctm)
+fz_adjust_rect_for_stroke(fz_rect *r, const fz_stroke_state *stroke, const fz_matrix *ctm)
{
float expand;
diff --git a/fitz/res_text.c b/fitz/res_text.c
index 09a658b1..57e02cf9 100644
--- a/fitz/res_text.c
+++ b/fitz/res_text.c
@@ -53,7 +53,7 @@ fz_clone_text(fz_context *ctx, fz_text *old)
}
fz_rect *
-fz_bound_text(fz_context *ctx, fz_text *text, const fz_matrix *ctm, fz_rect *bbox)
+fz_bound_text(fz_context *ctx, fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *bbox)
{
fz_matrix tm, trm;
fz_rect gbox;
@@ -90,12 +90,16 @@ fz_bound_text(fz_context *ctx, fz_text *text, const fz_matrix *ctm, fz_rect *bbo
}
}
+ if (stroke)
+ fz_adjust_rect_for_stroke(bbox, stroke, ctm);
+
/* Compensate for the glyph cache limited positioning precision */
bbox->x0 -= 1;
bbox->y0 -= 1;
bbox->x1 += 1;
bbox->y1 += 1;
+
return bbox;
}
diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c
index 1838167e..1b926dfc 100644
--- a/xps/xps_glyphs.c
+++ b/xps/xps_glyphs.c
@@ -573,7 +573,7 @@ xps_parse_glyphs(xps_document *doc, const fz_matrix *ctm,
fz_atof(origin_x_att), fz_atof(origin_y_att),
is_sideways, bidi_level, indices_att, unicode_att);
- fz_bound_text(doc->ctx, text, &local_ctm, &area);
+ fz_bound_text(doc->ctx, text, NULL, &local_ctm, &area);
if (navigate_uri_att)
xps_add_link(doc, &area, base_uri, navigate_uri_att);