diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2021-06-11 19:14:23 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2021-06-16 13:21:54 +0100 |
commit | a66f213444c5c68311a76a254b51058d0e1991a1 (patch) | |
tree | 45db090d025b7925e59b8921fc2936eb159e9c5d | |
parent | 8e2fcaab67af561a7561289452b8ac505c855d1f (diff) | |
download | ghostpdl-a66f213444c5c68311a76a254b51058d0e1991a1.tar.gz |
Fix PCL Monochrome Palette device to work with pdfwritten text.
The pdfwrite device, when called to begin_text, looks at the
color passed to it, and uses the 'high level' version of the
color (i.e. the non monochromised version).
We can avoid this by marking the ccolor_valid flags to be 0 as
the call passes through the pcl_mono device.
The implementation of this is a bit grotty.
-rw-r--r-- | base/gdevmplt.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/base/gdevmplt.c b/base/gdevmplt.c index 2c1a08918..e56a967a5 100644 --- a/base/gdevmplt.c +++ b/base/gdevmplt.c @@ -80,6 +80,28 @@ pcl_mono_dev_spec_op(gx_device *dev, int dev_spec_op, void *data, int size) return_error(gs_error_rangecheck); } +static int +pcl_mono_text_begin(gx_device *dev, gs_gstate *pgs, const gs_text_params_t *text, + gs_font *font, const gx_clip_path *pcpath, gs_text_enum_t **ppte) +{ + int valid, ret; + + /* The 'high level' version of the color has not been 'monochromized' by this + * device, so ensure that routines that we call (notably pdfwrite) don't + * think it's valid and use it. */ + valid = pgs->color[0].dev_color->ccolor_valid; + pgs->color[0].dev_color->ccolor_valid = 0; + + if (dev->child) + ret = dev_proc(dev->child, text_begin)(dev->child, pgs, text, font, pcpath, ppte); + else + ret = gx_default_text_begin(dev, pgs, text, font, pcpath, ppte); + + pgs->color[0].dev_color->ccolor_valid = valid; + + return ret; +} + static void pcl_mono_palette_initialize(gx_device *dev) { @@ -93,6 +115,7 @@ pcl_mono_palette_initialize(gx_device *dev) * tests_private/pcl/pcl5ccet/15-01.BIN for an example. */ set_dev_proc(dev, begin_typed_image, gx_default_begin_typed_image); set_dev_proc(dev, dev_spec_op, pcl_mono_dev_spec_op); + set_dev_proc(dev, text_begin, pcl_mono_text_begin); } const |