summaryrefslogtreecommitdiff
path: root/base/gxchar.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2019-07-22 13:07:59 +0100
committerKen Sharp <ken.sharp@artifex.com>2019-07-22 13:07:59 +0100
commit909a87a15b5f8fede1f6bfeac2005327a7ca1601 (patch)
treee288a9db0531e3921c76743e3853f931673e4f4b /base/gxchar.c
parent239d9035a011c212b015951bb2d75114ba11bee0 (diff)
downloadghostpdl-909a87a15b5f8fede1f6bfeac2005327a7ca1601.tar.gz
Permit extra widths on space glyphs (PDF Tw value) even for xyshow
For the benefit of the pdfi interpreter. With the PDF in PostScript current interpreter, we apply Widths using a cshow procedure. The pdfi interpreter instead uses the x_widths and y_widths arrays, intended for use with the PostScript xyshow operator instead. However, the existing code doesn't add the extra width to space glyphs if we have TEXT_REPLACE_WIDTHS set (ie an xyshow). Here we move the code for the additional width out of the 'else' clause in show_move() so that we always have the value available. We then apply the dx and/or dy values in both cases. We also need to relax the 'invalid' checking which is performed at a higher level in the code (gx_device_text_begin) because this combination is explicitly barred there and returns an error.
Diffstat (limited to 'base/gxchar.c')
-rw-r--r--base/gxchar.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/base/gxchar.c b/base/gxchar.c
index 0188b4398..0c86e983c 100644
--- a/base/gxchar.c
+++ b/base/gxchar.c
@@ -890,6 +890,22 @@ show_move(gs_show_enum * penum)
{
gs_gstate *pgs = penum->pgs;
int code;
+ double dx = 0, dy = 0;
+
+ /* Specifically for applying PDF word spacing, if single_byte_space == true
+ we'll only apply the delta for single byte character codes == space.s_char
+ See psi/zchar.c zpdfwidthshow and zpdfawidthshow for more detail
+ */
+ if (SHOW_IS_ADD_TO_SPACE(penum)
+ && (!penum->single_byte_space
+ || penum->bytes_decoded == 1)) {
+ gs_char chr = gx_current_char((const gs_text_enum_t *)penum);
+
+ if (chr == penum->text.space.s_char) {
+ dx = penum->text.delta_space.x;
+ dy = penum->text.delta_space.y;
+ }
+ }
if (SHOW_IS(penum, TEXT_REPLACE_WIDTHS)) {
gs_point dpt;
@@ -897,25 +913,12 @@ show_move(gs_show_enum * penum)
code = gs_text_replaced_width(&penum->text, penum->xy_index - 1, &dpt);
if (code < 0)
return code;
+ dpt.x += dx;
+ dpt.y += dy;
code = gs_distance_transform2fixed(&pgs->ctm, dpt.x, dpt.y, &penum->wxy);
if (code < 0)
return code;
} else {
- double dx = 0, dy = 0;
- /* Specifically for applying PDF word spacing, if single_byte_space == true
- we'll only apply the delta for single byte character codes == space.s_char
- See psi/zchar.c zpdfwidthshow and zpdfawidthshow for more detail
- */
- if (SHOW_IS_ADD_TO_SPACE(penum)
- && (!penum->single_byte_space
- || penum->bytes_decoded == 1)) {
- gs_char chr = gx_current_char((const gs_text_enum_t *)penum);
-
- if (chr == penum->text.space.s_char) {
- dx = penum->text.delta_space.x;
- dy = penum->text.delta_space.y;
- }
- }
if (SHOW_IS_ADD_TO_ALL(penum)) {
dx += penum->text.delta_all.x;
dy += penum->text.delta_all.y;