summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2021-02-16 22:35:57 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2021-02-17 10:12:55 -0800
commit7a3df79b2b0e0725753a0eac84fb205341cc9fed (patch)
tree28c7d75e568dd001a08068b2294e4a4bab037234 /xps
parent66200b6fafe8b4de6fd11d1b38ccb85eb3d37d83 (diff)
downloadghostpdl-7a3df79b2b0e0725753a0eac84fb205341cc9fed.tar.gz
Bug 703404: XPS to pdfwrite patterns
Patterns that are filled with glyphs and then subsequently filled with another pattern (Visual brush in XPS) was not working when going to pdfwrite due to the fact that gs_text_begin gets called by the XPS interpreter before we have finished the pattern fill of the glyph. This ends up referencing the pattern that is not done which ends badly for high level patterns. Instead if we are already in a high level pattern, set the color to just a gray. Then after the gs_text_begin, the XPS interpreter sets the brush to the visual brush which is subsequently collected. Fixing this, has revealed another XPS to PDF bug where we are not doing shading fills of glyphs correctly (at least when dealing with patterns).
Diffstat (limited to 'xps')
-rw-r--r--xps/ghostxps.h6
-rw-r--r--xps/xpsglyphs.c6
-rw-r--r--xps/xpspath.c4
-rw-r--r--xps/xpstop.c1
4 files changed, 17 insertions, 0 deletions
diff --git a/xps/ghostxps.h b/xps/ghostxps.h
index cf029db4d..ce07816fd 100644
--- a/xps/ghostxps.h
+++ b/xps/ghostxps.h
@@ -445,6 +445,12 @@ struct xps_context_s
* 1=nonzero, 0=evenodd
*/
int fill_rule;
+
+ /* Enable us to detect that we are currently sending high level
+ pattern to a device. If during this process we encounter
+ a glyph that has a pattern, make sure to set the color
+ space appropriately prior to setting the text. */
+ bool in_high_level_pattern;
};
int xps_process_file(xps_context_t *ctx, const char *filename);
diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c
index f419dd58a..2dccc0bca 100644
--- a/xps/xpsglyphs.c
+++ b/xps/xpsglyphs.c
@@ -809,6 +809,12 @@ xps_parse_glyphs(xps_context_t *ctx,
if (fill_tag)
{
+ if (ctx->in_high_level_pattern)
+ {
+ float value = 0;
+ xps_set_color(ctx, ctx->gray, &value);
+ }
+
ctx->fill_rule = 1; /* always use non-zero winding rule for char paths */
code = xps_parse_glyphs_imp(ctx, font, font_size,
atof(origin_x_att), atof(origin_y_att),
diff --git a/xps/xpspath.c b/xps/xpspath.c
index d349239f3..b60c6b393 100644
--- a/xps/xpspath.c
+++ b/xps/xpspath.c
@@ -69,13 +69,17 @@ xps_fill(xps_context_t *ctx)
gs_newpath(ctx->pgs);
else if (ctx->fill_rule == 0) {
if (gs_eofill(ctx->pgs) == gs_error_Remap_Color){
+ ctx->in_high_level_pattern = true;
xps_high_level_pattern(ctx);
+ ctx->in_high_level_pattern = false;
gs_eofill(ctx->pgs);
}
}
else {
if (gs_fill(ctx->pgs) == gs_error_Remap_Color){
+ ctx->in_high_level_pattern = true;
xps_high_level_pattern(ctx);
+ ctx->in_high_level_pattern = false;
gs_fill(ctx->pgs);
}
}
diff --git a/xps/xpstop.c b/xps/xpstop.c
index 5c0c335d1..e3b949beb 100644
--- a/xps/xpstop.c
+++ b/xps/xpstop.c
@@ -142,6 +142,7 @@ xps_impl_allocate_interp_instance(pl_interp_implementation_t *impl,
ctx->file = NULL;
ctx->zip_count = 0;
ctx->zip_table = NULL;
+ ctx->in_high_level_pattern = false;
/* Gray, RGB and CMYK profiles set when color spaces installed in graphics lib */
ctx->gray_lin = gs_cspace_new_ICC(ctx->memory, ctx->pgs, -1);