[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PDF outline anomaly
From: |
G. Branden Robinson |
Subject: |
Re: PDF outline anomaly |
Date: |
Mon, 29 Apr 2024 19:59:14 -0500 |
Hi Peter,
I have bad news. You might not be on the true bleeding edge of Git.
At 2024-04-29T12:45:53-0400, Peter Schaffter wrote:
> I recently updated a mom file that uses \*[COND] in the string
> passed to HEADING and noticed that the PDF outline has started
> prepending u] (i.e. the letter u and a square bracket) to the
> outline entries. Unsurprisingly, \*[EXT] is also affected. Process
> this little example with pdfmom to see what I mean:
Not only can I reproduce this, the problem is _worse_ now.
See attached image.
I bisected it down to this commit.
f336f8244b09191b16722984c33fc5addcc4a284 is the first bad commit
commit f336f8244b09191b16722984c33fc5addcc4a284
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
Date: Tue Apr 16 17:34:59 2024 +0100
Problem with '(' and '\' (\[rs])
Bpth these tokens have meaning for roff AND pdf strings. In
pdfs unbalanced parentheses have to be escaped (with '\') and
a single '\' has to be similarly escaped, '\\'. It is gropdf's
responsibility to ensure pdf strings are valid, no matter what
the input.
If '\(ul' is passed then the UTF-16 character becomes '_'.
If '\[rs](ul' is passed (i.e. '\(ul' is intended to become the
UTF-16 string) \[rs] becomes '\' leaving '\(ul', which if
becomes '_', not what is intended. If the unbalanced '(' is
eascaped first, '\[rs]\(ul' which could become '\\_' when the
'\' is escaped, yielding '\_'. The code which escpes parenthesis
checks it is not already preceded by '\' since adding another
would give you '\\(' which is not what you want. The correct
output should be '\\\(ul' to achieve the correct pdf string.
This fixes the above issue (I hope).
* src/devices/gropdf/gropdf.pl: Change pattern matches
src/devices/gropdf/gropdf.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
I'll do another bisect to see where the 'u]' started creeping in, but it
looks to me like there's more than one problem to solve.
Regards,
Branden
peter-cond-thing-gbr.png
Description: PNG image
signature.asc
Description: PGP signature
- PDF outline anomaly, Peter Schaffter, 2024/04/29
- Re: PDF outline anomaly,
G. Branden Robinson <=