summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-03-12 14:22:44 +0000
committerChris Liddell <chris.liddell@artifex.com>2018-03-12 14:44:51 +0000
commit23f66c8eec91e8efcbc600d987cf8bde7e3dce4b (patch)
tree51c5d56bb47394396504eda5cc5f690655143d20
parent1567dba0b505a0bb816e7b2e34f3915165a7d5b3 (diff)
downloadghostpdl-23f66c8eec91e8efcbc600d987cf8bde7e3dce4b.tar.gz
pdfwrite - avoid use of /.notdef when converting PCL fonts to type 3
Bug #699102 "using -sDEVICE=pdfwrite option generate an incorrect code 128 barcode" This is actually an Acrobat bug, every other viewer I've tested works as expected, Acrobat does not. The problem appears to be related to defining a /.notdef glyph and encoding it at a position other than 0 in the Encoding. If we do that, and use the encoded /.notdef glyph, Acrobat quietly replaces it with the glyph encoded at position 0 in the Encoding of the font. Because of the way that PCL fonts work, when we are converting PCL fonts to type 3 PDF fonts, the character (PCL) 0x1D gets assigned the glyph name /.notdef. The actual Encoding of the glyph is at position 0x1D however, which causes Acrobat to substitute the glyph at Encoding position 0. This is obviously wrong. However, since its Acrobat, here we add yet another heuristic to avoid defining glyphs with the name /.notdef when creating type 3 PDF fonts from PCL fonts. No differences expected
-rw-r--r--devices/vector/gdevpdtt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/devices/vector/gdevpdtt.c b/devices/vector/gdevpdtt.c
index fcad24270..80b5a66ef 100644
--- a/devices/vector/gdevpdtt.c
+++ b/devices/vector/gdevpdtt.c
@@ -2794,7 +2794,12 @@ pdf_choose_output_char_code(gx_device_pdf *pdev, pdf_text_enum_t *penum, gs_char
static int
pdf_choose_output_glyph_hame(gx_device_pdf *pdev, pdf_text_enum_t *penum, gs_const_string *gnstr, gs_glyph glyph)
{
- if (penum->orig_font->FontType == ft_composite || penum->orig_font->procs.glyph_name(penum->orig_font, glyph, gnstr) < 0) {
+ if (penum->orig_font->FontType == ft_composite || penum->orig_font->procs.glyph_name(penum->orig_font, glyph, gnstr) < 0
+ || (penum->orig_font->FontType > 42 && gnstr->size == 7 && strcmp(gnstr->data, ".notdef")== 0)) {
+ /* If we're capturing a PCL bitmap, and the glyph comes back with a name of '/.notdef' then
+ * generate a name instead. There's nothing wrong technically with using /.notdef, but Acrobat does
+ * 'special stuff' with that name, and messes up the display. See bug #699102.
+ */
/* couldn't find a glyph name, so make one up! This can happen if we are handling PCL and the glyph
* (character code) is less than 29, the PCL glyph names start with /.notdef at 29. We also need to
* do this for composite fonts.