Posted by Alex Demmler <news@ademmler.com> to gs_devel : Dear Folks! I am mail to gs-devel, because I do not better know. And to Igor, because he knows so much about Fonts. ;-) May you can help me. Find attached an PDF from Adobe InDesign direct PDF Export. ID is converting all fonts to CID Fonts. Now I would like to make a RGB/CMYK Tiff out of it with GS. Find within attached ZIP file: testCIDfonts_GSout.jpg = ghostscript result testCIDfonts_ok.jpg = sample how it should be testCIDfonts.pdf = original PDF Anny ideas? May it is my configuration or some thing else. Regards Alex PS: sorry, I have forgotten to apply the attachment last time. ## my configuration AFPL Ghostscript BETA RELEASE 8.33 (2004-11-20) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. Usage: gs [switches] [file1.ps file2.ps ...] Most frequently used switches: (you can use # in place of =) -dNOPAUSE no pause after page | -q `quiet', fewer messages -g<width>x<height> page size in pixels | -r<res> pixels/inch resolution -sDEVICE=<devname> select device | -dBATCH exit after last file -sOutputFile=<file> select output file: - for stdout, |command for pipe, embed %d or %ld for page # Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF Default output device: x11 Available devices: bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono cljet5 cljet5c deskjet devicen djet500 epswrite faxg3 faxg32d faxg4 ijs jpeg jpeggray laserjet lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d ljetplus nullpage pbm pbmraw pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw pj pjxl pjxl300 pkm pkmraw pksm pksmraw png16 png16m png256 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw psdcmyk psdrgb psgray psmono psrgb pswrite pxlcolor pxlmono spotcmyk tiff12nc tiff24nc tiff32nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw tiffpack tiffsep uniprint x11 x11alpha x11cmyk x11gray2 x11gray4 x11mono xcf Search path: . : /usr/local/share/ghostscript/8.33/lib : /usr/local/share/ghostscript/8.33/Resource : /usr/local/share/ghostscript/fonts For more information, see /usr/local/share/ghostscript/8.33/doc/Use.htm. Report bugs to bug-gs@ghostscript.com, using the form in Bug-form.htm.
Created attachment 1076 [details] testCIDfonts.pdf Attaching the sample file. It is created by InDesign. I confirm a problem with GS PDF interpreter : the font size in rendering is incorrect.
Oops, I was not enough correct. Actually the font size is good, but with GS the character spacing is 2 times smaller than expected.
*** Bug 687815 has been marked as a duplicate of this bug. ***
The subfont of the CIDFontType0 has an unusial FontMatrix [0.488280982 0 0 0.488280982 0 0]. Likely it is not accounted when accounting the CDevProc output.
Patch to HEAD : http://ghostscript.com/pipermail/gs-cvs/2005-January/005143.html Patch to GS_8_1X : http://ghostscript.com/pipermail/gs-cvs/2005-January/005144.html
Bug 690834 going to revert rev. 5613 which was a fix for this bug. I am going to reopen and assign myself.
Created attachment 5736 [details] t7.pdf A simplified test file. Two strings are drawn as following: 71 0 0 71 344.22311 304.12367 Tm [<0021>-54<0022>-54<0018>-54<001D>-54<0016>]TJ 71 0 0 71 344.22311 204.12367 Tm <002100220018001D0016> Tj Simple 'Tj' drawing already has a problem. I suspect CIDFont's 'W' values are interpreted in glyph space, not in 1000th of text space.
I confirmed this is caused by rev. 2685 code, which interprets widths in W/W2 in glyph space units. Need to change it to 1000th of text space.
Created attachment 5859 [details] b687832_b1.patch A patch to calculate W/W2 values in 1000th of text space. I have chosen a way that minimize differences. I have a plan to review all composite functions in ghostscript in near future, I will probably need to revisit this code again that time. Localcluster test reported differences in following files. I haven't reviewed them in detail yet, but I believe those are caused by floating point calculation errors and have only a dot differences. Metrics values are now always go through FontMatrix, so there may be a little more errors than without this patch. tests_private/comparefiles/Bug687832.pdf tests_private/comparefiles/Bug689753.pdf tests_private/comparefiles/Bug690113.pdf tests_private/comparefiles/Bug690372.pdf tests_private/comparefiles/CIDembedded.pdf tests_private/comparefiles/HeiseiMinStd.pdf tests_private/comparefiles/KozukaB-ILEmbed.pdf tests_private/comparefiles/Openhuis_pdf_zw.pdf tests_private/comparefiles/RodinCIDEmbed.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX0325.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX1101.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX1803.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX2049.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX5233.pdf tests_private/pdf/PDFIA1.7_SUBSET/CATX6508.pdf tests_private/pdf/PDFIA1.7_SUBSET/IA3Z0222.pdf tests_private/pdf/PDFIA1.7_SUBSET/IA3Z1869.pdf tests_private/pdf/PDFIA1.7_SUBSET/IA3Z3225.pdf tests_private/pdf/PDFIA1.7_SUBSET/IA3Z4373.pdf
Interesting. So the metrics (W, W2, DW, DW2) are in glyph space, which depends on the FontMatrix, not in text space ? And our existing CDevProc assumes that the FontMatrix is always 1000x1000 ? Looks good to me, though I haven't checked the specific files you mention either. Need an opinion from Alex as well.
I forgot to mention that the patch in comment #9 (b687832_b1.patch) need to be used together with a patch (b690834_p3.patch) in bug #690834. I have checked all 82 pages produced by files in comment #9, and confirmed differences are all one dot width.
Looks good to me Masaki, you should probably commit both patches and close the bugs as fixed. I'd like an opinion from Alex Cherepanov as well, since the PDF interpreter is his ownership.
The patch b687832_b1.patch is committed in rev. 10603. Closing.
r10603 was incomplete. Please use r10722 (PostScript code fix) and r10973 (Makefile change) together.