Bug 687832 - (PDF interpreter) : CID Font in PDF
Summary: (PDF interpreter) : CID Font in PDF
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 0.00
Hardware: PC Windows XP
: P2 normal
Assignee: Masaki Ushizaka
URL:
Keywords:
: 687815 (view as bug list)
Depends on:
Blocks: 690834
  Show dependency tree
 
Reported: 2004-12-06 06:20 UTC by Igor Melichev
Modified: 2010-03-26 10:33 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
testCIDfonts.pdf (393.69 KB, application/pdf)
2004-12-06 06:23 UTC, Igor Melichev
Details
t7.pdf (8.70 KB, application/pdf)
2009-12-03 00:32 UTC, Masaki Ushizaka
Details
b687832_b1.patch (3.39 KB, patch)
2010-01-08 03:50 UTC, Masaki Ushizaka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Melichev 2004-12-06 06:20:24 UTC
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.
Comment 1 Igor Melichev 2004-12-06 06:23:03 UTC
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.
Comment 2 Igor Melichev 2004-12-06 10:16:41 UTC
Oops, I was not enough correct. Actually the font size is good, but with GS the 
character spacing is 2 times smaller than expected.
Comment 3 Igor Melichev 2004-12-23 16:00:00 UTC
*** Bug 687815 has been marked as a duplicate of this bug. ***
Comment 4 Igor Melichev 2005-01-10 02:08:08 UTC
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.
Comment 6 Masaki Ushizaka 2009-12-03 00:13:30 UTC
Bug 690834 going to revert rev. 5613 which was a fix for this bug.  I am going to reopen and assign 
myself.
Comment 7 Masaki Ushizaka 2009-12-03 00:32:03 UTC
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.
Comment 8 Masaki Ushizaka 2009-12-04 00:48:49 UTC
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.
Comment 9 Masaki Ushizaka 2010-01-08 03:50:21 UTC
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
Comment 10 Ken Sharp 2010-01-08 09:54:15 UTC
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.
Comment 11 Masaki Ushizaka 2010-01-10 01:57:40 UTC
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.
Comment 12 Ken Sharp 2010-01-10 05:42:13 UTC
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.
Comment 13 Masaki Ushizaka 2010-01-12 02:51:58 UTC
The patch b687832_b1.patch is committed in rev. 10603. Closing.
Comment 14 Masaki Ushizaka 2010-03-26 10:33:29 UTC
r10603 was incomplete.  Please use r10722 (PostScript code fix) and r10973 (Makefile change) together.