Il giorno dom 20 mag 2018 alle ore 18:35 Davide Liessi <davide.lie...@gmail.com> 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 file. 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 29–31). 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. Davide [1] https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/PLRM.pdf [2] https://bugs.ghostscript.com/show_bug.cgi?id=693614
gs-string-oct.ps
Description: PostScript document
gs-string-wrong.ps
Description: PostScript document
gs-string-hex.ps
Description: PostScript document
_______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond