[Bug 42739] CUPS PDF creation, font encoding, garbled / glibberish text

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Apr 6 09:21:52 CDT 2017


https://bugs.winehq.org/show_bug.cgi?id=42739

--- Comment #11 from marlemion <quatze at t-online.de> ---
So I investigated further this issue and came across a solution.

Apparently, the culprit lies within a missing feature rather than a bug. 

When reading the output of wine while printing, I came across the line:

"postscript format 3.0 glyph names are currently unsupported"

So I dug into the source code and found the respective distinction in
download.c of dlls/wineps.drv/. Here, it is distinguished between the formats
type 1, type 2 and type 3. Apparently, the code transforms the truetype font to
an intermediate postscript font. For that, it needs to know the name of the
glyphs. This is exactly extracted at this position.

However:

ttf2afm /usr/share/TTF/calibri.ttf  > /dev/null

Warning: ttf2afm (file /usr/share/TTF/calibri.ttf): no names available in
`post' table, print glyph names as indices

Bingo! So I understood that the culprit lies within the missing name tables of
the font itself. As long as there is no support in wine for these fonts, one
hase to transform the fonts including the name tables. I found a solution here:

https://github.com/fontforge/designwithfontforge.com/issues/16

And adopted it for my needs:

#! /usr/bin/env python
import fontforge
import sys

fontfile = sys.argv[1]

try:
    font = fontforge.open (fontfile)
except EnvironmentError:
    sys.exit (1)

for glyph in font:
    if font[glyph].unicode != -1:
        font[glyph].glyphname = fontforge.nameFromUnicode (font[glyph].unicode,
"Adobe Glyph List")

font.save (fontfile)

For every font having no names table, I executed this script (you need
fontforge for it):

#!/bin/bash
for i in *; do if [[ $(ttf2afm $i 2>&1) == *"no names available"* ]]; then echo
$i && above_script.py $i && echo; fi; done
exit 0

That's it.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list