Debian Codegraph @

texmf-dist/dvips/pst-text/pst-text.pro

raw
1 %!
2 % $Id: pst-text.pro 891 2018-12-29 19:42:20Z herbert $
3 %
4 % PostScript header file pst-text.pro
5 % Version 1.02, 2018-12-28 (hv)
6 % For distribution, see pstricks.tex.
7 %
8 /tx@TextPathDict 45 dict def
9 tx@TextPathDict begin
10 %
11 % Syntax: <dist> PathPosition -
12 % Function: Searches for position of currentpath distance <dist> from
13 % beginning. Sets (X,Y)=position, and Angle=tangent.
14 /PathPosition
15 { /targetdist exch def
16 /pathdist 0 def
17 /continue true def
18 /X { newx } def /Y { newy } def /Angle 0 def
19 gsave
20 flattenpath
21 { movetoproc } { linetoproc } { } { firstx firsty linetoproc }
22 /pathforall load stopped { pop pop pop pop /X 0 def /Y 0 def } if
23 grestore
24 } def
25 %
26 /movetoproc { continue { @movetoproc } { pop pop } ifelse } def
27 %
28 /@movetoproc
29 { /newy exch def /newx exch def
30 /firstx newx def /firsty newy def
31 } def
32 %
33 /linetoproc { continue { @linetoproc } { pop pop } ifelse } def
34 %
35 /@linetoproc {
36 /oldx newx def /oldy newy def
37 /newy exch def /newx exch def
38 /dx newx oldx sub def
39 /dy newy oldy sub def
40 /dist dx dup mul dy dup mul add sqrt def
41 /pathdist pathdist dist add def
42 pathdist targetdist ge
43 { pathdist targetdist sub dist div dup
44 dy mul neg newy add /Y exch def
45 dx mul neg newx add /X exch def
46 /Angle dy dx atan def
47 /continue false def
48 } if
49 } def
50 %
51 /TextPathShow {
52 /String exch def
53 /CharCount 0 def
54 % hv begin 2005-11-29 1.00
55 % String length
56 % { String CharCount 1 getinterval ShowChar
57 % /CharCount CharCount 1 add def
58 /CharSize 1 def
59 currentfont /FontType get 0 eq
60 { currentfont /FMapType get dup 2 eq exch dup 5 eq exch 9 eq or or
61 { /CharSize 2 def} if
62 } if
63 String length CharSize idiv
64 { String CharCount CharSize getinterval ShowChar
65 /CharCount CharCount CharSize add def
66 % hv end 2005-11-29 1.00
67 } repeat
68 } def
69 %
70 % Syntax: <pathlength> <position> InitTextPath -
71 /InitTextPath
72 { gsave
73 currentpoint /Y exch def /X exch def
74 exch X Hoffset sub sub mul
75 Voffset Hoffset sub add
76 neg X add /Hoffset exch def
77 /Voffset Y def
78 grestore
79 } def
80 %
81 /Transform
82 { PathPosition
83 dup
84 Angle cos mul Y add exch
85 Angle sin mul neg X add exch
86 translate
87 Angle rotate
88 } def
89 %
90 /ShowChar {
91 /Char exch def
92 gsave
93 Char end stringwidth
94 tx@TextPathDict begin
95 2 div /Sy exch def 2 div /Sx exch def
96 %
97 %%% MV 10-09-99 00:36
98 /sc?currentpoint where {pop sc?currentpoint} {currentpoint} ifelse
99 % currentpoint
100 Voffset sub Sy add exch
101 Hoffset sub Sx add
102 Transform
103 Sx neg Sy neg moveto
104 Char end tx@TextPathSavedShow
105 tx@TextPathDict begin
106 grestore
107 Sx 2 mul Sy 2 mul rmoveto
108 } def
109 %
110 /warp {
111 1 index
112 1.4 mul
113 cos 2 add
114 mul
115 } def
116 /warpmove{
117 2 index {
118 newpath
119 } if
120 warp moveto
121 pop false
122 } def
123 /warpline { warp lineto } def
124 /warpcurve {
125 6 2 roll warp
126 6 2 roll warp
127 6 2 roll warp
128 curveto
129 } def
130 /warpit {
131 true
132 { warpmove } { warpline } { warpcurve } { closepath } pathforall
133 pop
134 } def
135 %
136 /circle {
137 exch neg
138 % .5 mul
139 90 add
140 dup cos 2 index mul
141 3 1 roll
142 sin mul
143 } bind def
144
145 /circmove{
146 2 index { newpath } if
147 circle moveto
148 pop false
149 } bind def
150
151 /circline { circle lineto } bind def
152
153 /circcurve {
154 6 2 roll circle
155 6 2 roll circle
156 6 2 roll circle
157 curveto
158 } bind def
159
160 /circit { true { circmove } { circline } { circcurve } { closepath } pathforall pop } bind def
161 %
162 end
163 % END pst-text.pro