[Gs-devel] Brief analysis of wordtst1.pdf / PMingLiU.ttf

Raph Levien raph at levien.com
Tue Nov 6 23:18:03 PST 2001

I've just taken a look at wordtst1.pdf, which is a file in our support
pipeline containing a CJK font that renders poorly in Ghostscript.

The culprit is the PMingLiU font, which uses TT instructions (hints)
to affect the shapes of the glyphs, not just tweak them for low-res
rendering. This font is one of the reasons why we'd eventually like to
have a hinted TT renderer for Ghostscript.

In wordtst1.pdf, it is embedded as a CID font, with TrueType glyphs
(CIDFontType2). Thus, it's unlikely that the current FAPI code will
render it correctly.

I haven't looked inside the font. This email will simply summarize my
experiments rendering the file in different PDF renderers.

We're not the only ones to run into this problem. It was discussed
briefly on the FreeType mailing list this February:


Unfortunately, PMingLiu seems to be distributed widely. It is
in the Office XP Multilingual User Interface Pack:


There are also reports
http://www.yale.edu/chinesemac/pages/beyond.html) that it ships with
Office 2000.

I was able to find a copy of the font on the Web without any
difficulty (contact me for a copy). It was made by an outfit called
DynaLab. Looking at their web page, they specialize in cheap fonts
(the retail version of most CJK fonts is $20). Probably Morisawa and
Ryobi wanted too much money :) Even so, they look pretty good to
my eyes, and most people probably don't won't see the difference.

I was very interested to see how other renderers deal with this
font. What I found was interesting, and taught me quite a lot about
how competitive renderers work.

Adobe Acrobat 4 and 5 both render TrueType fonts roughly the same. In
an antialiased display, hinting is turned off. However, this font
renders correctly anyway. One of two possibilities is almost certainly
true: either they execute the TT instructions at a much higher
resolution than the actual render, or they have a special workaround
for this class of fonts.

When aa is turned off, Acrobat seems to use an entirely standard
TT hinting and rendering process. I didn't look too deeply, so I'm
not sure if there are any differences between 4 and 5.

The Mac OS X Preview application fails, and in a very interesting way.
With antialiasing on, it ignores the instructions, and thus renders
the file incorrectly, in visually much the same way that Ghostscript
currently does.

However, with antialiasing turned off, it's clear to see that it's
evaluating the instructions, but _incorrectly_. The errors are quite a
bit more subtle than in the aa case, but definitely incorrect. In some
cases, the hinted glyph outline self-intersects, and it appears to
render with the even-odd rule.

Thus, one can conclude that the TT renderer in Mac OS X is likely not
derived from the one in OS 9, and probably hasn't had intensive QA. In
fact, I don't see a lot of evidence of recent PDF work from Cupertino.
As far as I can tell, the PDF viewer gained no additional functionality
between 10.0 and 10.1 - against my expectations, as it is quite sparse.
New OS X installations ship with Acrobat Reader 5.0 (which is now
Carbonized), but it's a bit schizophrenic about whether to launch
AR or Preview. It may well be that Apple is ceding the responsibility
for PDF viewing to Adobe, since they do a much better job.

So, what does this mean for Ghostscript? If it weren't Microsoft !@#$%
Word, I would say that the failure of Apple's PDF Preview to render
the font correctly would give us safety in numbers. However, given
that this font seems to be very prevalent in the wild, it probably
just means that the Mac OS X Preview application is not being actively

We really need to support this font one way or another. Probably the
first way is through the font API project and the Agfa UFST renderer.
It would also be great to support FreeType, at least for users outside
the United States, who can use the hinting without running afould of
Apple's patents. I'd very much like to encourage anyone in the free
community who's read this far to take up the project of integrating
FreeType2 into Ghostscript's font API.

I've been collecting more info about various font renderers, and will
try to summarize it some time soon. Very quick summary: Acrobat 5's
Type1 renderer is probably the most interesting around, as it is the
only one I know of that applies "gentle" hints optimized for aa
rendering, as opposed to fitting a square peg (hints designed for
non-aa rendering) into a round hole.

Take care,


More information about the gs-devel mailing list