[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong letter in title

From: Davide Liessi
Subject: Re: Wrong letter in title
Date: Sun, 30 Sep 2018 13:55:49 +0200

Il giorno dom 20 mag 2018 alle ore 18:35 Davide Liessi
<address@hidden> ha scritto:
> The file
> \version "2.19.81"
> \header { title = "č" }
> { b1 }
> results in a PDF with correct printed title (lowercase c with caron)
> but wrong title field in metadata (Ċ, i.e. uppercase c with dot
> above).

On Sun, 20 May 2018 20:52:58 +0200 David Kastrup wrote:
> Ghostscript bug when converting PostScript output to PDF.  The
> PostScript reads (pasted from less' display)
> mark /Creator (LilyPond 2.21.0)
> /Title (<FE><FF>^A^M)
> /DOCINFO pdfmark
> which is the correct UTF16-LE string with BOM.  GhostScript however
> converts the ^M (0x0d) into ^J (0x0a), basically converting an ASCII CR
> to an ASCII LF.  Unfortunately, we are not in the middle of ASCII here.

Actually, it turns out that the behaviour of GhostScript is not wrong
and this is probably a bug in how LilyPond produces the PostScript

PostScript strings must either properly escape non-ASCII or ASCII
non-printable bytes, e.g., as \ddd with ddd the octal representation,
or they must be defined as a hexadecimal string (see [1], pages
See the attached files: gs-string-wrong.ps defines the title as
LilyPond with literal UTF16LE bytes, gs-string-hex.ps uses a
hexadecimal string and gs-string-oct.ps escapes characters as octals.
Using ps2pdf on them results in the wrong Ċ (uppercase c with dot
above) in the first case and in the correct č (lowercase c with caron)
in the second and third cases.
See also [2] where exactly this problem was reported to GhostScript.

I think that LilyPond should properly escape strings or use their
hexadecimal representation (probably easier, if strings are encoded as
UTF16LE regardless of the characters appearing in them).

Best wishes.

[2] https://bugs.ghostscript.com/show_bug.cgi?id=693614

Attachment: gs-string-oct.ps
Description: PostScript document

Attachment: gs-string-wrong.ps
Description: PostScript document

Attachment: gs-string-hex.ps
Description: PostScript document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]