Bug 691479 - cidfmap not used by FreeType
Summary: cidfmap not used by FreeType
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Text (show other bugs)
Version: master
Hardware: PC All
: P1 blocker
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 04:48 UTC by Marcos H. Woehrmann
Modified: 2010-10-12 07:01 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2010-07-19 04:48:56 UTC
The FreeType build of Ghostscript doesn't make use of the cidfmap file.  There is a FAPIcidfmap file but that doesn't get used either.  In particular Ghostscript reads the cidfmap file from the current directory, which is how many of customers use this feature.


marcos@macbookpro:[306]% gs871tiff ./ALD_1996-A0.PDF
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Substituting font Helvetica for ArialMT.
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 2978856 1657818 9222296 7899252 3 done.
Substituting font Times-Roman for TimesNewRomanPSMT.
Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu... 3181544 1850220 7358280 5625912 3 done.
Loading a TT font from ./times.ttf to emulate a CID font TimesNewRomanPSMT ... Done.
Loading a TT font from ./arial.ttf to emulate a CID font ArialMT ... Done.
Substituting font Times-Italic for TimesNewRomanPS-ItalicMT.
Loading NimbusRomNo9L-ReguItal font from %rom%Resource/Font/NimbusRomNo9L-ReguItal... 6593320 5163599 7331008 5599117 3 done.

marcos@macbookpro:[308]% cp cidfmap FAPIcidfmap 
marcos@macbookpro:[309]% gsheadtiff ./ALD_1996-A0.PDF
GPL Ghostscript SVN PRE-RELEASE 9.00 (2010-07-31)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Substituting font Helvetica for ArialMT.
Loading NimbusSanL-Regu font from /Users/marcos/artifex/ghostscript/gs/Resource/Font/NimbusSanL-Regu... 3370056 2002560 6511200 5193017 3 done.
Substituting font Times-Roman for TimesNewRomanPSMT.
Loading NimbusRomNo9L-Regu font from /Users/marcos/artifex/ghostscript/gs/Resource/Font/NimbusRomNo9L-Regu... 3520608 2189310 6827056 5471194 3 done.
Can't find CID font "TimesNewRomanPSMT".
Substituting CID font /PDFAUTOCAD-Indentity0 for /TimesNewRomanPSMT, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "PDFAUTOCAD-Indentity0" is not provided either. Will exit with error.
Error: /undefined in findresource
Operand stack:
   --dict:8/17(L)--   F4   47   --dict:5/5(L)--   --dict:5/5(L)--   TimesNewRomanPSMT   --dict:10/12(ro)(G)--   --nostringval--   CIDFontObject   --dict:6/6(L)--   --dict:6/6(L)--   PDFAUTOCAD-Indentity0
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %loop_continue
Dictionary stack:
   --dict:1152/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:290/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 9.00: Unrecoverable error, exit code 1
Exit 1
marcos@macbookpro:[310]%
Comment 1 Ken Sharp 2010-07-19 07:36:10 UTC
FreeType makes no distinction regarding cidfmap at all. The cidfmap file is loaded and interpreted by the PostScript interpreter without reference to the font rendering library.

I just tested this on my setup, cidfmap entry:

/FreeSerif
<<
 /FileType /TrueType
 /Path (/tests/690930/FreeSerif.TTF)
 /SubfontID 0
 /CSI [(Artifex) (Unicode) 0]
>>;

At the GS window, type:

/FreeSerif /CIDFont findfont

results in a correct font dictionary on the operand stack.

Also tried cidfmap entry:
/TimesNewRoman << /CSI [(Identity) 0] /Path (c:/windows/fonts/times.ttf) /SubfontID 0 /FileType /TrueType >> ;

Then using TimesNewRoman-Identity-H to set test, this also works. So the FreeType build of GS most certainly does use cidfmap on Windows.

I'm less sure about your point regarding the location of cidfmap. Again this is unaffected by the choice of font rendering engine. As far as I am aware cidfmap is supposed to be found in Resource/Init (certainly that's where mine is) I'm not aware that it 'should' be read from the current directory.

However, if this has changed it seems more likely to be related to the recent flurry of activity surrounding search paths than anything to do with FreeType.

Marcos, can you please tell me why you think FreeType isn't using cidfmap ? Can you please also explain why cidfmap should be read from the current directory. If it should, then I suggest finding out which revision broke it and re-assigning it to whoever made the change.
Comment 2 Marcos H. Woehrmann 2010-07-19 15:11:34 UTC
Sorry, you are correct, this is unrelated to FreeType.
Comment 3 Linus 2010-10-11 19:45:03 UTC
I'm running into a similar issue. I'm using a cidfmap entry much like the one suggested, but Ghostscript still errors out on my system.

cidfmap entry:
/ArialMT << /FileType /TrueType /Path (/home/tabblo/share/fonts/truetype/arial/arial.ttf) /SubfontID 0 /CSI [(Artifex) (Unicode) 0] >> ;

command:
gs -sFONTPATH=/home/tabblo/share/fonts/truetype/arial -dNOPAUSE -r75x75 -sDEVICE=png16m -sOutputFile=wizards_notes.png wizards_notes.pdf

error:
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 12.
Page 1
Scanning /home/tabblo/share/fonts/truetype/arial for fonts... 1 files, 1 scanned, 1 new fonts.
Loading ArialMT font from /home/tabblo/share/fonts/truetype/arial/arial.ttf... 2961292 1624357 7118788 5721919 3 done.
Page 2
Loading ArialMT font from /home/tabblo/share/fonts/truetype/arial/arial.ttf... 3023252 1692669 7141736 5699279 3 done.
Can't find CID font "ArialMT".
Substituting CID font /Adobe-Identity for /ArialMT, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. Will exit with error.
Error: /undefined in findresource
Operand stack:
   --dict:6/15(L)--   F9   1   --dict:6/6(L)--   --dict:6/6(L)--   ArialMT   --dict:10/12(ro)(G)--   --nostringval--   CIDFontObject   --dict:8/8(L)--   --dict:8/8(L)--   Adobe-Identity
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--   --nostringval--   3   1   12   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %loop_continue
Dictionary stack:
   --dict:1162/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:288/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:27/40(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.71: Unrecoverable error, exit code 1


It looks like the substitution works on page 1, but the CIDFont substitution fails on page 2.

Any help is much appreciated.
-Linus
Comment 4 Ken Sharp 2010-10-12 06:54:56 UTC
(In reply to comment #3)
> I'm running into a similar issue. 

I do not see why this is a related issue. It appears to me that you have not supplied the path to the cidfmap using the -I switch. The FONTPATH does not, I believe, have anything to do with CIDFonts. Try using -I to include the location of the cidfmap, please don't reopen issues unless it is the *same* issue.

If your issue persists please open a new bug report.
Comment 5 Ken Sharp 2010-10-12 07:01:15 UTC
BTW the first occurrence of the font is almost certainly a regular font, hence it *is* found and used when supplying the FONTPATH. The second occurrence is a CIDFont (not a regular font), hence the lack of a cidfmap exhibits itself.

Of course this is speculation since a specimen file was not supplied.