[gs-devel] (Long) Revised thinking about pdf_font_t and
ray at artifex.com
Fri Apr 12 11:38:10 PDT 2002
"L. Peter Deutsch" wrote:
> The current pdfwrite code tries very hard to make multiple font resources,
> which may have different metrics, Encoding, and/or FontMatrix, share a
> single FontDescriptor. However, ...
--- SNIP ---
> other role of pdf_font_t is to represent a PDF font resource. In this role,
> multiple pdf_font_ts *cannot* share a FontDescriptor.
> If, for text searchability (ReEncodeCharacters=false) or because of the
> limit of 256 characters per Encoding, it is necessary to create multiple
> FontDescriptors for a single PostScript font, these FontDescriptors can
> share the FontFile if the font is embedded.
--- SNIP ---
> If anyone has comments about this, I would like to hear them soon, because I
> want to start work on this as soon as possible in order to address problem
> #529578 in particular.
I've processed all of the files in the regression suite, and I've only
found three files that have a different Font resources sharing a single
FontDescriptor. Two of these files were created by Aladdin Ghostscript
6.01 (test2.pdf and test2a.pdf). The other was from a customer and was
created by Lanvera PDF Printer version 1.34. The lanvera_test.pdf has
I agree entirely that this seems like a reasonable approach for pdfwrite.
For the PDF interpreter, however, we cannot rely on this. In fact the
'optimization' I put in for SF bug #533467 that caches the FontObject
in the FontDescriptor caused a regression on test2.pdf and test2a.pdf
because of the re-use of the FontDescriptor (in these cases with /Widths
arrays in the referencing /Font object that differed). These caused me
to revise the patch (still in work) to also cache the /Widths and the
/Encoding in order to allow comparison before using the cached FontObject.
In summary, it seems like your analysis of the PDF spec. is correct,
a FontDescriptor should not be re-used by a different Font. I think
that it is best to refrain from printing out a pdfformaterror for the
case where we detect re-use since at least one of the broken apps is
More information about the gs-devel