[poppler] fofi should inspect more indepth part of the font file? (bug#47333)

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Mon May 7 22:45:25 PDT 2012


Hi,

Recently I was working with a bug #47333
	https://bugs.freedesktop.org/show_bug.cgi?id=47333
that non-square glyphs are not laid out correctly in vertical
writing mode. The font dictionary of PDF may have the width(s)
of the glyphs for horizontal/vertical writing mode, as DW, W
and DW2, W2 key-value pairs. If these key-value pairs are not
explicitly written in the PDF, current poppler uses the default
values defined in PDF spec. The values written in the embedded
font file stream are not used.

Reading PDF specs carefully, it was written that the values
defined by DW, W, DW2, W2 should be consistent with the metrics
in the embedded font file stream. And, it seems that Adobe Reader
(and Ghostscript) uses the metric values written in the embedded
font file stream, if DW, W, DW2, W2 are not explicitly defined.

So I guess poppler is expected to deal with the metric values
written in the embedded font file stream. What tools we have now?
We have FoFi (thin, and light-weight) or FreeType2 (rich, slower-
than FoFi, and sometimes missing).

At present, FoFi does not seem to be able retrieve the metric
values from embedded font file stream. In the case of bug#47333, we
have to retrieve the metric info from embedded Type1. To do
such, we have to parse the CharStrings for each glyphs, and
obtain the metric info. Fortunately, PostScript Type1 CharStrings
request that the metric info must be written at the beginning
of the glyph program for each glyphs. Thus, we don't have to
use a whole interpreter of PostScript Type1 or Type2 CharStrings
(ah, yet I've not checked the situation in Type3 font).

So, it might be possible for FoFi to have a feature to retrieve
the metric info from the embedded font file stream. But is it
the way to go? Using FreeType2 is easier & safer? I think it
is related with the situation "when we make a poppler WITHOUT
FreeType2?".

BTW, this issue is not 0.19.x-specific. It would be long running
issue and shared with XPDF. If I should discuss with XPDF authors,
I will do so. Please comment!

Regards,
mpsuzuki


More information about the poppler mailing list