Testing required before final switch to the new PDF interpreter in Ghostscript 10.1 next March

Bruno Voisin bvoisin at icloud.com
Mon Jan 2 23:06:40 CET 2023


Next March or April the next version of Ghostscript, 10.1, will be released, removing completely the old PostScript-based PDF interpreter and leaving only the new C-based PDF interpreter in place. At some point later in the year this release will probably be added to the various Unix distributions, and, unless something is done in the meantime, might cause problems with TeX packages the same way release 10.0 caused problems with dvisvgm.


Problem 1
=========

An issue has been reported by Akira Kakuto and Reinhard Kotucha to the gs-devel list mid-December, regarding the way gs may be used with TeX Live to embed the URW35 fonts in PDF files, with say

	gs -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -o testNEWPDF-embfont.pdf -f testNEWPDF.pdf

This assumes (1) a file Fontmap.TeXLive is added to the gs initialization directory, on the Mac

	/usr/local/share/ghostscript/10.00.0/Resource/Init

replacing the names of the (slightly) modified URW fonts built in gs with those for the original URW fonts in TeX Live, and (2) these latter fonts (or symlinks to them) are added to the gs fonts directory, on the Mac

	/usr/local/share/ghostscript/10.00.0/Resource/Font

The associated files are at

	https://tug.org/~kotucha/testNEWPDF.tar.xz

With the new PDF interpreter, this works no longer. This is because Fontmap.TeXLive is actually PostScript code, and the new PDF interpreter doesn't execute any PostScript code at all. So, in essence, the TeXLive additions to Ghostscript are ignored.

Similarly in MacTeX we add Fontmap.cmr from <http://mirrors.ctan.org/fonts/cm/ps-type1/contrib/Fontmap.cmr> and create symlinks so that gs can use the Type 1 CMR fonts in TeX Live if need be. This won't work any longer.

Close investigation is underway. The whole thread starts at

	https://ghostscript.com/pipermail/gs-devel/2022-December/010598.html

(It may be difficult to follow because for some reason Rheinhard's messages were delivered to their direct recipients but not to the list.)

In the most recent message

	https://ghostscript.com/pipermail/gs-devel/2023-January/010618.html

Ken Sharp, one of the gs developers wrote

> The new PDF interpreter is not written in PostScript and while it inherits the graphics state from the PostScript interpreter, and copies interpreter controls from the PostScript interpreter to the PDF interpreter, it does not execute PostScript. At all. The PDF file is entirely processed in the PDF interpreter environment which is basically insulated from the PostScript environment.

> 
> If you change the PostScript interpreter/environment then this will have no effect on the PDF interpreter (beyond the graphics state, which can mean the default halftone, transfer function etc).
> 
> Note that since PDF doesn't use resources the way PostScript does, about the only thing the new interpreter needs from the outside world is fonts.

So regarding the problem at hand, Ken wrote

> I suspect the answer to the initial problem will be 'don't do it like that, do it like this'. And a method which will work with both old and new versions.


Problem 2
=========

Norbert Preining's cjk-gs-integrate script

	https://github.com/texjporg/cjk-gs-support

makes the CJK fonts from TeX Live and from the OS available to gs, based on additions to Resource/{CIDFont,CIDFSubst,Font,Init}.

Ken Sharp wrote

> Some of those things are copied over from the PostScript interpreter to the PDF interpreter (the substitute CIDFont for example but not Resource/CIDFSubst), and the cidfmap content. Other things are not.

So, if you're a CJK user and your workflow involves only feeding gs with PS input, you're safe. But if your workflow involves PDF input, you're in trouble.


All the above was just to provide examples of things that might go wrong TeX-wise when the next Ghostscript is released, if nothing is done on our (TeX's) side in the meantime. The Ghostscript developers are quite willing to help and take the needs of the TeX community into account, I think, but they need to know what the problems are, get bug reports before the release.

In his last message Ken Sharp wrote

> Well to be frank we've been talking about the new interpreter and what it means for 2 years, we've made alpha and beta versions available, we initially rolled out the new interpreter disabled so that people could turn it on and try it out, and we've had the new version out with it set as the default for 9 months.
> 
> During all that time we've asked anyone we could to please try it out and give us feedback. We've put it in the release notes, on our blog, and our website. Noted it in gs-devel and frankly any place we could think of.
> 
> There have been some minor bugs, a few cases we hadn't anticipated, that sort of general thing, but mostly there has been very little feedback at all, so we've assumed everything is fine.
> 
> If this is going to cause problems for the TeX community then we are going to need someone to talk to us about it.
> 
> One thing we won't be doing is having the PDF interpreter run PostScript. It is possible we may forward some state through the PS/PDF interface if that is needed but off the top of my head I can't see what would be needed beyond what is already there (obviously, or we would already have worked on it).
> 
> Perhaps a CJKV native speaker and TeX user could try out the new interpreter and let us know, or at least talk to the TeX maintainers and have them contact us if someone can identify problems.
> 
> Given that the next release is March where we intend to excise the old PostScript-based PDF interpreter (so using -dNEWPDF=false will no longer work), and we've got a company retreat starting next week, there's probably only about 4-6 weeks before we feature freeze for the release so it would be good if someone could investigate this with some urgency.
> 
> Otherwise any necessary changes might not be possible to get done before the release.

So if you are a TeX developer or an advanced user making use of Ghostscript in a PDF-based workflow, please don't hesitate to test and report soon!


Bruno Voisin




More information about the tex-live mailing list.