summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/bangtex/bangmac.mf
blob: 684ca8d6b1697421496622557a53280219c51b5e (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bangmac.mf: METAFONT file that defines various macros
%              for use in bangla fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  This file is part of the package BANGTEX, containing Bangla fonts
%%  and style files for the TeX/LaTeX typesetting systems
%%
%%  Copyright (C) 2001, 2002 Palash Baran Pal 
%%  e-mail: pbpal@theory.saha.ernet.in internet:
%%  internet: http://tnp.saha.ernet.in/~pbpal
%%  Address: Saha Institute of Nuclear Physics
%%	     1/AF Bidhan Nagar
%%	     Calcutta 700064, INDIA
%%
%%  Original release: January 2001
%%  Latest modification released: January 2002
%%
%%  This program is free software; you can redistribute it and/or modify
%%  it under the terms of the GNU General Public License as published by
%%  the Free Software Foundation; either version 2 of the License, or
%%  (at your option) any later version.
%%
%%  This program is distributed in the hope that it will be useful,
%%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%  GNU General Public License for more details.
%%
%%  You should have received a copy of the GNU General Public License
%%  along with this program; if not, write to the Free Software
%%  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
%%  02111-1307 USA
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



def matra(expr wa,wb) =
  begingroup
    save x,y,lslope,rslope;
    lslope =  matra_slope;
    rslope =  matra_slope;
    z1'r = (wa,matra_f*h);
    z2'r = (wb,matra_f*h);
    if wa>0: x1'r := x1'r - 0.5*stem_width; lslope := 90;
      x12=x1'r + stem_width;
      y12 = matra_h*h + .5matra_t*h/sind(lslope);
      x13=x1'r;
      y13=y12;
      x11=x1'r;
      y11 = y12 + stem_width/sind(lslope);
      fill z13--z11--z12--cycle;
    fi
    if wb<w: x2' := x2' + 0.5*stem_width; rslope := 90;    fi
    penpos1'(matra_t*h/sind(lslope),lslope);
    penpos2'(matra_t*h/sind(rslope),rslope);
    penstroke z1'e--z2'e;
    penlabels(11,12,13);
  endgroup
enddef;


def stem(expr xstem) =
  begingroup
    save x,y; 
    z1' = (xstem,matra_f*h);
    penpos1'(stem_width,0);
    x2'r = x1'r; y2'r = 0;
    x2'l = x1'l; y2'l = y2'r + stem_width * sind(stem_slope);
    penstroke z1'e--z2'e;
    penlabels(1',2');
  endgroup
enddef;


def halfstem(expr xstem,a,b) =
  begingroup
    save x,y;
    z1 = (xstem,a);
    penpos1(stem_width,0);
    x2r = x1r; y2r = b; 
    x2l = x1l; y2l = b + stem_width * sind(stem_slope);
    fill z1l--z2l--z2r--z1r--cycle;
  endgroup
enddef;


def cwbar(expr za,zb,zc,th) =
  begingroup
    save x,y,phiab,phibc,width,lab,lcd;
    phiab = angle(za-zb);
    phibc = angle(zb-zc);
    lab =  length(za-zb);
    width = lab * sind(abs(phibc - phiab));
    lcd = width / sind(abs(th - phibc));
    z4' = zc + dir(th) * lcd;
    z1l = za; z1r = zb; z2l = z4'; z2r = zc;
    penstroke z1e--z2e;
  endgroup
enddef;


%% Macro for a hook hanging from two points, with a curvature at the
%% middle. The two upper points are za and zb. 
def hookjt(expr za,zb,zc,lift,thinness,thf) =
  begingroup
    save x,y,lab,lcd,thab,thcd,lmid,thmid,dist;
    dist = 0.8;
    z4 = zc + thinness*length(za-zb) * dir(thf);
    z11' = .5[za,zb]; z12' = .5[zc,z4];
    lab = length(za-zb); lcd = length(zc-z4);
    thab = angle(zb-za); thcd = angle(z4-zc);
    lmid = (1-dist)*lab + dist*lcd;
    thmid = (1-dist)*thab + dist*thcd;
    penpos11'(lab,thab); penpos12'(lcd,thcd);
    z13'l = dist[za,zc] + (0,dist*lift);
    penpos13'(lmid,thmid);
    penstroke z11'e..z13'e..z12'e;
    penlabels(11',12',13');
  endgroup
enddef;

%%%%%%%%%%%%%%%%%%%%%%%%%
%% macro for a hook with a stem attached to it.

def hookstem(expr za,zb,zc,phia,phib) =
  begingroup
    save x,y;
    z1r = za;
    z1l = zb;
    zc = z3; penpos3(stem_width,0);
    z2l = (x3,.5stem_width*sind(stem_slope));
    z2r = (x3+.5stem_width,0);
    path hs_pl; hs_pl = z1l{dir phia}..tension1.2..{down}z2l;
    path hs_pr; hs_pr = z2r{up}..tension1.2..{dir (180+phib)}z1r;
    fill hs_pl--hs_pr--cycle;
    z4r = z2r;
    z4l = hs_pl intersectionpoint (z3l--(x3l,0));
    penstroke z3e--z4e;
    penlabels(1,2,3,4);
  endgroup
enddef;


%%%%%%%%%%%%%%%%%%%%%%%%%
%  macro for a ball with a hook attached to it. The ball is centered at
%  za, with radius rad. The points zb and zc are the two end points of
%  the hook. The angle `th' is the angular co-ordinate of the point on
%  the circumference of the circle where the hook attaches to the
%  circle.

def hookcirc(expr za,zb,zc,rad,th) =
  begingroup
    save x,y,phi,psi,chdir,thickness;
    z1 = za;
    fill fullcircle scaled rad shifted (z1);
    thickness = length(zb-zc);
    z5 = z1 + .5rad * dir(th);
    z4 = z5 - thickness * dir(th);
    z2=zb; z3=zc;
    chdir:=1;
    if angle(z5-z1)>angle(z2-z1): chdir:=-1; fi
    phi =  th + chdir*90;
    if phi>0: psi=phi-180; else: psi=phi+180; fi
    fill z2--z3..{dir psi}z4--z5{dir phi}..cycle;
  endgroup
enddef;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macro for the Tiki to be used for the letters "Ta", hraswa i and u
%% etc. xa is the x-coordinate of the right end of the Tiki and xb is
%% the same for the left end. 

def Tiki(expr xa,xb) =
  begingroup
    save x,y;
    bot z1 = (xa,matra_f*h);
    z2 = (xb,h);
    z1'= (.5[x1,x2],.5[y1,y2]);
    pickup pencircle xscaled .7pt yscaled .3pt rotated 90;
    Tiki_pen := savepen;
    draw z1{up}..{left}z1'{left}..{dir 60}z2;
    penlabels(1,2);
  endgroup
enddef;


def baTi(expr za,zb,zc,zd) =
  begingroup
    save x,y,lab,phi;
    z1 = za; z2 = zb; z3 = zc; z4 = zd;
    lab = length(z1-z2);
    phi = 100;
    x3' = x3; y3'-y3 = min(2.3*lab,.3[y2,y3]);
    z4' = z4 + .4*lab * dir (phi-120);
    fill z2{down}..{left}z3{left}..{dir 100}z4--z4'{dir (phi-180)}..{right}z3'{right}..{up}z1--cycle;
    penlabels(1,2,3,4);
  endgroup
enddef;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This is the golla to be used for bisarga, anuswar etc.

def golla(expr za,balld) =
  begingroup
    save x,y;
    z1r = za + .5balld * dir (45);
    z2r = za + .5balld * dir (135);
    z3r = za + .5balld * dir (-135);
    z4r = za + .5balld * dir (-45);
    penpos1(.15balld,45);
    penpos2(.25balld,135);
    penpos3(.15balld,-135);
    penpos4(.25balld,-45);
    penstroke z1e..z2e..z3e..z4e..cycle;
  endgroup
enddef;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The base of E, also used as ra-fala

def Ebase(expr za,zb,t) =
  begingroup
    save x,y,w,h;
    numeric w,h;
    w=abs(xpart(za) - xpart(zb)); h=abs(ypart(za) - ypart(zb));
    x1 = xpart(za); y1l= ypart(za); penpos1(t,90);
    z2l = z1 + (-.3w,.13h); penpos2(1.4t,90);
    y3 = y2; x3 = x2 -.4w; penpos3(1.4t,90);
    z4l = zb; penpos4(t/3,-40);
    penstroke z1e..{left}z2e{left}..z3e;%..z4e;
    fill z3l{left}..z4l--z4l--z4l..{right}z3r--cycle;
    penlabels(1,2,3,4);
  endgroup
enddef;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The shape at the right of ina, Sh+N etc.
%% The starting point is za, the x-distance between za and the
%% highest/lowest point is w, the total height is 2h, and t is the
%% thickness of the lines.

def clover(expr za,w,h,t) =
  begingroup
    save x,y,currenttransform;
    transform currenttransform;
    currenttransform := identity shifted za slanted slantval;
    numeric theta,balld; theta = 60; balld = .7w-.7t;
    z1 = (0,0); penpos1(0,-90);
    z2r = (x1+.5w,y1-h); penpos2(t,-90);
    z3r = (w,y1-.5h); penpos3(.7t,0);
    z4l = (x2,y1); penpos4(.5balld,theta);
    fill fullcircle scaled (balld) shifted z4l;
    penstroke z1e..z2e..{up}z3e{up}..{dir (theta+90)}z4e;
    z4'l = z4l; penpos4'(.5balld,-theta);
    x3' = x3; y3' - y4l = y4l - y3; penpos3'(.7t,0);
    x2' = x2; y2' -y4l = y4l - y2; penpos2'(t,90);
    penstroke z1e..z2'e..{down}z3'e{down}..{dir (-theta-90)}z4'e;
    penlabels(1,2,2',3,3',4,4');
  endgroup
enddef;



%% End of file bangmac.mf