| 1 |
% mathematical symbols by Anthony Phan. |
| 2 |
% file: mathadrv.mf (driver file for matha serie, |
| 3 |
% U stands for Unsupported) |
| 4 |
% last modification: May 16, 2005. |
| 5 |
|
| 6 |
mode_setup; |
| 7 |
math_setup; |
| 8 |
% |
| 9 |
% This file calls calu.mf and then extends |
| 10 |
% the superb work of N. N. Billawala into |
| 11 |
% a whole OT1 font. |
| 12 |
% |
| 13 |
|
| 14 |
% |
| 15 |
% First thing to do is to copy Computer Modern's |
| 16 |
% control sequences and setup. |
| 17 |
% |
| 18 |
%slant := 0; |
| 19 |
newinternal l, r, shrink_fit; % adjustments to spacing |
| 20 |
boolean math_fitting; |
| 21 |
|
| 22 |
flare := dtsz; |
| 23 |
flare# := dtsz#; |
| 24 |
|
| 25 |
def cal_setup = |
| 26 |
let adjust_fit = normal_adjust_fit; |
| 27 |
pickup pencircle xscaled cap_curve yscaled cap_hair rotated 30; |
| 28 |
cal.nib := savepen; |
| 29 |
pair cal.extension; cal.extension := (.75cap_curve, 0) rotated 30; |
| 30 |
pickup pencircle xscaled cap_curve yscaled cap_hair rotated 70; |
| 31 |
tilted.nib := savepen; |
| 32 |
pickup pencircle xscaled curve yscaled cap_hair rotated 70; |
| 33 |
med_tilted.nib := savepen; |
| 34 |
pickup pencircle xscaled cap_stem yscaled cap_hair rotated 30; |
| 35 |
med_cal.nib := savepen; |
| 36 |
pickup pencircle xscaled stem yscaled cap_hair rotated 30; |
| 37 |
light_cal.nib := savepen; |
| 38 |
% |
| 39 |
% lowercase and punctuation |
| 40 |
% |
| 41 |
pickup pencircle xscaled curve yscaled hair rotated 30; |
| 42 |
lower_cal.nib := savepen; |
| 43 |
lower_cal_width# := curve#*cosd 30+hair#*sind 30; |
| 44 |
pickup pencircle xscaled 0.5[hair, curve] yscaled hair rotated 30; |
| 45 |
fine_cal.nib := savepen; |
| 46 |
% |
| 47 |
pickup pencircle xscaled(cap_curve+dw) yscaled cap_hair rotated 30; |
| 48 |
heavy_cal.nib := savepen; |
| 49 |
bot_flourish_line := -0.5u-o; |
| 50 |
pair bend; bend = (.5u, 0); |
| 51 |
pair flourish_change; flourish_change = (4u, .2asc_height); |
| 52 |
join_radius := u; |
| 53 |
shrink_fit := 1+hround(2letter_fit#*hppp)-2letter_fit; |
| 54 |
enddef; |
| 55 |
|
| 56 |
let cmchar = \; |
| 57 |
def .... = .. tension atleast .9 .. enddef; |
| 58 |
vardef w# = charwd enddef; |
| 59 |
vardef d# = chardp enddef; |
| 60 |
vardef h# = charht enddef; |
| 61 |
vardef ic# = charic enddef; |
| 62 |
|
| 63 |
def do_expansion(expr expansion_factor) = |
| 64 |
forsuffixes $ = u, jut, cap_jut, beak_jut, apex_corr: |
| 65 |
$ := $.#*expansion_factor*hppp; endfor |
| 66 |
enddef; |
| 67 |
|
| 68 |
def normal_adjust_fit(expr left_adjustment, right_adjustment) = |
| 69 |
numeric charwd_in; charwd_in = charwd; |
| 70 |
l := -hround(left_adjustment*hppp)-letter_fit; |
| 71 |
interim xoffset := -l; |
| 72 |
charwd := charwd+2letter_fit#+left_adjustment+right_adjustment; |
| 73 |
r := l+hround(charwd*hppp)-shrink_fit; |
| 74 |
w := r-hround(right_adjustment*hppp)-letter_fit; |
| 75 |
do_expansion(w/(charwd_in*hppp)); |
| 76 |
enddef; |
| 77 |
|
| 78 |
def mono_adjust_fit(expr left_adjustment, right_adjustment) = |
| 79 |
numeric charwd_in; charwd_in = charwd; |
| 80 |
numeric expansion_factor; |
| 81 |
mono_charwd# = 2letter_fit# |
| 82 |
+expansion_factor*(charwd+left_adjustment+right_adjustment); |
| 83 |
l := -hround(left_adjustment*expansion_factor*hppp)-letter_fit; |
| 84 |
interim xoffset := -l; |
| 85 |
r := l+mono_charwd-shrink_fit; |
| 86 |
w := r-hround(right_adjustment*expansion_factor*hppp)-letter_fit; |
| 87 |
charwd := mono_charwd#; charic := mono_charic#; |
| 88 |
do_expansion(w/(charwd_in*hppp)); |
| 89 |
enddef; |
| 90 |
|
| 91 |
extra_endchar := extra_endchar&"r := r+shrink_fit; w := r-l;"; |
| 92 |
|
| 93 |
def ignore_math_fit(expr left_adjustment, right_adjustment) = enddef; |
| 94 |
|
| 95 |
def do_math_fit(expr left_adjustment, right_adjustment) = |
| 96 |
l := l-hround(left_adjustment*hppp); interim xoffset := -l; |
| 97 |
charwd := charwd+left_adjustment+right_adjustment; |
| 98 |
r := l+hround(charwd*hppp)-shrink_fit; |
| 99 |
charic := charic-right_adjustment; |
| 100 |
if charic<0: charic := 0; fi |
| 101 |
enddef; |
| 102 |
|
| 103 |
currenttransform := identity slanted slant |
| 104 |
yscaled aspect_ratio scaled granularity; |
| 105 |
def t_ = transformed currenttransform enddef; |
| 106 |
|
| 107 |
cal_setup; |
| 108 |
autorounding := hair; |
| 109 |
|
| 110 |
% |
| 111 |
% UPPERCASE |
| 112 |
% |
| 113 |
|
| 114 |
let math_fit = do_math_fit; |
| 115 |
math_fitting := true; |
| 116 |
input calu.mf; |
| 117 |
|
| 118 |
% |
| 119 |
% OTHER CASES |
| 120 |
% |
| 121 |
|
| 122 |
let math_fit = ignore_math_fit; |
| 123 |
math_fitting := false; |
| 124 |
|
| 125 |
vardef hook_in(suffix $, $$, $$$) = |
| 126 |
x$ := good.x x$; |
| 127 |
x$$ = max(x$$$-1.25u, 0.5[x$, x$$$]); |
| 128 |
top y$$ = x_height+oo; y$ = good.y 7/8[0, y$$]; |
| 129 |
y$$$ = 3/4x_height; |
| 130 |
z$...z$$ right_to_down z$$$ |
| 131 |
enddef; |
| 132 |
|
| 133 |
vardef hook_out(suffix $, $$, $$$) = |
| 134 |
x$$$ := good.x x$$$; |
| 135 |
x$$ = min(x$+1.25u, 0.5[x$, x$$$]); |
| 136 |
bot y$$ = -oo; y$ = 1/4x_height; y$$$ = good.y 7/8[x_height, y$$]; |
| 137 |
z$ down_to_right z$$...z$$$ % super_arc |
| 138 |
enddef; |
| 139 |
|
| 140 |
vardef ital_arch(suffix $, $$, $$$) = |
| 141 |
x$$ = 0.6[x$, x$$$]; |
| 142 |
top y$$ = x_height+oo; y$$$ = 0.65x_height; |
| 143 |
z${up}...z$$ right_to_down z$$$ % super_arc |
| 144 |
enddef; |
| 145 |
|
| 146 |
vardef desc_curve(suffix $, $$, $$$) = |
| 147 |
x$$$ := good.x x$$$; x$$ = 0.6[x$, x$$$]; |
| 148 |
y$ = 0; bot y$$ = -d-oo; y$$$ = good.y 1/3[y$$, y$]; |
| 149 |
z${down}...z$$ left_to_up z$$$...z$$$+round(1.1u*dir 60) |
| 150 |
enddef; |
| 151 |
|
| 152 |
vardef cal_dot@#(expr $, $$, dotsize) = |
| 153 |
rt x@#a-lft x@#c = top y@#b-bot y@#d = dotsize+2eps; |
| 154 |
rt x@#a = hround($+0.5dotsize)+eps; |
| 155 |
top y@#b = vround($$+0.5dotsize)+eps; |
| 156 |
y@#a = y@#c = 0.5[y@#b, y@#d]; |
| 157 |
x@#b = x@#d = 0.5[x@#c, x@#a]; |
| 158 |
filldraw superellipse(z@#a, z@#b, z@#c, z@#d, superness); |
| 159 |
labels(@#a, @#b, @#c, @#d); |
| 160 |
enddef; |
| 161 |
|
| 162 |
comma_depth# := 0.75desc_depth#; |
| 163 |
comma_depth := vround 0.75desc_depth; |
| 164 |
|
| 165 |
vardef cal_comma@#(expr $, $$, deviation, prof) = |
| 166 |
pickup fine_cal.nib; |
| 167 |
cal_dot@#($, $$, dtsz); |
| 168 |
if $$>prof: bot else: top fi y@#f = prof; |
| 169 |
y@#e = 0.25[$$, y@#f]; |
| 170 |
if deviation>0: |
| 171 |
x@#f = x@#c; rt x@#e = hround($+dtsz)+eps; |
| 172 |
draw if $$>prof: z@#b else: z@#d fi right_to_down z@#e |
| 173 |
...{x@#f-x@#e, (1-superness)*(y@#f-y@#e)}z@#f; |
| 174 |
else: |
| 175 |
x@#f = x@#a; lft x@#e = hround($-dtsz)-eps; |
| 176 |
draw if $$<prof: z@#d else: z@#b fi right_to_up z@#e |
| 177 |
...{x@#f-x@#e, (1-superness)*(y@#f-y@#e)}z@#f; |
| 178 |
fi |
| 179 |
labels(@#e, @#f); |
| 180 |
enddef; |
| 181 |
|
| 182 |
% |
| 183 |
% LOWERCASE, DIGITS, PUNCTUATION |
| 184 |
% |
| 185 |
|
| 186 |
input mathcall; |
| 187 |
|
| 188 |
% |
| 189 |
% GREEK |
| 190 |
% |
| 191 |
|
| 192 |
input mathcallgreek; |
| 193 |
|
| 194 |
currenttransform := identity |
| 195 |
yscaled aspect_ratio scaled granularity; |
| 196 |
autorounding := 0; |
| 197 |
extra_endchar := ""; |
| 198 |
standard_proofing; |
| 199 |
|
| 200 |
extra_endchar := extra_endchar & "; charcode := charcode+code_offset;"; |
| 201 |
dagesh := false; code_offset := 128; |
| 202 |
|
| 203 |
% |
| 204 |
% HEBREW |
| 205 |
% |
| 206 |
|
| 207 |
input mathhbrw; |
| 208 |
|
| 209 |
dagesh := true; code_offset := 160; |
| 210 |
|
| 211 |
% |
| 212 |
% HEBREAW WITH DAGESH |
| 213 |
% |
| 214 |
|
| 215 |
input mathhbrw; |
| 216 |
|
| 217 |
code_offset := 0; |
| 218 |
|
| 219 |
% parameters for TFM files. |
| 220 |
|
| 221 |
font_slant = 0; |
| 222 |
font_x_height = x_height#; |
| 223 |
font_normal_stretch = 3u#; |
| 224 |
font_normal_shrink = 2u#; |
| 225 |
font_quad = 18u#+4letter_fit#; |
| 226 |
font_extra_space = 2u#; |
| 227 |
font_normal_space = 6u#+2letter_fit#; |
| 228 |
|
| 229 |
end. |