Bug 689976 - Regression (from 8.60) Unable to substitute for CIDFont
Summary: Regression (from 8.60) Unable to substitute for CIDFont
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: All All
: P1 blocker
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-21 11:29 UTC by Ray Johnston
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer: 661, 580
Word Size: ---


Attachments
experimental patch - doesn't work (1.61 KB, patch)
2008-07-23 22:30 UTC, Alex Cherepanov
Details | Diff
foo.ps -- test program (614 bytes, text/plain)
2008-07-23 22:40 UTC, Alex Cherepanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Johnston 2008-07-21 11:29:57 UTC
This worked in 8.60:

1) place WadaGo-Bold in Resource/CIDFont

2) Single line cidfmap is:
     /Adobe-Japan1 /WadaGo-Bold ;

3) run the test file:
     gswin32c 070201.pdf

This is an URGENT issue and may be related to bug 689956.

MANY customers rely on this feature to perform substitution for Asian Fonts.
Comment 1 Ray Johnston 2008-07-21 11:30:35 UTC
Created attachment 4231 [details]
070201.pdf
Comment 2 Ray Johnston 2008-07-21 11:32:59 UTC
BTW, the error message with rev 8850 is:

Substituting CID font resource/Adobe-Japan1 for /éléréoû╛Æ⌐.
Error: /undefinedresource in findresource
Operand stack:
   --nostringval--   --dict:5/14(L)--   F0   10.1719   --dict:6/6(L)--  
--dict:6/6(L)--   éléréoû╛Æ⌐   --dict:10/12(ro)(G)--   --nostringval--  
CIDFontObject   --dict:8/8(L)--   --dict:8/8(L)--   Adobe-Japan1   CIDFont  
true   Adobe-Japan1   Adobe-Japan1   WadaGo-Bold
Comment 3 Ray Johnston 2008-07-21 11:33:45 UTC
Bumping priority since this is an important feature for many customers
Comment 4 Ray Johnston 2008-07-21 11:40:01 UTC
Note that this is broken in the 8.62 release and works in 8.61 as well as 8.60
Comment 5 Marcos H. Woehrmann 2008-07-21 13:17:11 UTC
It seems unlikely this is the same issue as bug 689956; that issue didn't appear until after 8.62.  I'm 
searching know for the revision applicable to this bug.
Comment 6 Marcos H. Woehrmann 2008-07-21 13:47:38 UTC
I'm not able to get this file to work with any version of Ghostscript.  All produce the same error as in 
Comment #2:

  Substituting CID font resource/Adobe-Japan1 for /?l?r?o????.
  Error: /undefinedresource in findresource


I think this bug might be related to bug 688770
Comment 7 Marcos H. Woehrmann 2008-07-21 13:57:50 UTC
Okay, now I'm totally confused.  If I place the font I'm using as a substitute for Adobe-Japan1 in a 
directory called CIDFont gshead (r8853), gs8.62, and every other version I tried, work:

marcos@macbookpro:[93]% ~/artifex/ghostscript/head/gs/bin/gs -sDEVICE=tiff24nc -o test.tif 
./070201.pdf
GPL Ghostscript SVN PRE-RELEASE 8.63 (2008-03-01)
Copyright (C) 2008 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 CID font resource/Adobe-Japan1 for /?l?r?o????.
Error: /undefinedresource in findresource
Operand stack:
   --nostringval--   --dict:5/14(L)--   F0   10.1719   --dict:6/6(L)--   --dict:6/6(L)--   ?l?r?o????   --
dict:10/12(ro)(G)--   --nostringval--   CIDFontObject   --dict:8/8(L)--   --dict:8/8(L)--   Adobe-
Japan1   CIDFont   true   Adobe-Japan1   Adobe-Japan1   WadaGo-Bold
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   -
-nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1905   1   3   
%oparray_pop   1904   1   3   %oparray_pop   1888   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   --nostringval--   1856   14   9   
%oparray_pop   findresource   %errorexec_pop   --nostringval--   --nostringval--   --nostringval--   -
-nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1147/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --
dict:106/127(ro)(G)--   --dict:274/300(ro)(G)--   --dict:22/25(L)--   --dict:4/6(L)--   --
dict:25/40(L)--   --dict:20/26(ro)(G)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 8.63: Unrecoverable error, exit code 1

marcos@macbookpro:[94]% mkdir CIDFont

marcos@macbookpro:[95]% mv WadaGo-Bold CIDFont/.

marcos@macbookpro:[96]% ~/artifex/ghostscript/head/gs/bin/gs -sDEVICE=tiff24nc -o test.tif 
./070201.pdf
GPL Ghostscript SVN PRE-RELEASE 8.63 (2008-03-01)
Copyright (C) 2008 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 CID font resource/Adobe-Japan1 for /?l?r?o????.
Can't find (or can't open) font file %rom%Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Can't find (or can't open) font file %rom%Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Times-Roman for TimesNewRomanPSMT.
Can't find (or can't open) font file n021003l.pfb.
Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu... 2770916 
1157919 11570316 10133630 3 done.
Substituting CID font resource/Adobe-Japan1 for /?l?r?o????.
Can't find (or can't open) font file %rom%Resource/Font/TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file %rom%Resource/Font/TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file TimesNewRomanPS-BoldMT.
Didn't find this font on the system!
Substituting font Times-Bold for TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file n021004l.pfb.
Loading NimbusRomNo9L-Medi font from %rom%Resource/Font/NimbusRomNo9L-Medi... 2770916 
1184848 11650700 10189122 3 done.

marcos@macbookpro:[97]% more cidfmap 
%!
% $Id: cidfmap 6300 2005-12-28 19:56:24Z giles $
% This is a sample map file for CIDFont category.

%
% The map is a set of records, which must use one of the two formats :
%
% 1. A substutution of a CIF font with another CID font :
%
%    /substituted /original ;
%
%    Where 'substituted' is a name being used in a document,
%    'original' is a name of an available resource.
%
% 2. A substutution of a CIF font with a True Type font :
%
%    /substituted << /FileType /TrueType /Path (path) /SunfontID 1 /CSI [(ordering) supplement] >> ;
%
%    Where 'substituted' is a name being used in a document,
%    'path' is a path to a True Type font file,
%    'ordering' is a value of Ordering required for CIDSystemInfo dictionary,
%    'supplement' is a value of Supplement required for CIDSystemInfo dictionary.
%
% Examples :
%    
%   /ShinGo-Bold   /HeiseiKakuGo-W5 ;
%   /Ryumin-Medium << /FileType /TrueType /Path (H:/AuxFiles/Fonts/BATANG.TTC) /SubfontID 3 
/CSI [(Japan1) 2] >> ;
%

%/ShinGo-Bold   /Adobe-Japan1 ;
/Adobe-Japan1  /WadaGo-Bold ;

marcos@macbookpro:[98]% 

Comment 8 Ray Johnston 2008-07-21 14:25:21 UTC
I think I understand the problem. When COMPILE_INITS=1 (as it is by default on
linux, and is on my development version on Windows), the default GenericResourceDir
is %rom%Resource/ 

If I use  -sGenericResourceDir=./Resource/ prior to the input file, then this
works.

If the WadaGo-Bold is in the Resource/CIDFont when I build, I get a different
error message:

Substituting CID font resource/Adobe-Japan1 for /éléréoû&#9563;Æ&#8976;.
Error: /invalidfileaccess in findresource
Operand stack:
   --nostringval--   --dict:5/14(L)--   F0   10.1719   --dict:6/6(L)--  
--dict:6/6(L)--   éléréoû&#9563;Æ&#8976;   --dict:10/12(ro)(G)--   --nostringval--  
CIDFontObject   --dict:8/8(L)--   --dict:8/8(L)--   Adobe-Japan1   CIDFont  
true   Adobe-Japan1   Adobe-Japan1   WadaGo-Bold   --nostringval--   8082  
2914020   DataSource   --nostringval--   true

I'm not running -dSAFER so I don't know what the /invalidfileaccess is coming
from.
Comment 9 Alex Cherepanov 2008-07-23 22:30:19 UTC
Created attachment 4235 [details]
experimental patch - doesn't work
Comment 10 Alex Cherepanov 2008-07-23 22:40:53 UTC
Created attachment 4236 [details]
foo.ps -- test program

First, %rom% file system didn't provide working file_open_stream()
function. The experimental patch attempts to resolve this problem.
Still, interaction between the reusable stream and %rom% files is not
correct. The program attached clearly shows this.

So this bug is about reusable streams and %rom% files rather than resource
machinery.
Comment 11 Alex Cherepanov 2008-07-26 19:56:24 UTC
Fix direct access to a subfile in the %rom% file system by reusable
stream.
1. Open the source file of the reusable stream as a general stream,
   rather than an os-based file stream.
2. Take into account file_offset member when accessing the stream.

The following patch has been committed as a rev. 8878.
http://ghostscript.com/pipermail/gs-cvs/2008-July/008457.html
Regression testing shows no differences.