summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/bookhands/rusttitle.mf
blob: bd19f4afd4af01701cb35af0e8b6b2a1f4967aec (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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
%%
%% This is file `rusttitle.mf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rustic.dtx  (with options: `mfd')
%% 
%%  Copyright 1999 Peter R. Wilson
%% 
%%  This program is provided under the terms of the
%%  LaTeX Project Public License distributed from CTAN
%%  archives in directory macros/latex/base/lppl.txt.
%% 
%% Author: Peter Wilson (CUA)
%%         now at: peter.r.wilson@boeing.com
%% 
def makebox(text rule) =
  for y=0,half_height,cap_height,body_height,x_height,-desc_depth,-body_depth:
    rule((l,y)t_,(r,y)t_); endfor  % horizontals
  for x=l,r: rule((x,-body_depth)t_,(x,body_height)t_); endfor % verticals
  for x=u*(1+floor(1/u)) step u until r-1:
    rule((x,-body_depth)t_,(x,body_height)t_); endfor         % more verticals
  if charic<>0:
    rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); fi  % italic correction
enddef;


def proofpcbb(suffix $)(expr xoff, yoff) =
if proofing > 0:
  x$bl = x$ - xoff; y$bl = y$ - yoff;         % Bottom Left Hand Corner
  z$br = (x$bl+side, y$bl);                   % BRHC
  z$tr = (x$bl+side, y$bl+side);              % TRHC
  z$tl = (x$bl, y$bl+side);                   % TLHC
  z$bc = 1/2[z$bl,z$br]; z$tc = 1/2[z$tl,z$tr];  % horizontal mid points
  pair hc, vc;
  hc = (2u,0); vc = (0,2u);
  pickup pensquare scaled 2;
  for s = z$bl, z$br, z$tr, z$tl, z$bc, z$tc:
    draw s-hc--s+hc;
    draw s-vc--s+vc;
  endfor
fi
enddef;


def rustic_font_setup=
  define_pixels(side,half_height,carol_height,comma_width);
  define_pixels(u,dot_size,letter_size,cap_height,width_adj,serif_fit,
                cap_serif_fit,jut,cap_jut);
  define_pixels(hookjut,footjut,stem_offset,extra_fhjut,fig_width);
  define_whole_pixels(letter_fit);
  define_whole_vertical_pixels(body_height,asc_height,cap_height,x_height,
                               desc_depth,body_depth,fig_height);
  define_corrected_pixels(o);
  define_blacker_pixels(thick,thin);
  let adjust_fit = normal_adjust_fit;
  pickup pencircle scaled thin;
  stylus:=savepen;
  pickup pencircle xscaled thick yscaled thin rotated pangle;
  quill:=savepen;
  pickup pencircle xscaled thick yscaled thin rotated ((1/2(pangle+90)));
  bowpen:=savepen;
  numeric pcshiftx#; % x value of LHS of box wrt origin of char box
  define_pixels(pcshiftx);
  numeric sqxside#;   % x size of the square
  numeric sqyside#;   % y size of the square
  define_pixels(sqxside,sqyside);

enddef; % end of rustic_font_setup

boolean ductus;
ductus:=false;
pair pdir; pdir=dir(pangle);
pair ppdir; ppdir=dir(pangle+90);

def draw_rusticstem(suffix $, $$)=
  numeric alpha, beta; alpha:=0.5thick;
  beta:=60;      % the ending angle
  pair rustic[];
  xpart rustic1=x$$; ypart rustic1=y$$+alpha*sind(beta);
  z$a=1/2[z$,rustic1];
  z$b=2/3[z$,rustic1];
  z$c=5/6[z$,rustic1];
  z$d=rustic1;
  z$ar=z$a shifted (alpha*up); z$al=z$a shifted (alpha*down);

  rustic2:=z$b shifted (alpha*right);
  z$br=rustic2 rotatedaround(z$b,1/4[90,beta]); z$bl=z$br rotatedaround(z$b,180);

  rustic2:=z$c shifted (alpha*right);
  z$cr=rustic2 rotatedaround(z$c,1/2[90,beta]); z$cl=z$cr rotatedaround(z$c,180);

  rustic2:=z$d shifted (alpha*right);
%%  z$dr=rustic2 rotatedaround(z$d,60); z$dl=z$dr rotatedaround(z$d,180);
  rustic3=rustic2 rotatedaround(z$d,beta);
  x$dr=xpart rustic3; y$dr=ypart rustic3 - thin;
  z$dl=z$dr rotatedaround(z$d,180);
  pen oldpen; oldpen:=currentpen;
  pickup stylus;
  draw z$--z$al;
%%  filldraw z$ar..z$br..z$cr..z$dr--z$dl..z$cl..z$bl..z$al--cycle;
  filldraw z$ar..z$br..z$cr..z$dr--z$dl..z$bl..z$al--cycle;
  pickup oldpen;
%%  labels($a,$al,$ar,$b,$bl,$br,$c,$cl,$cr,$dl,$dr);
  labels($a,$b,$c,$d,$dl,$dr);
enddef; % end of draw_rusticstem


def draw_hserif(suffix $, $$)(expr fr)=
  pen oldpen; oldpen:=currentpen;
  numeric beta, ajut, bjut;
  beta=1-fr;
  ajut=fr*jut; bjut=beta*jut;
  pair rustic;
  numeric tn, ang; ang:=70;
  tn:=(sind ang)/(cosd ang);
  x$g=x$-hookjut; y$g=y$-(hookjut*tn); % the tip
  x$f=x$; y$f=y$g;                     % on the stem
  pickup stylus;
%%  filldraw z$g{dir(ang)}..{down}z$f--z$--cycle;
  draw z$g--z$;
  pickup oldpen;
  labels($f,$g);
enddef; % end of draw_hserif


def draw_footstem(suffix $, $$)=
  draw_rusticstem($, $$);
  x$$fl=x$dl; bot y$$fl= y$$;
  x$$fr=x$$fl+2footjut; y$$fr=y$$fl;
  draw_squiggle($$fl,$$fr,wiggle,srad);
  labels($$fl,$$fr);
enddef; % end of draw_footstem


def draw_foot(suffix $)=
  x$fl=x$-footjut; bot y$fl= y$;
  x$fr-x$=x$-x$fl; y$fr=y$fl;
  draw_squiggle($fl,$fr,wiggle,srad);
  labels($fl,$fr);
enddef; % end of draw_foot


def draw_head(suffix $)=
  x$hl=x$-footjut; top y$hl= y$;
  x$hr-x$=x$-x$hl; y$hr=y$hl;
  draw_squiggle($hl,$hr,wiggle,srad);
  labels($hl,$hr);
enddef; % end of draw_head


def draw_bow(suffix $, $$)(expr fr)=
  pen oldpen; oldpen:=currentpen;
  z$bm=1/2[z$,z$$];
  l:=length(z$-z$$);
  bdir:=angle(z$-z$$);
%%  z$bo=z$bm shifted (fr*l*dir(bdir+90));
  z$bo=z$bm shifted (fr*l*dir(bdir-90));
  pickup bowpen;
  draw z$..z$bo..z$$;
  pickup oldpen;
  labels($bm,$bo);
enddef;  % end of draw_bow


def draw_squiggle(suffix $, $$)(expr w, fr)=
  z$si=1/4[z$,z$$];  z$sii=3/4[z$,z$$];
  l:=length(z$-z$$);
  bdir:=angle(z$-z$$);
%%  z$sio=z$si shifted (w*l*dir(bdir+90));
%%  z$siio=z$sii shifted (w*l*dir(bdir-90));
  z$sio=z$si shifted (w*l*dir(bdir-90));
  z$siio=z$sii shifted (w*l*dir(bdir+90));
  draw z$..z$sio..z$siio..z$$;    % the squiggle
%%  draw_serif($,$$,fr);
%%  draw_serif($$,$,fr);
  labels($sio,$siio);
enddef;  % end of draw_squiggle


def draw_serif(suffix $, $$)(expr fr)=
  numeric beta, ajut, bjut;
  beta=1-fr;
  ajut=fr*jut; bjut=beta*jut;
  pair vec[]; vec1=unitvector(z$$-z$);
  vec2=ajut*vec1;
  z$a=z$ shifted vec2;
  z$b=z$a rotatedaround (z$,-90);
  boolean top_serif;
  if y$>y$$:
    top_serif := true;
    z$c=z$b shifted (-bjut*pdir);
  else:
    if y$=y$$:
      if x$<x$$:
        top_serif := true;
        z$c=z$b shifted (-bjut*pdir);
      else:
        top_serif := false;
        z$c=z$b shifted (bjut*pdir);
      fi
    else:
      top_serif:=false;
      z$c=z$b shifted (bjut*pdir);
    fi
  fi
  if top_serif:
    draw z$c--z$b{pdir}..{z$$-z$}z$a;    % the serif
  else:
    draw z$c--z$b{-pdir}..{z$$-z$}z$a;
  fi
  labels($a,$b,$c);
enddef; % end of draw_serif


def draw_istem(suffix $, $$)(expr fr)=
  draw_serif($, $$, fr);  % top serif
  draw_serif($$, $, fr);  % bottom serif
  draw z$a--z$$a;  % the stem
enddef; % end of draw_istem


def draw_tlserif(suffix $, $$)(expr fr)=
  draw_serif($, $$, fr);  % the serif
  draw z$a--z$$;                       % the stem
enddef; % end of draw_tlserif


def draw_pdot(suffix $)(expr sz)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$ shifted (0.5sz*up);
  z$u = z$s shifted (sz*right);
  z$v = z$t shifted (sz*down);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_pdot


def draw_pcomma(suffix $)(expr sz, ar)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$s shifted (sz*right);
  x$v=x$s-ar; y$v=y$s-ar;
  z$u = z$v shifted (sz*right);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_pcomma


def draw_plq(suffix $)(expr sz, ar)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$s shifted (sz*right);
  x$v=x$s+ar; y$v=y$s-ar;
  z$u = z$v shifted (sz*right);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_plq


font_coding_scheme:="ASCII minuscules and punctuation";
mode_setup;
rustic_font_setup;


input rustl;        % normal letters
input rustu;        % capital letters
input rustdig;      % arabic digits
input rustpunct;    % punctuation
input rustlig;      % the several dashes
%%%%input rustp;        % ampersand and ?mark


font_slant slant; font_x_height x_height#;
if monospace: font_normal_space 9u#; % no stretching or shrinking
 font_quad 18u#;
 font_extra_space 9u#;
else: font_normal_space 6u#+2letter_fit#;
 font_normal_stretch 3u#; font_normal_shrink 2u#;
 font_quad 18u#+4letter_fit#;
 font_extra_space 2u#;
 k#:=-.5u#; kk#:=-1.5u#; kkk#:=-2u#; % three degrees of kerning
%% ligtable "P": "T": "Y": "A" kern kk#;
%% ligtable "F": "V": "W": "A" kern if serifs: kkk# else: kk#fi,
%%  "K": "X": "O" kern k#, "C" kern k#, "G" kern k#, "Q" kern k#;
%% ligtable "O": "D": "X" kern k#, "W" kern k#, "A" kern k#,
%%   "V" kern k#, "Y" kern k#;
%% ligtable "A": if serifs: "R": fi
%%  "C" kern k#, "O" kern k#, "G" kern k#, "U" kern k#, "Q" kern k#,
%%  "L": "T" kern kk#, "Y" kern kkk#, "V" kern kk#, "W" kern kkk#;
%%ligtable "I": "I" kern -k#; % Richard III
fi

bye.