"restore" should restore resource category? (Re: [gs-devel] GS
6.53/7.05 unable to process CJK PS files printed from acroread)
Ray Johnston
ray at artifex.com
Thu Aug 1 09:37:04 PDT 2002
Dear mpsuzuki,
I think that the problem is that the Adobe AR5 Procset is expecting that
global memory is unaffected by a restore, as it would be if the code
were running in a printer under a job server.
The job server saves the state before starting a job, then restores it
afterwards.
Ghostscript does not run files as jobs under a job server by default
so the ct_BadResourceImplementation? test is being performed at save
level 0. At save level 0, global memory is restored, including the
dictionary where the Resource category is kept.
To make Ghostscript run a file as if it were under a job server, you
can use:
-c "false 0 startjob pop" -f file.ps
Where 'file.ps' is the file to be run.
When I test the code snippet you sent (with the comments removed),
the ct_BadResourceImplementation? gets set to true if I do this
startjob before running the code.
This may be the simplest solution to the problem. Please let me know.
Regards,
Ray
____________________________________________________________________
mpsuzuki at hiroshima-u.ac.jp wrote:
>
> Dear Mr. Anthony and GS developers,
>
> >http://anthony.homelinux.net/~foka/gs/c_hkscs-page3-printed-by-acroread-5.0.5.ps.gz
>
> As I've written before, font errors are caused by missing-FID trouble.
>
> PDF-to-PS convertor in AcrobatReader 5.x for UNIX inserts several small
> programs to check implementation of PS printer, and some of them is a bit
> nasty.
>
> I suppose AR5 for UNIX inserts several emulation procedures into his
> output, but there might be some cases which suitable emulation procedures
> are not enabled.
>
> If anybody have PS printer using (incomplete) clones of PS Level2 or
> Level3 renderer, please check how /ct_BadResourceImplementation? is
> defined and Anthony's sample is correctly rendered /or not.
>
> In Anthony's case, implementation checker of AR5 (in MakeOCF utils)
> takes GS as "broken resource implementation", and it wipes out
> predefined CIDFont support codes from dictionary. As a result, GS's
> CIDFont support is disabled, and GS cannot add FID to CIDFont dictionary.
>
> Following is the checker AR5 for UNIX inserts, taken from Mr. Anthony's sample.
> ----------------------------------------------------------------------
> %%BeginResource: procset Adobe_CoolType_Utility_MAKEOCF 1.14 0
> %%Copyright: Copyright 1987-2001 Adobe Systems Incorporated.
> %%Version: 1.14 0
>
> systemdict
> /languagelevel known
> dup
> { currentglobal false setglobal } { false }ifelse
> exch
> userdict
> /Adobe_CoolType_Utility 2 copy known
> {
> 2 copy get dup maxlength 25 add dict copy
> } {
> 25 dict
> } ifelse
> put
> Adobe_CoolType_Utility begin
> /ct_Level2? exch def
> % /ct_Clone?
> % 1183615869
> % internaldict
> % dup /CCRun known not
> % exch /eCCRun known not
> % ct_Level2?
> % and
> % or
> % def
>
> /ct_BadResourceImplementation?
> ct_Level2? {
> save currentglobal true setglobal
> /Generic /Category findresource dup length
> dict
> copy dup
> /InstanceType /dicttype put
> /egiremaevets exch
> /Category defineresource
> pop setglobal
> /foo 1 dict dup
> /s 3 put/egiremaevets
> defineresource
> pop
> restore
> % mark {
> /bar 1 dict
> dup
> /a 7 put
> /egiremaevets defineresource
> % } stopped {
> % cleartomark
> % true
> % } {
> % cleartomark false
> % } ifelse
> % currentglobal true setglobal
> %
> % /egiremaevets /Category undefineresource setglobal
> } {
> false
> } ifelse
> def
> --------------------------------------------------------------------------
>
> /ct_BadResourceImplementation? is set to true when the implementation
> is marked as "bad", and false when no problem (Distiller is marked as
> "false").
>
> The testing procedure is:
> [1] if the system is PS Level 1, always
> /ct_BadResourceImplementation? = false.
> (I'm not sure whether this is reasonable)
>
> [2] if the system is PS Level 2 or later,
> following test is executed.
>
> [2-1] make the vanilla VM snapshot by "save"
>
> [2-2] create /egiremaevets resource category
>
> [2-3] add /foo dictionary to /egiremaevents resource
>
> [2-4] execute "restore"
>
> [2-5] try to add /bar dictionary to /egiremaevents resource
>
> [2-5-a] if ok, /ct_BadResourceImplementation? = false
>
> [2-5-b] if failed, /ct_BadResourceImplementation? = true
>
> In gs6.53, procedure [2-4] wipe out /egiremaevents category itself,
> so [2-5] is failed, and marked as "bad implementation".
>
> In Distiller, procedure [2-4] wipes out /foo in /egiremaevents,
> but empty /egiremaevents is left in resource category. So, [2-5]
> is succeeded.
>
> When I modify [2-5-b] to make always /ct_BadResourceImplementation? = false,
> gs6.53 could render Mr. Anthony's sample PDF.
>
> There might be several fixes:
>
> (A) make GS's resource management similar to Distiller (difficult?)
>
> (B) by some options, restrict GS functionalities to real Level 1 (difficult?)
>
> (C) duplicate FID adding procedure to default /DefineResource in gs_res.ps
>
> (D) add missing-FID fallback functionalities to zbuildfont9 etc
>
> which is best and which is easiest?
>
> Regards,
>
> mpsuzuki
>
> _______________________________________________
> gs-devel mailing list
> gs-devel at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-devel
More information about the gs-devel
mailing list