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

/circmove{
    2 index { newpath } if
    circle moveto
    pop false
} bind def

/circline { circle lineto } bind def

/circcurve {
    6 2 roll circle
    6 2 roll circle
    6 2 roll circle
    curveto
} bind def

/circit { true { circmove } { circline } { circcurve } { closepath } pathforall pop } bind def
%
end
% END pst-text.pro