]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/ghostscript/gs_ccfnt.ps
Import sources from 2011-03-30 iso image - sys/lib
[plan9front.git] / sys / lib / ghostscript / gs_ccfnt.ps
1 %    Copyright (C) 1994, 2000 Aladdin Enterprises.  All rights reserved.
2
3 % This software is provided AS-IS with no warranty, either express or
4 % implied.
5
6 % This software is distributed under license and may not be copied,
7 % modified or distributed except as expressly authorized under the terms
8 % of the license contained in the file LICENSE in this distribution.
9
10 % For more information about licensing, please refer to
11 % http://www.ghostscript.com/licensing/. For information on
12 % commercial licensing, go to http://www.artifex.com/licensing/ or
13 % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14 % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
16 % $Id: gs_ccfnt.ps,v 1.8 2003/04/12 18:08:18 ray Exp $
17 % Find and register all the precompiled font operators in systemdict.
18
19 /registerfont                   % <fontname> <fontdict> registerfont <font>
20  { CCFONTDEBUG { (Registering ) print 1 index = } if
21    dup begin
22      Encoding type /nametype eq
23       { Encoding .findencoding /Encoding exch def
24       }
25      if
26      dup /PrefEnc known
27       { PrefEnc type /nametype eq
28          { PrefEnc .findencoding /PrefEnc exch def
29          }
30         if
31       }
32      if
33      dup /FDepVector known
34       { /FDepVector [ FDepVector
35          { .FontDirectory 1 index .knownget
36             { exch pop }
37             { ccfonts 1 index .knownget
38                { registerfont
39                }
40                { Fontmap 1 index known
41                   { findfont }
42                   { pop NullFont }
43                  ifelse
44                }
45               ifelse
46             }
47            ifelse
48          }
49         forall ] readonly def
50       }
51      if
52    end
53    % Use the value of definefont appropriate at run-time, not bind-time
54    /definefont load exec
55  } bind odef
56 % Bind recursive call (bind descends into oparrays: feature!)
57 /registerfont dup load bind def
58
59 /.loadinitialfonts {
60   //.loadinitialfonts exec
61   NOCCFONTS not {
62     /ccfonts mark
63       0 1 null .getccfont 1 sub { .getccfont dup /FontName get exch } for
64     .dicttomark def
65                 % Make sure these fonts are registered as "resources".
66     currentfile {
67       pop ccfonts {
68         .FontDirectory 2 index known { pop pop } { registerfont pop } ifelse
69       } forall
70     } .execasresource
71     currentdict /ccfonts .undef
72   } if
73 } bind def
74
75 currentdict /registerfont .undef