From 3e65ed4eb3a8aa8cd6375a7029ac3b61a35a1157 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 31 Jan 2012 17:58:34 +0000 Subject: Fix big 692824: incorrect application of word space. Word space should only be applied when the codepoint is 32, and is read from a single byte encoding region. Ghostscript gets this wrong too. --- pdf/pdf_interpret.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pdf/pdf_interpret.c') diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index 3b774d71..63f208a1 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -816,13 +816,14 @@ pdf_show_string(pdf_csi *csi, unsigned char *buf, int len) while (buf < end) { - buf = pdf_decode_cmap(fontdesc->encoding, buf, &cpt); + int w; + buf = pdf_decode_cmap(fontdesc->encoding, buf, &cpt, &w); cid = pdf_lookup_cmap(fontdesc->encoding, cpt); if (cid >= 0) pdf_show_char(csi, cid); else fz_warn(ctx, "cannot encode character with code point %#x", cpt); - if (cpt == 32) + if (cpt == 32 && w == 1) pdf_show_space(csi, gstate->word_space); } } -- cgit v1.2.3