Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #292 > unrolled thread

PostScript, Fortran, GhostScript: need help pinpointing a problem

Started byhelbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply)
First post2011-08-14 10:01 +0000
Last post2011-08-14 20:09 +0100
Articles 8 — 5 participants

Back to article view | Back to comp.lang.postscript


Contents

  PostScript, Fortran, GhostScript: need help pinpointing a problem helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply) - 2011-08-14 10:01 +0000
    Re: PostScript, Fortran, GhostScript: need help pinpointing a problem "Mark T. B. Carroll" <mtbc@bcs.org> - 2011-08-14 08:24 -0400
    Re: PostScript, Fortran, GhostScript: need help pinpointing a problem SaGS <sags5495@gmail.com> - 2011-08-14 05:12 -0700
      Re: PostScript, Fortran, GhostScript: need help pinpointing a problem helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply) - 2011-08-14 15:02 +0000
        Re: PostScript, Fortran, GhostScript: need help pinpointing a problem Helge Blischke <h.blischke@acm.org> - 2011-08-14 18:39 +0200
          Re: PostScript, Fortran, GhostScript: need help pinpointing a problem helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply) - 2011-08-14 17:11 +0000
            Re: PostScript, Fortran, GhostScript: need help pinpointing a problem Helge Blischke <h.blischke@acm.org> - 2011-08-14 19:19 +0200
    Re: PostScript, Fortran, GhostScript: need help pinpointing a problem ken <ken@spamcop.net> - 2011-08-14 20:09 +0100

#292 — PostScript, Fortran, GhostScript: need help pinpointing a problem

Fromhelbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply)
Date2011-08-14 10:01 +0000
SubjectPostScript, Fortran, GhostScript: need help pinpointing a problem
Message-ID<j286e5$j1r$1@online.de>
I inherited a Fortran program which produces PostScript files.  I use it 
for plotting.  Works fine, nice interface, easy to use, produces 
reasonable PostScript, does all I need.  In other words, I want to 
continue to use it.

The files which it produces always look correct on a PostScript printer.
However, with GhostScript, sometimes some fonts are substituted (Latin 
letters instead of the Greek ones I want).  I have also seen this when 
someone else produced PostScript output with one of the plots included 
in a LaTeX document (I don't know the details of that).

The Program is from the early 1990s, so knows only about PostScript from 
that timeframe.  As far as I know, it uses just standard "built-in 
PostScript fonts".

With a new version of GhostScript, I see an error message which points 
to the problem.  However, I am still not clear what the actual source of 
the problem is and how to correct it.

I want to figure out if the problem is with the PostScript file
(produced by the Fortran program), with GhostScript or with the setup on 
my system (maybe I need to install some fonts).

The problem is that I see Latin letters (l and W) for the axes labels 
when I want to see Greek letters (from the Symbol font).

I have a very small PostScript file (see below) which reproduces the
problem.  Any help much apprecieated. 

Here is the output:

GPL Ghostscript 9.02 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file %rom%Resource/Font/Symbo.
Can't find (or can't open) font file Symbo.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Courier for Symbo.
Loading Courier font from SYS$COMMON:[SYSFONT.DECW.TYPE1]COUR.PFA... 2622656 122
2190 2726224 1436575 1 done.
GPL Ghostscript 9.02: Warning: the Xfonts feature is deprecated and will be remo
ved in a future release.
Loading NimbusSanL-BoldItal font from %rom%Resource/Font/NimbusSanL-BoldItal...
2639344 1305899 2746320 1445298 1 done.
>>showpage, press <return> to continue<<
quit
GS>

The problem is:

Can't find (or can't open) font file %rom%Resource/Font/Symbo.
Can't find (or can't open) font file Symbo.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Courier for Symbo.
Loading Courier font from SYS$COMMON:[SYSFONT.DECW.TYPE1]COUR.PFA... 2622656 122
2190 2726224 1436575 1 done.

What puzzles me is that the error message says "Symbo" instead of
"Symbol".  Why?  Is it looking for Symbo and can't find it, but 
presumably could find Symbol?

Also, what does this mean:

GPL Ghostscript 9.02: Warning: the Xfonts feature is deprecated and will 
be remo
ved in a future release.
Loading NimbusSanL-BoldItal font from %rom%Resource/Font/NimbusSanL-
BoldItal...
2639344 1305899 2746320 1445298 1 done.

---------8<-------------------------------------------------------------------

%!
%%Emulation(postscript)
%%BoundingBox: 50 50 249.4488 300.866
/lpemudict 120 dict def                                                         
lpemudict begin                                                                 
/bdef   {bind def} bind def                                                     
/bflg   false def                                                               
/Bfont  0 def                                                                   
/bon    false def                                                               
/psz    0 def                                                                   
/hscl   0 def                                                                   
/nbuff  32 string def                                                           
/reencode                                                                       
{ dup FontDirectory exch known                                                  
  { findfont }                                                                  
  { dup nbuff cvs dup length 1 sub 0 exch getinterval                           
    findfont begin                                                              
    currentdict dup length dict begin                                           
        { 1 index /FID ne {def} {pop pop} ifelse } forall                       
        /FontName exch def                                                      
        /Encoding lpemuEncoding def                                             
    currentdict dup end end                                                     
    /FontName get exch definefont                                               
  } ifelse                                                                      
} bdef                                                                          
/Ux 0 def                                                                       
/Uy 0 def                                                                       
/lpemuEncoding StandardEncoding 256 array copy def                              
0 [ 127 /Aacute/Acircumflex/Adieresis/Agrave/Aring/Atilde/Ccedilla              
   /Delta/Eacute/Ecircumflex/Edieresis/Egrave/Eth/Gamma/Iacute/Icircumflex      
   /Idieresis/Igrave/Lambda/Ntilde/Oacute/Ocircumflex/Odieresis/Ograve          
   /Omega/Otilde/Phi/Pi/Psi/Scaron/Sigma/TeXtext32/Theta/Thorn                  
  209 /Uacute/Ucircumflex/Udieresis/Ugrave/Upsilon/Xi/Yacute/Ydieresis          
   /Zcaron/aacute/acircumflex/adieresis/agrave/aring/atilde/brokenbar           
  228 /ccedilla/copyright/degree/divide                                         
  236 /dotlessj/eacute/ecircumflex/edieresis/egrave 242 /eth/ff/ffi             
  246 /ffl/iacute 252 /icircumflex/idieresis/igrave/logicalnot                  
  1 /minus/mu/multiply/ntilde/oacute/ocircumflex/odieresis/ograve/onehalf       
   /onequarter/onesuperior/otilde/plusminus/registered/scaron/thorn             
   /threequarters/threesuperior/trademark/twosuperior/uacute/ucircumflex        
   /udieresis/ugrave/yacute/ydieresis/zcaron                                    
]                                                                               
{ dup type /nametype eq                                                         
  {  lpemuEncoding 2 index 2 index put                                          
     pop 1 add                                                                  
  }                                                                             
  {  exch pop                                                                   
  } ifelse                                                                      
} forall pop                                                                    
/_bd {save} bdef                                                                
/_bp {save 2 setmiterlimit .06 .06 scale 0 0 moveto} bdef                       
/_ff                                                                            
{ exch reencode exch                                                            
  dup /psz exch def                                                             
  scalefont dup /Bfont exch def setfont                                         
} bdef                                                                          
end                                                                             
lpemudict begin                                                                 
                                                                                
/rightshow                                                                      
{dup stringwidth pop                                                            
 0 exch sub                                                                     
 0 rmoveto                                                                      
 show} def                                                                      
                                                                                
/middleshow                                                                     
{dup stringwidth pop                                                            
 2 div 0 exch sub                                                               
 0 rmoveto                                                                      
 show} def                                                                      
                                                                                
 /L{newpath moveto lineto stroke}def
 /M{newpath moveto moveto stroke}def
 /T{translate}def
 1 setlinecap
 1 setlinejoin
     0.283 setlinewidth
     70.866     70.866      0.000      0.000 M
     70.866     70.866 T
      0.000      0.000      0.000      0.000 M
      0.000      0.000 T
      0.000      0.000      0.000      0.000 M
      0.000      0.000 T
     1.417 setlinewidth
      0.000      0.000      0.000      0.000 M
      0.000      0.000 T
      0.000      0.000      0.000      0.000 M
    425.197      0.000      0.000      0.000 L
    425.197     14.173    425.197      0.000 L
 /Symbol      16.798 _ff
   212.598   -39.685 moveto
 (l) show
   212.598   -39.685 moveto
    425.197      0.000    212.598    -39.685 M
    425.197    425.197    425.197      0.000 L
    411.024    425.197    425.197    425.197 L
    425.197    425.197    411.024    425.197 M
      0.000    425.197    425.197    425.197 L
      0.000    411.024      0.000    425.197 L
      0.000    425.197      0.000    411.024 M
 /Helvetica-BoldObliqueR     25.197 _ff
     0.000   453.543 moveto
 (age) show
     0.000   453.543 moveto
 /Helvetica-BoldObliqueR     25.197 _ff
   212.598   453.543 moveto
 ( ) show
   212.598   453.543 moveto
 /Symbol      16.798 _ff
   -28.346   212.598 translate
    90.000 rotate
     0.000     0.000 moveto
 (W) show
   -90.000 rotate
    28.346  -212.598 translate
   -28.346   212.598 moveto
      0.000    425.197    -28.346    212.598 M
      0.000      0.000      0.000    425.197 L
     14.173      0.000      0.000      0.000 L
      0.000      0.000     14.173      0.000 M
     0.283 setlinewidth
 newpath
     0.000     0.000 moveto
   425.197     0.000 lineto
   425.197   425.197 lineto
     0.000   425.197 lineto
 closepath clip
 showpage
 end

[toc] | [next] | [standalone]


#293

From"Mark T. B. Carroll" <mtbc@bcs.org>
Date2011-08-14 08:24 -0400
Message-ID<87k4agji59.fsf@ixod.org>
In reply to#292
helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply)
writes:

> With a new version of GhostScript, I see an error message which points 
> to the problem.  However, I am still not clear what the actual source of 
> the problem is and how to correct it.

Hmm, at a glance, I'm not sure either.

> /reencode                                                                       
> { dup FontDirectory exch known                                                  
>   { findfont }                                                                  
>   { dup nbuff cvs dup length 1 sub 0 exch getinterval                           
>     findfont begin                                                              
>     currentdict dup length dict begin                                           
>         { 1 index /FID ne {def} {pop pop} ifelse } forall                       
>         /FontName exch def                                                      
>         /Encoding lpemuEncoding def                                             
>     currentdict dup end end                                                     
>     /FontName get exch definefont                                               
>   } ifelse                                                                      
> } bdef                                                                          

This part is significant. The "l" gets chopped off "Symbol" basically
through this "length 1 sub" I think. I've no idea why. But even then
there's the question of the definition of l and W in the Symbol font.
Maybe somebody who knows more about font encodings and StandardEncoding
and whatever can tell us more.

In the worst case, it's possible that one of us can point you to a tool
that does what you need without such weirdness. (-:

Mark

[toc] | [prev] | [next] | [standalone]


#294

FromSaGS <sags5495@gmail.com>
Date2011-08-14 05:12 -0700
Message-ID<4097c3f8-0d56-4a4d-82cc-d08ebc469840@a31g2000vbt.googlegroups.com>
In reply to#292
On Aug 14, 1:01 pm, hel...@astro.multiCLOTHESvax.de (Phillip Helbig---
undress to reply) wrote:

> ...
> However, with GhostScript, sometimes some fonts are substituted (Latin
> letters instead of the Greek ones I want).  
> ...
> The Program is from the early 1990s, so knows only about PostScript from
> that timeframe.
> ...
> The problem is that I see Latin letters (l and W) for the axes labels
> when I want to see Greek letters (from the Symbol font).
> ...
> Can't find (or can't open) font file %rom%Resource/Font/Symbo.
> Can't find (or can't open) font file Symbo.
> ...
> What puzzles me is that the error message says "Symbo" instead of
> "Symbol".  Why?  Is it looking for Symbo and can't find it, but
> presumably could find Symbol?
> ...
> /reencode                                                                      
> { dup FontDirectory exch known
>   { findfont }
>   { dup nbuff cvs dup length 1 sub 0 exch getinterval
>     findfont begin
>     ...
>   } ifelse                                                                      } bdef

In short, it's an assumption made by the "reencode" procedure defined
by the PostScript code that may have been true for languagelevel 1
PostScript, but not necessarily for languagelevel 2 or 3.

More precisely, the code assumes that if a font name is not already
registered in FontDirectory, then that font does not really exist.
Then it uses non-existent font names to force reencoding of PostScript
fonts; these names are formed from the "base" PostScript font names
with an extra character ("R") at the end, like "Helvetica-
BoldObliqueR".

Ghostscript starts with an empty FontDirectory, and uses the resource
machinery (introduced in languagelevel 2) to find and load fonts. The
"reencode" procedure does not find the name "Symbol" in FontDirectory,
and assumes it has to be the name of a reencoded version of
"Symbo" (the name it received less last character). So, the error you
see.

Workaround: pass "-c /Symbol findfont pop -f" on Ghostscript's command
line, before the file you want to process. This forces loading the
Symbol font, so it will be present in the FontDirectory.

> ...
> Also, what does this mean:
>
> GPL Ghostscript 9.02: Warning: the Xfonts feature is deprecated and will
> be removed in a future release.
> ...

See http://www.ghostscript.com/doc/current/Xfonts.htm

[toc] | [prev] | [next] | [standalone]


#295

Fromhelbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply)
Date2011-08-14 15:02 +0000
Message-ID<j28o33$1cj$1@online.de>
In reply to#294
In article
<4097c3f8-0d56-4a4d-82cc-d08ebc469840@a31g2000vbt.googlegroups.com>,
SaGS <sags5495@gmail.com> writes: 

> In short, it's an assumption made by the "reencode" procedure defined
> by the PostScript code that may have been true for languagelevel 1
> PostScript, but not necessarily for languagelevel 2 or 3.

OK.  In general, does this mean that there is no guaranteed backward 
compatibility?

> More precisely, the code assumes that if a font name is not already
> registered in FontDirectory, then that font does not really exist.
> Then it uses non-existent font names to force reencoding of PostScript
> fonts; these names are formed from the "base" PostScript font names
> with an extra character ("R") at the end, like "Helvetica-
> BoldObliqueR".
> 
> Ghostscript starts with an empty FontDirectory, and uses the resource
> machinery (introduced in languagelevel 2) to find and load fonts. The
> "reencode" procedure does not find the name "Symbol" in FontDirectory,
> and assumes it has to be the name of a reencoded version of
> "Symbo" (the name it received less last character). So, the error you
> see.

OK, now I understand where it's coming from.  Since it's a GhostScript 
thing, then it is clear why the file prints OK.
 
> Workaround: pass "-c /Symbol findfont pop -f" on Ghostscript's command
> line, before the file you want to process. This forces loading the
> Symbol font, so it will be present in the FontDirectory.

I can't get this to work.  (I mainly used GV but am now testing a new 
version of GhostScript.)

What, exactly, should I type at the command line (that of the OS or of 
GS), when should I hit <RETURN>, should I quote the command etc.  I've 
tried all permutations.

Is there an easy way to edit the file (preferably inserting something 
only at the beginning of the file) to avoid this error?

Another question: Why is the Symbol font not found in the first place?
I thought it was rather standard.

[toc] | [prev] | [next] | [standalone]


#296

FromHelge Blischke <h.blischke@acm.org>
Date2011-08-14 18:39 +0200
Message-ID<9aqc25Fon7U1@mid.individual.net>
In reply to#295
Phillip Helbig---undress to reply wrote:

> In article
> <4097c3f8-0d56-4a4d-82cc-d08ebc469840@a31g2000vbt.googlegroups.com>,
> SaGS <sags5495@gmail.com> writes:
> 
>> In short, it's an assumption made by the "reencode" procedure defined
>> by the PostScript code that may have been true for languagelevel 1
>> PostScript, but not necessarily for languagelevel 2 or 3.
> 
> OK.  In general, does this mean that there is no guaranteed backward
> compatibility?
> 
>> More precisely, the code assumes that if a font name is not already
>> registered in FontDirectory, then that font does not really exist.
>> Then it uses non-existent font names to force reencoding of PostScript
>> fonts; these names are formed from the "base" PostScript font names
>> with an extra character ("R") at the end, like "Helvetica-
>> BoldObliqueR".
>> 
>> Ghostscript starts with an empty FontDirectory, and uses the resource
>> machinery (introduced in languagelevel 2) to find and load fonts. The
>> "reencode" procedure does not find the name "Symbol" in FontDirectory,
>> and assumes it has to be the name of a reencoded version of
>> "Symbo" (the name it received less last character). So, the error you
>> see.
> 
> OK, now I understand where it's coming from.  Since it's a GhostScript
> thing, then it is clear why the file prints OK.
>  
>> Workaround: pass "-c /Symbol findfont pop -f" on Ghostscript's command
>> line, before the file you want to process. This forces loading the
>> Symbol font, so it will be present in the FontDirectory.
> 
> I can't get this to work.  (I mainly used GV but am now testing a new
> version of GhostScript.)
try something like:
gs -r72 -c save pop /Symbol findfont pop -f filename
> 
> What, exactly, should I type at the command line (that of the OS or of
> GS), when should I hit <RETURN>, should I quote the command etc.  I've
> tried all permutations.
> 
> Is there an easy way to edit the file (preferably inserting something
> only at the beginning of the file) to avoid this error?
You may insert the line
/Symbol findfont pop
just after the line
lpemuldict begin
to preload the Symbol font into the FontDirectory.
> 
> Another question: Why is the Symbol font not found in the first place?
> I thought it was rather standard.
as SaGS states above, Ghostscript starts with an empty FontDirectory 
dictioary, whereas most PostScript printers (still) preload the fonts 
embedded in the printer (the so called ROM fonts) during a (vendor specific) 
startup procedure.

Helge


[toc] | [prev] | [next] | [standalone]


#297

Fromhelbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply)
Date2011-08-14 17:11 +0000
Message-ID<j28vj7$7v4$1@online.de>
In reply to#296
In article <9aqc25Fon7U1@mid.individual.net>, Helge Blischke
<h.blischke@acm.org> writes: 

> > Is there an easy way to edit the file (preferably inserting something
> > only at the beginning of the file) to avoid this error?
> You may insert the line
> /Symbol findfont pop
> just after the line
> lpemuldict begin
> to preload the Symbol font into the FontDirectory.

That worked; thanks!  I could modify the Fortran program to always put 
in this line (presumably it wouldn't hurt).

> > Another question: Why is the Symbol font not found in the first place?
> > I thought it was rather standard.
> as SaGS states above, Ghostscript starts with an empty FontDirectory 
> dictioary, whereas most PostScript printers (still) preload the fonts 
> embedded in the printer (the so called ROM fonts) during a (vendor specific) 
> startup procedure.

OK.  However, the 12 other fonts the Fortran program uses (Roman,
Sans-Serif and Typewriter and each bold/non-bold italic/non-italic) all 
display correctly in GhostScript; why is it only the Symbol font which 
has the problem?

[toc] | [prev] | [next] | [standalone]


#298

FromHelge Blischke <h.blischke@acm.org>
Date2011-08-14 19:19 +0200
Message-ID<9aqed7FaurU1@mid.individual.net>
In reply to#297
Phillip Helbig---undress to reply wrote:

> In article <9aqc25Fon7U1@mid.individual.net>, Helge Blischke
> <h.blischke@acm.org> writes:
> 
>> > Is there an easy way to edit the file (preferably inserting something
>> > only at the beginning of the file) to avoid this error?
>> You may insert the line
>> /Symbol findfont pop
>> just after the line
>> lpemuldict begin
>> to preload the Symbol font into the FontDirectory.
> 
> That worked; thanks!  I could modify the Fortran program to always put
> in this line (presumably it wouldn't hurt).
> 
>> > Another question: Why is the Symbol font not found in the first place?
>> > I thought it was rather standard.
>> as SaGS states above, Ghostscript starts with an empty FontDirectory
>> dictioary, whereas most PostScript printers (still) preload the fonts
>> embedded in the printer (the so called ROM fonts) during a (vendor
>> specific) startup procedure.
> 
> OK.  However, the 12 other fonts the Fortran program uses (Roman,
> Sans-Serif and Typewriter and each bold/non-bold italic/non-italic) all
> display correctly in GhostScript; why is it only the Symbol font which
> has the problem?
because of how the reencode procedure your fortran program spits out is 
defined. Roughly said, it works as follows:
1) if the font is already in FontDirectory, use it as it is.
2) otherwise, chop off the last letter from the requested font name, 
retrieve the font having the truncated name, reencode it and save it under 
the original name in FontDorectory (so it won't be reencoded a second time).
Thus, e.g. the font
/Helvetica-BoldOblique
will be saved as 
/Helvetica-BoldObliqueR
(R for "reencoded") in the interpreter's FontDirectory.

Helge

[toc] | [prev] | [next] | [standalone]


#299

Fromken <ken@spamcop.net>
Date2011-08-14 20:09 +0100
Message-ID<MPG.28b22db6b9f1f1c498985a@usenet.plus.net>
In reply to#292
In article <j286e5$j1r$1@online.de>, helbig@astro.multiCLOTHESvax.de 
says...

> The problem is:
> 
> Can't find (or can't open) font file %rom%Resource/Font/Symbo.

Should say 'Symbol' maybe the PostScript is corrupt.


> What puzzles me is that the error message says "Symbo" instead of
> "Symbol".  Why?  Is it looking for Symbo and can't find it, but 
> presumably could find Symbol?

Yes, possibly.

 
> Also, what does this mean:
> 
> GPL Ghostscript 9.02: Warning: the Xfonts feature is deprecated and will 
> be remo
> ved in a future release.

Means you loaded an eXternal fotn (XFont) and we plan to ditch that 
support. If its important to you, better let Artifex know.


Will look at program on Monday


			Ken

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web