]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/ghostscript/markhint.ps
etherbcm: handle 64-bit host addresses, use PCIWADDR() instead of PADDR()
[plan9front.git] / sys / lib / ghostscript / markhint.ps
1 %    Copyright (C) 1994, 1995, 1996 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: markhint.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
17 % markhint.ps
18 % Draw the hints for a Type 1 font.
19
20 (type1ops.ps) runlibfile
21
22 /mhsetup                % <matrix> <print> mhsetup -
23  { /mhprint exch def
24    /mhmx exch def
25    /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
26    gsave
27    clippath pathbbox
28    2 index sub /bbh exch def
29    2 index sub /bbw exch def
30    /bby exch def
31    /bbx exch def
32    grestore
33  } def
34
35 /markfonthints          % <matrix> <print> markfonthints -
36  { mhsetup
37  } def
38
39 /hmark                  % <y> hmark -
40  { bbx exch moveto bbw 0 rlineto stroke
41  } def
42 /hsmark                 % <y0> <dy> hsmark -
43  { 1 index add exch gsave
44    [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
45    [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
46    grestore
47  } def
48 /vmark                  % <x> vmark -
49  { bby moveto 0 bbh rlineto stroke
50  } def
51 /vsmark                 % <x0> <dx> vsmark -
52  { 1 index add exch gsave
53    [mhdash] mhdash setdash 0 mhmx transform pop vmark
54    [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
55    grestore
56  } def
57 /pmark                  % <x> <y> pmark -
58  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
59    0 360 arc stroke
60  } def
61 /mchdict mark
62   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
63   /sbw { pop pop mhmx transform translate 0 0 pmark }
64   /hstem
65    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
66      hsmark
67    }
68   /vstem
69    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
70      vsmark
71    }
72   /hstem3
73    { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
74      3 { hsmark } repeat
75    }
76   /vstem3
77    { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
78      3 { vsmark } repeat
79    }
80   /div
81    { div
82    }
83   /callothersubr
84    { 3 eq
85       { pop
86         mhprint { (replace) = } if
87                 % We're replacing hints; lighten the color.
88         currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
89       }
90       { { pop } repeat
91       } ifelse
92    }
93   /callsubr
94    { Private /Subrs get exch get mchinterp
95    }
96   /pop
97    {
98    }
99   /return
100    {
101    }
102 .dicttomark def
103
104 /mchinterp              % <charstring> mchinterp -
105  { 4330 exch dup length string .type1decrypt exch pop
106    dup length lenIV sub lenIV exch getinterval
107    0 () /SubFileDecode filter
108    mark exch charstack_read ]
109     { dup type /nametype eq
110        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
111        }
112       if
113     }
114    forall
115  } def
116
117 /markcharhints          % <charname> <matrix> <print> markcharhints -
118  { mhsetup
119    gsave mark
120    /Private currentfont /Private get def
121    Private rcheck       % make sure we won't get an access error
122     { /lenIV Private /lenIV .knownget not { 4 } if def
123       currentfont /CharStrings get 3 -1 roll get mchinterp
124     }
125     { (Sorry, this font is protected; I can't show the hints.\n) print flush
126       exch
127     }
128    ifelse
129    cleartomark grestore
130  } def