[poppler] Support for CJK fonts in postscript / on Windows platforms

Thomas Freitag Thomas.Freitag at kabelmail.de
Sat Feb 25 23:44:09 PST 2012


Hi,

I implemented a patch which supports CJK fonts in the postscript output 
device and on Windows platforms in general. It consists mainly of three 
parts:

1. Adapt bug fix for bug 11413 to the postscript device
2. A small bug fix when locateFont doesn't find a suitable font and 
returns a null pointer
3. CJK substitute implementation on WIndows platforms.

to 1.:
Adapting the implementation of the bug fix for splash and cairo to the 
postscript device was quite easy. But my first proofs of the output with 
ghostscript 8.71 shows some regressions where the CJK chars have a 
smaller height than the default square of the font. But the "48" in the 
output of bug-poppler11413.pdf which is set in a "normal" font but 
rotated was at the right position. Then I stepped to ghostscript 9.04, 
and now the CJK chars were shown correctly, but the 48 was positioned 
wrong. But because of these different tests I think that it is still a 
problem in ghostscript when using a mix of CJK fonts and "normal" fonts. 
BTW, also Acrobat X distiller has problems with the position of the "48"!

to 2.:
On my first tests with PDF which uses non embedded CJK fonts on Windows 
I got crashes. Reason for it was that GlobalParamWin returns Helvetica, 
which is not a CID font, but locateFont accepts here only CID fonts and 
therefore returns a NULL pointer. I first fixed that and then decided to 
return as default MS Mincho if a CID font is expected.

to 3.:
When You install ghostscript on WIndows You're able to switch on CJK 
support. This will create a  cidfmap file in the gs-lib directory. The 
ps file which creates it (mkcidfm.ps) runs over the windows font 
directory and tries to create a suitable substitution table for missing 
CJK fonts. The cidfmap file is more or less PDF like, so it's quite easy 
to parse it with our parser and create a substitution table in 
GlobalParamsWin and use that table. But I expect it in the poppler data 
dir instead of searching for ghostscript installation. If it is not 
there, it always returns the default CID font of point 2.
You can either copy it from the gs lib directory or create it with the 
ghostscript tool calling

gswin32c -q -dBATCH -sFONTDIR=<windows font directory>  
-sCIDFMAP=<popper data dir>/cidfmap mkcidfm.ps

To clearify the format of cidfmap I attach the file produced on my 
installation. Keep care: I have not a default windows installation with 
windows on c:/windows, my windows installation is on drive f!

Cheers,
Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cjkfonts.diff
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120226/ff34b4eb/attachment-0001.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cidfmap
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120226/ff34b4eb/attachment-0001.txt>


More information about the poppler mailing list