FS#46744 - [ghostscript] Wrong glyphs with Libertine fonts
Attached to Project:
Arch Linux
Opened by Rodrigo Rivas Costa (rodrigorc) - Thursday, 15 October 2015, 22:29 GMT
Last edited by Andreas Radke (AndyRTR) - Saturday, 09 January 2016, 19:58 GMT
Opened by Rodrigo Rivas Costa (rodrigorc) - Thursday, 15 October 2015, 22:29 GMT
Last edited by Andreas Radke (AndyRTR) - Saturday, 09 January 2016, 19:58 GMT
|
Details
Description:
When showing a PDF file containing text with Libertine TrueType fonts, the image shows weird glyphs instead of some letters. Since GS filter is used by my printer driver, the hard copy of the PDF is also garbled. Additional info: * ghostscript 9.18-1, 9.18-2, 9.18-3 are affected. However 9.16-1 works fine. * ttf-linux-libertine 5.3.0-3. It looks like only the TrueType variants are affected. The OpenType and the Graphite ones (from ttf-linux-libertine-g) are also ok. Steps to reproduce: * Set the font to "Linux Libertine", size 20. * Write "abcdefghijklmnopqrstuvwxyz" in a LibreOffice Writer document. * Export to "test.pdf" with default parameters. * Open the PDF with command "gs test.pdf". * The PDF is correct, because "evince test.pdf" shows the text fine. Attached files: * test.pdf: A sample PDF with serveral variants of the Libertine font. * test.png: That same PDF, rendered by GS. |
This task depends upon
Can anyone reproduce this bug with the attached file, or is just me?
You may want to check how other distros build GS:
http://pkgs.fedoraproject.org/cgit/ghostscript.git/tree/ghostscript.spec?id=c5fb0925b166dd614113fe343ca5b5fdfadf0e54 (pretty outdated)
https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/ghostscript-gpl/ghostscript-gpl-9.18.ebuild
https://packages.debian.org/stretch/ghostscript (pretty outdated)
Then, I deleted all but freetype (`rm -rf jpeg libpng zlib jasper expat tiff lcms lcms2 cups/libs`) and it worked too!
Then, I deleted only freetype but kept all the other internal libraries (`rm -rf freetype`) and it failed.
So the problem is clearly in not using the internal freetype library. It is a patched version of freetype 2.5.5, while the one in my system is 2.6.2. Maybe the problem was related to the custom gs patching so I gathered the upstream code from [1] and copied it in place of the local GS library. It worked fine so the patches are not related to this issue.
I tried to replace the local copy of freetype-2.5.5 with a copy of the upstream freetype-2.6.2 but it didn't even compile. It looks like GS is not using the autobuild scripts from freetype, but it cherry-pick-compiles the source files from the freetype directory manually (using `base/freetype.mak`).
HTH.
[1]: http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.bz2
So, local, unpatched, freetype-2.5.5 works fine but system freetype-2.5.5 fails...
I can only think that the error is eitherbecause of some Arch patches to the freetype code or it is because of the way gs compiles this library.
I'll try to find the Arch patches to freetype-2.5.5 and apply them to the local freetype library, and see if it fails...
Summing up, any try I did:
* local library, any version, any patches: it works.
* system library, any version: it fails.
I tried compiling gs from the upstream sources, instead of with `makepkg`, maybe to try and bisect it, but I was unable to build it...
Rodrigo, can you please report report back in the upstream that all system freetype libs fail here. Maybe they can explain the difference and why it works for them. It would be nice if we can revert later to a working system lib.
Yes, I will report back to upstream. And I'll keep on trying to build and bisect upstream code in my spare time... I don't like unsolved mysteries.
What this commit did was to disable the autodetection of the system freetype library. Local freetype: fine; system freetype: never found, use default internal buggy font rasterizer.
I also wrote a patch [2], just one line.
[1]: http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=3d3982f844fed6d6cb092055980900289fb6a402
[2]: http://bugs.ghostscript.com/attachment.cgi?id=12221
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=8f5d28536e4518716fdfe974e580194c8f57871d
Thanks for your help and work with upstream!