| 1 |
% The base file for Boisik font |
| 2 |
% Based on cmbase.mf |
| 3 |
|
| 4 |
bskbase:=1; % when |bskbase| is known, this file has been input |
| 5 |
|
| 6 |
let bskchar=\; % `|bskchar|' should precede each character |
| 7 |
let generate=input; % `|generate|' should follow the parameters |
| 8 |
|
| 9 |
autorounding:=0; smoothing:=0; % we do our own rounding |
| 10 |
def autorounded = interim autorounding:=2 enddef; |
| 11 |
|
| 12 |
newinternal slant,fudge,math_spread,superness,superpull,beak_darkness,ligs; |
| 13 |
boolean square_dots,hefty,serifs, medieval, monofig, bulbes, |
| 14 |
monospace,variant_g,low_asterisk,math_fitting, testdpi, boldmath; |
| 15 |
|
| 16 |
boldmath:=false; |
| 17 |
|
| 18 |
boolean dark,dark.dark,skewed,skewed.skewed; % for fast option testing |
| 19 |
dark=skewed=false; dark.dark=skewed.skewed=true; |
| 20 |
|
| 21 |
def infill text t:= cullit; path _p; _p:=t; erase fill _p; draw _p; |
| 22 |
enddef; |
| 23 |
|
| 24 |
def dinfill text t:= erase draw t; |
| 25 |
enddef; |
| 26 |
|
| 27 |
let bskboundary=relax; |
| 28 |
|
| 29 |
vardef Vround primary y = y_:=vround y; |
| 30 |
if y_<min_Vround: min_Vround else: y_ fi enddef; |
| 31 |
newinternal y_,min_Vround; |
| 32 |
|
| 33 |
vardef diag_ratio(expr a,b,y,c) = % assuming that $a>\vert b/y\vert$, |
| 34 |
% compute the value $\alpha=(x\6{++}y)/y$ such that $ax+b\alpha=c$ |
| 35 |
numeric aa_,bb_,cc_; bb_=b/y; cc_=c/y; aa_=a*a-bb_*bb_; |
| 36 |
(a*(cc_++sqrt aa_)-bb_*cc_)/aa_ enddef; |
| 37 |
|
| 38 |
def compute_spread(expr normal_spread,big_spread)= |
| 39 |
spread#:=math_spread[normal_spread,big_spread]; |
| 40 |
spread:=2ceiling(spread#*hppp/2)+eps; enddef; |
| 41 |
|
| 42 |
def v_center(expr h_sharp) = |
| 43 |
.5h_sharp+math_axis#, .5h_sharp-math_axis# enddef; |
| 44 |
|
| 45 |
def beginarithchar(expr c) = % ensure consistent dimensions for $+$, $-$, etc. |
| 46 |
if monospace: beginchar(c,9.5u#,27/7u#+math_axis#,27/7u#-math_axis#); |
| 47 |
else: beginchar(c,13u#,5.5u#+math_axis#,5.5u#-math_axis#); fi |
| 48 |
italcorr math_axis#*slant-.5u#; |
| 49 |
adjust_fit(0,0); enddef; |
| 50 |
|
| 51 |
boolean test, test.alt, test.nodraw; test=false; test.alt=true; test.nodraw:=true; |
| 52 |
|
| 53 |
%%%%%%%%%%%Dots and commas |
| 54 |
def dot(suffix $):= |
| 55 |
filldraw if square_dots: ((.5,.25)..(-.5,.25)---(-.5,-.25)..(0,-.5)..(.5,-.25)---cycle) scaled dot_size |
| 56 |
else: fullcircle scaled dot_size |
| 57 |
fi shifted z$; |
| 58 |
labels($); |
| 59 |
enddef; |
| 60 |
|
| 61 |
def comma(suffix $)(expr dim, jut, depth):= |
| 62 |
{{ save p, oblu; path p[]; oblu:=.6dim; |
| 63 |
numeric jutting; |
| 64 |
jutting=if jut=infinity: hair else: jut fi; |
| 65 |
if square_dots: |
| 66 |
else: penpos$'(dim,0); penpos$''(dim,90); z$'=z$''=z$; |
| 67 |
z$'''=(x$'r+jutting,y$''l); z$~=.5[z$,z$'l]+depth*down; |
| 68 |
p0:=z$'r{up}..z$''r{left}..{down}z$'l..{right}z$''l..cycle; |
| 69 |
p1:=point 3.5 of p0{direction 3.5 of p0 rotated -120}..z$~; |
| 70 |
filldraw z$~..z$'''..subpath (1.5,rundy(p0,3.5).zpet) of p0.. |
| 71 |
subpath(rundy(p1,(0,.4dim)),infinity) of p1&cycle; |
| 72 |
labels($,$''',$~); penlabels($',$''); |
| 73 |
fi |
| 74 |
}} |
| 75 |
enddef; |
| 76 |
|
| 77 |
def ammoc(suffix $)(expr dim, jut, depth):= |
| 78 |
{{ save p, oblu; path p[]; oblu:=.6dim; |
| 79 |
numeric jutting; |
| 80 |
jutting=if jut=infinity: hair else: jut fi; |
| 81 |
if square_dots: |
| 82 |
else: penpos$'(dim,180); penpos$''(dim,270); z$'=z$''=z$; |
| 83 |
z$'''=(x$'r-jutting,y$''l); z$~=.5[z$,z$'l]+depth*up; |
| 84 |
p0:=z$'r{down}..z$''r{right}..{up}z$'l..{left}z$''l..cycle; |
| 85 |
p1:=point 3.5 of p0{direction 3.5 of p0 rotated -120}..z$~; |
| 86 |
filldraw z$~..z$'''..subpath (1.5,rundy(p0,3.5).zpet) of p0.. |
| 87 |
subpath(rundy(p1,(0,.4dim)),infinity) of p1&cycle; |
| 88 |
labels($,$''',$~); penlabels($',$''); |
| 89 |
fi |
| 90 |
}} |
| 91 |
enddef; |
| 92 |
|
| 93 |
def turn_comma(suffix $)(expr dim, jut, depth):= |
| 94 |
{{ save p, oblu; path p[]; oblu:=.6dim; |
| 95 |
numeric jutting; |
| 96 |
jutting=if jut=infinity: hair else: jut fi; |
| 97 |
if square_dots: |
| 98 |
else: penpos$'(dim,0); penpos$''(dim,90); z$'=z$''=z$; |
| 99 |
z$'''=(x$'r+jutting,y$''l); z$~=.5[z$,z$'l]+depth*down; |
| 100 |
p0:=z$'r{up}..z$''r{left}..{down}z$'l..{right}z$''l..cycle; |
| 101 |
p1:=point 3.5 of p0{direction 3.5 of p0 rotated -120}..z$~; |
| 102 |
filldraw (z$~..z$'''..subpath (1.5,rundy(p0,3.5).zpet) of p0.. |
| 103 |
subpath(rundy(p1,0),infinity) of p1 &cycle) |
| 104 |
reflectedabout((x$,0),(x$,h)); |
| 105 |
labels($,$''',$~); penlabels($',$''); |
| 106 |
fi |
| 107 |
}} |
| 108 |
enddef; |
| 109 |
|
| 110 |
%%%%%%%%%%%Serifs |
| 111 |
pair serif_bend, cap_serif_bend; |
| 112 |
|
| 113 |
def lowercase_points(suffix $,$$)(expr size)suffix modifier:= |
| 114 |
pos$(stem,0); pos$$(stem,0); x$=x$$; |
| 115 |
serif_bot($); drop_serif($$)(size).modifier; |
| 116 |
penlabels($,$$); |
| 117 |
enddef; |
| 118 |
|
| 119 |
vardef lowercase_stem_draw(suffix $,$$):= |
| 120 |
z$$r..{(x$a-x$r,-.25serif_drop)}z$$a&z$$a---obl($$b,$$a,$a)---z$a..z$b{left}..{right}z$c |
| 121 |
..z$+ser_boule*up.. |
| 122 |
z$d{right}..{left}z$e..{up}z$f |
| 123 |
enddef; |
| 124 |
|
| 125 |
vardef lowercase_stem_upper(suffix $,$$):= |
| 126 |
(reverse (z$$r..{(x$a-x$r,-.25serif_drop)}z$$a&z$$a---obl($$b,$$a,$a))) |
| 127 |
enddef; |
| 128 |
|
| 129 |
vardef lowercase_lower_u_serif(suffix $)(expr jut):= |
| 130 |
z$f{down}..{right}z$e..{left}z$d.. {z$b-z$f}.5[z$,z$l]+jut*down..z$l+jut*down--z$a |
| 131 |
enddef; |
| 132 |
|
| 133 |
vardef broken_stem_draw(suffix @,$,$$):= |
| 134 |
z@--z$$r+.2u*left..{(x$a-x$r,-.25serif_drop)}z$$a&z$$a---z$$b |
| 135 |
if known correct: if correct: +.75u*left.. else:-- fi else: +.75u*left.. fi |
| 136 |
z$$b+u*down---z$a if known correct: if correct:.. else: -- fi else: .. fi |
| 137 |
z$b{left}..z$c{right}..z$+ser_boule*up..{right}z$d..{left}z$e |
| 138 |
if known correct: if correct:..{up} else: -- fi else: ..{up} fi z$f |
| 139 |
enddef; |
| 140 |
|
| 141 |
def lowercase_stem(suffix $,$$)(expr size)suffix modifier:= |
| 142 |
lowercase_points($,$$,size).modifier; |
| 143 |
filldraw lowercase_stem_draw($,$$)---z$$r&cycle; |
| 144 |
enddef; |
| 145 |
|
| 146 |
def serif_bot(suffix $):= |
| 147 |
z$a=z$l+stem*up; z$b=z$c+(o,0) rotated 30; z$c=z$l+jut*left; |
| 148 |
z$d=z$r+jut*right; z$e=z$d+(-o,0) rotated -30; z$f=z$r+stem*up; |
| 149 |
labels($a,$b,$c,$d,$e,$f); |
| 150 |
enddef; |
| 151 |
|
| 152 |
def drop_serif(suffix $)(expr size)suffix modifier= |
| 153 |
z$a=z$l+size*left+if not test.modifier: .5\\fi serif_drop*down; |
| 154 |
z$b=(x$l,y$a-.25serif_drop); |
| 155 |
labels($a,$b); |
| 156 |
enddef; |
| 157 |
|
| 158 |
def serifs_tl(suffix $):= |
| 159 |
z$a=z$+jut*left; z$b=z$+.5ser_height*down; z$c=z$a+.707serif_o*down; |
| 160 |
labels($a,$b,$c) |
| 161 |
enddef; |
| 162 |
|
| 163 |
def serifs_tr(suffix $):= |
| 164 |
z$a=z$+jut*right; z$b=z$+.5ser_height*down; z$c=z$a+.707serif_o*down; |
| 165 |
labels($a,$b,$c) |
| 166 |
enddef; |
| 167 |
|
| 168 |
def serifs_bl(suffix $):= |
| 169 |
z$a=z$+jut*left; z$b=z$+.72ser_height*up; z$c=z$a+.707serif_o*up; |
| 170 |
labels($a,$b,$c) |
| 171 |
enddef; |
| 172 |
|
| 173 |
def serifs_br(suffix $):= |
| 174 |
z$a=z$+jut*right; z$b=z$+.72ser_height*up; z$c=z$a+.707serif_o*up; |
| 175 |
labels($a,$b,$c) |
| 176 |
enddef; |
| 177 |
|
| 178 |
def cap_serifs_tl(suffix $):= |
| 179 |
z$a=z$+cap_jut*left; z$b=z$+.7ser_height*down; z$c=z$a+serif_o*down; |
| 180 |
labels($a,$b,$c) |
| 181 |
enddef; |
| 182 |
|
| 183 |
def cap_serifs_tr(suffix $):= |
| 184 |
z$a=z$+cap_jut*right; z$b=z$+.7ser_height*down; z$c=z$a+serif_o*down; |
| 185 |
labels($a,$b,$c) |
| 186 |
enddef; |
| 187 |
|
| 188 |
def cap_serifs_bl(suffix $):= |
| 189 |
z$a=z$+cap_jut*left; z$b=z$+ser_height*up; z$c=z$a+serif_o*up; |
| 190 |
labels($a,$b,$c) |
| 191 |
enddef; |
| 192 |
|
| 193 |
def cap_serifs_bl_p(suffix $)(expr coe):= |
| 194 |
z$a=z$+coe*cap_jut*left; z$b=z$+ser_height*up; z$c=z$a+serif_o*up; |
| 195 |
labels($a,$b,$c) |
| 196 |
enddef; |
| 197 |
|
| 198 |
def cap_serifs_br(suffix $):= |
| 199 |
z$a=z$+cap_jut*right; z$b=z$+ser_height*up; z$c=z$a+serif_o*up; |
| 200 |
labels($a,$b,$c) |
| 201 |
enddef; |
| 202 |
|
| 203 |
def cap_serifs_br_p(suffix $)(expr coe):= |
| 204 |
z$a=z$+coe*cap_jut*right; z$b=z$+ser_height*up; z$c=z$a+serif_o*up; |
| 205 |
labels($a,$b,$c) |
| 206 |
enddef; |
| 207 |
|
| 208 |
vardef diag_serif(suffix $,$$):= |
| 209 |
y$bb=y$b; z$bb=whatever[z$,z$$]; |
| 210 |
z$bb{z$-z$$} |
| 211 |
enddef; |
| 212 |
|
| 213 |
def ital_serif(suffix $,$$):= |
| 214 |
if unknown x$'l: x$'l=.5u; fi |
| 215 |
y$'r=y$-.75serif_drop; |
| 216 |
pos$'(hair,60); |
| 217 |
y$''=y$'r-1.5curve; z$''=whatever[z$l,z$$l]; |
| 218 |
penlabels($',$''); |
| 219 |
path _is; |
| 220 |
_is:=z$r---z$l+o*down..{dir200}z$'r..z$'l&z$'l{right}..{down}z$''; |
| 221 |
enddef; |
| 222 |
|
| 223 |
def ital_hook(suffix $,$$)suffix modifier:= |
| 224 |
if not known x$$l: rt x$$l=w; fi |
| 225 |
y$$=.4bar_height; bot y$'l=-o; x$'=.45[x$,x$$]; |
| 226 |
pos$$(hair,150); pos$'(.5[hair,stem],90); penlabels($$,$'); |
| 227 |
z$$'=z$$r+hair*up; labels($$'); |
| 228 |
path _ih; |
| 229 |
_ih:=z$l{down}..z$'l..z$$l if test.modifier and testdpi:-- else:..z$$'&z$$'..fi z$$r..z$'r..{up}z$r; |
| 230 |
enddef; |
| 231 |
|
| 232 |
def ital_kooh(suffix $,$$)suffix modifier:= |
| 233 |
if not known x$$r: x$$r=0; fi |
| 234 |
y$$=H-.25bar_height; top y$'r=H+o; x$'=.45[x$,x$$]; |
| 235 |
pos$$(hair,150); pos$'(.5[hair,stem],100); penlabels($$,$'); |
| 236 |
z$$'=z$$l+hair*dir(-110); labels($$'); |
| 237 |
path _ik; |
| 238 |
_ik:=z$r{up}..z$'r..{dir-120}z$$r if test.modifier and testdpi:-- else: ..z$$'--z$$'+right..fi z$$l{dir60}..z$'l..{down}z$l; |
| 239 |
enddef; |
| 240 |
|
| 241 |
%%%%%%%%Arms |
| 242 |
vardef arm_bot_r_points(suffix $, $$)suffix modifier= |
| 243 |
numeric thick; thick=if test.modifier: alt_cap_hair else: cap_hair fi - currentbreadth; |
| 244 |
pos$$(beak,-90); z$$a=z$$r+2u*unitvector(z$-z$$r); |
| 245 |
z$$b=z$$r+.1u*down+1/3u*left; |
| 246 |
x$$c=.35[x$$b,x$$a]; y$$c=y$$; |
| 247 |
z$$d=z$$a+ser_height*left+thick*up; |
| 248 |
z$$e=z$+thick*up+cap_jut*right; z$$f=z$+.75ser_height*up; |
| 249 |
if (x$$d<x$$e): x$$d:=x$$e fi; |
| 250 |
z$$l.o=z$$l+serif_o*left+serif_o*down; |
| 251 |
penlabels($$); labels($$a,$$b,$$c,$$d,$$e, $$f); |
| 252 |
z$---z$$a...z$$b--z$$r---z$$l..{down}z$$l.o&z$$l.o..z$$c...z$$d---z$$e..{up}z$$f |
| 253 |
enddef; |
| 254 |
|
| 255 |
def arm_bot_r(suffix $, $$)suffix modifier= |
| 256 |
filldraw arm_bot_r_points($, $$).modifier--cycle; |
| 257 |
enddef; |
| 258 |
|
| 259 |
vardef arm_bot_l_points(suffix $, $$)suffix modifier= |
| 260 |
numeric thick; thick=if test.modifier: alt_cap_hair else: cap_hair fi - currentbreadth; |
| 261 |
pos$$(beak,-90); z$$a=z$$r+2u*unitvector(z$-z$$r); |
| 262 |
z$$b=z$$r+.1u*down+1/3u*right; |
| 263 |
x$$c=.35[x$$b,x$$a]; y$$c=y$$; |
| 264 |
z$$d=z$$a+ser_height*right+thick*up; |
| 265 |
z$$e=z$+thick*up+cap_jut*left; z$$f=z$+.75ser_height*up; |
| 266 |
if (x$$d>x$$e): x$$d:=x$$e fi; |
| 267 |
z$$l.o=z$$l+serif_o*right+serif_o*down; |
| 268 |
penlabels($$); labels($$a,$$b,$$c,$$d,$$e, $$f); |
| 269 |
z$---z$$a...z$$b--z$$r---z$$l..{down}z$$l.o&z$$l.o..z$$c...z$$d---z$$e..{up}z$$f |
| 270 |
enddef; |
| 271 |
|
| 272 |
def arm_bot_l(suffix $, $$)suffix modifier= |
| 273 |
filldraw arm_bot_l_points($, $$).modifier--cycle; |
| 274 |
enddef; |
| 275 |
|
| 276 |
vardef arm_top_r_points(suffix $, $$)suffix modifier= |
| 277 |
numeric thick; thick=if test.modifier: alt_cap_hair else: cap_hair fi - currentbreadth; |
| 278 |
pos$$(.65beak,90); z$$a=z$$r+2u*left; |
| 279 |
z$$b=z$$r+1/3u*left; z$$c=z$$l+serif_o*left; |
| 280 |
z$$d=z$$a+.75stem*left+thick*down; |
| 281 |
z$$.$=z$+thick*down+cap_jut*right; z$$.$a=z$+.55ser_height*down; |
| 282 |
penlabels($$); labels($$a,$$b,$$c,$$d,$$.$, $$.$a); |
| 283 |
z$---z$$a{right}..{dir0}z$$b..z$$r+cap_hair*down---z$$l..z$$c{dir125}..z$$d---z$$.$..{down}z$$.$a |
| 284 |
enddef; |
| 285 |
|
| 286 |
def arm_top_r(suffix $, $$)suffix modifier= |
| 287 |
filldraw arm_top_r_points($, $$).modifier--cycle; |
| 288 |
enddef; |
| 289 |
|
| 290 |
vardef arm_top_l_points(suffix $, $$)suffix modifier= |
| 291 |
numeric thick; thick=if test.modifier: alt_cap_hair else: cap_hair fi - currentbreadth; |
| 292 |
pos$$(.65beak,90); z$$a=z$$r+2u*right; |
| 293 |
z$$b=z$$r+1/3u*right; z$$c=z$$l+serif_o*right; |
| 294 |
z$$d=z$$a+.75stem*right+thick*down; |
| 295 |
z$$e=z$+thick*down+cap_jut*left; z$$f=z$+.55ser_height*down; |
| 296 |
penlabels($$); labels($$a,$$b,$$c,$$d,$$e, $$f); |
| 297 |
z$---z$$a{left}..{left}z$$b..z$$r+cap_hair*down---z$$l..z$$c{dir55}..z$$d---z$$e..{down}z$$f |
| 298 |
enddef; |
| 299 |
|
| 300 |
def arm_top_l(suffix $, $$)suffix modifier= |
| 301 |
filldraw arm_top_l_points($, $$).modifier--cycle; |
| 302 |
enddef; |
| 303 |
|
| 304 |
%%%%%%%Stroke endings |
| 305 |
vardef smitko(suffix $)(expr size):= %draw bulb j, J , 3 |
| 306 |
pos$(size,150); z$'=z$+.2size*up+o*right; z$''=z$+.5(size-currentbreadth)*dir-135; |
| 307 |
labels($',$''); |
| 308 |
z$''..z$'..z$l if bulbes:--.5[z$l,z$'']..{down}.5[z$l,z$'']fi |
| 309 |
enddef; |
| 310 |
|
| 311 |
vardef one_serif(suffix $):= % serif for numeral 1 |
| 312 |
rt z$a=(w-u,y$r); z$b=z$r+.75u*up; z$c=z$a+.5serif_o*up; |
| 313 |
lft z$d=(u,y$l); z$e=z$l+.75u*up; z$f=z$d+.5serif_o*up; |
| 314 |
labels($a,$b,$c,$d,$e,$f); |
| 315 |
z$e..{left}z$f..z$d{right}..z$+ser_boule*up..{right}z$a..{left}z$c..z$b |
| 316 |
enddef; |
| 317 |
|
| 318 |
%%%%%%%Simple macros |
| 319 |
def bskpoints(suffix $,$$)(expr bjut, ejut):= |
| 320 |
z$$ll=z$$l-bjut*unitvector(z$$-z$); z$rr=z$r-ejut*unitvector(z$-z$$); |
| 321 |
enddef; |
| 322 |
|
| 323 |
vardef bskrule(suffix $,$$)(expr bjut, ejut):= |
| 324 |
bskpoints($,$$,bjut,ejut); |
| 325 |
z$l---z$$ll..z$$r---z$rr..cycle |
| 326 |
enddef; |
| 327 |
|
| 328 |
%%%%%%%Macros for Unicode |
| 329 |
string charuni, empty; empty:=""; |
| 330 |
numeric uniproc; uniproc:=0; |
| 331 |
|
| 332 |
def uni text t:= |
| 333 |
charuni:=t; |
| 334 |
if t<>"non": t; fi |
| 335 |
enddef; |
| 336 |
|
| 337 |
def unitext(text t):= enddef; |
| 338 |
|
| 339 |
extra_beginchar:=extra_beginchar&"charuni:=empty; numeric oblu; oblu:=f_obl;"; |
| 340 |
|
| 341 |
%%%%%%Rounding |
| 342 |
def obl(suffix $,$$,$$$)suffix modifier:= % rounded corners |
| 343 |
if monospace and ((stem-hair)<.2hair): |
| 344 |
z$ |
| 345 |
else: |
| 346 |
z$+(oblu.modifier,0) rotated(angle(z$$-z$)) ... z$+(oblu.modifier,0) rotated(angle(z$$$-z$)) |
| 347 |
fi |
| 348 |
enddef; |
| 349 |
|
| 350 |
def tobl(suffix $,$$,$$$)suffix modifier:= % rounded corners |
| 351 |
if monospace and ((stem-hair)<.2hair): |
| 352 |
z$ |
| 353 |
else: |
| 354 |
if (abs(z$$-z$)>oblu.modifier): |
| 355 |
z$+(oblu.modifier,0) rotated(angle(z$$-z$)) |
| 356 |
else: |
| 357 |
.5[z$,z$$]{z$-z$$} |
| 358 |
fi |
| 359 |
... |
| 360 |
if (abs(z$$$-z$)>oblu.modifier): |
| 361 |
z$+(oblu.modifier,0) rotated(angle(z$$$-z$)) |
| 362 |
else: |
| 363 |
{z$$$-z$}.5[z$,z$$$] |
| 364 |
fi |
| 365 |
fi |
| 366 |
enddef; |
| 367 |
|
| 368 |
def ifobl(suffix $,$$,@,@@,#,##):= %rounded pair of corners |
| 369 |
if abs(z$-z$$)>oblu.#+oblu.##: obl($,@,$$).#---obl($$,$,@@).## |
| 370 |
else: z$+(oblu.#,0) rotated(angle(z@-z$))... {z$$-z$}.5[z$,z$$]...z$$+(oblu.##,0) rotated(angle(z@@-z$$)) |
| 371 |
fi |
| 372 |
enddef; |
| 373 |
|
| 374 |
boolean smer, smer.zpet; smer:=true; smer.zpet:=false; |
| 375 |
vardef rundy(expr p, t)suffix modifier:= %rounded paths |
| 376 |
numeric _rnd, _rndb, _oblu; |
| 377 |
if monospace and ((stem-hair)<.2hair): |
| 378 |
if numeric t: t else: xpart(t) fi |
| 379 |
else: |
| 380 |
_rnd:=if numeric t: t else: xpart(t) fi; |
| 381 |
if _rnd=infinity: _rnd:=length(p); fi; |
| 382 |
_rndb:=_rnd; |
| 383 |
_oblu:=if numeric t: oblu else: ypart(t) fi; |
| 384 |
forever: |
| 385 |
_rnd:=_rnd if (smer.modifier): + else: - fi 0.01; |
| 386 |
exitif length (point _rnd of p - point _rndb of p) >= _oblu; |
| 387 |
exitif (_rnd>length(p)) or (_rnd<0); |
| 388 |
endfor; |
| 389 |
if (_rnd>length(p)) or (_rnd<0): _rndb else: _rnd fi |
| 390 |
fi |
| 391 |
enddef; |
| 392 |
|
| 393 |
vardef bsktouch(expr _pa,_dira,_pb,_dirb):= |
| 394 |
((_pa shifted (max(1,.5currentbreadth)*_dira)) intersectionpoint (_pb shifted (max(1,.5currentbreadth)*_dirb))) |
| 395 |
enddef; |
| 396 |
|
| 397 |
%%%%%%Symbols |
| 398 |
def zeroent(suffix $)(expr ll, rr):= % Numeral zero for percent sign |
| 399 |
pos$a(ll,0); pos$b(vair,90); pos$c(rr,0); pos$d(vair,270); |
| 400 |
x$a.l - x$c.r=-4.5u; x$b=x$d=.5[x$a,x$c]; |
| 401 |
y$d.r - y$b.l=if monospace: .75\\fi bar_height; y$c=y$a=.5[y$b,y$d]; |
| 402 |
filldraw z$a.l{down}..z$b.l..z$c.r..z$d.l..{down}cycle; |
| 403 |
infill z$a.r{up}..z$d.r..z$c.l..z$b.r..{up}cycle; |
| 404 |
penlabels($a,$b,$c,$d); |
| 405 |
enddef; |
| 406 |
|
| 407 |
vardef bskfrench(suffix $,$$):= %French quote |
| 408 |
save p; save tim; |
| 409 |
path p; numeric tim[]; |
| 410 |
pos$(hair,0); pos$'(hair,0); pos$$(curve,0); |
| 411 |
.5[y$,y$']=y$$; x$=x$'; x$l-x$$r=stem; |
| 412 |
p:=z$'r{dir110}..{dir120}z$$r{dir60}..{dir70}z$r; |
| 413 |
tim1=xpart(p intersectiontimes ( ((x$$l,y$$)--(x$r,y$$)) shifted (hair*down) )); |
| 414 |
tim2=xpart(p intersectiontimes ( ((x$$l,y$$)--(x$r,y$$)) shifted (hair*up) )); |
| 415 |
filldraw z$l{dir-120}..{dir-140}z$$l{dir-50}..{dir-60}z$'l.. |
| 416 |
subpath(0,tim1) of p..subpath(tim2,infinity) of p..cycle; |
| 417 |
penlabels($,$',$$); |
| 418 |
enddef; |
| 419 |
|
| 420 |
vardef bskfrenchr(suffix $,$$):= %Reversed french quote |
| 421 |
save p; save tim; |
| 422 |
path p; numeric tim[]; |
| 423 |
pos$(hair,0); pos$'(hair,0); pos$$(curve,0); |
| 424 |
.5[y$,y$']=y$$; x$=x$'; x$r-x$$l=-stem; |
| 425 |
p:=z$'l{dir70}..{dir60}z$$l{dir120}..{dir110}z$l; |
| 426 |
tim1=xpart(p intersectiontimes ( ((x$$l,y$$)--(x$l,y$$)) shifted (hair*down) )); |
| 427 |
tim2=xpart(p intersectiontimes ( ((x$$l,y$$)--(x$l,y$$)) shifted (hair*up) )); |
| 428 |
filldraw z$r{dir-60}..{dir-40}z$$r{dir-130}..{dir-120}z$'r.. |
| 429 |
subpath(0,tim1) of p..subpath(tim2,infinity) of p..cycle; |
| 430 |
penlabels($,$',$$); |
| 431 |
enddef; |
| 432 |
|
| 433 |
def less(suffix @,$,$$)suffix modifier:= |
| 434 |
numeric _theta; path _less; |
| 435 |
pos@(rule_thickness,0); x$=x$$; .5[y$r,y$$r]=y@; |
| 436 |
if (unknown y$r) and (unknown y$$r): y$r=h-.5rule_thickness; fi; |
| 437 |
if (unknown x$r) and (unknown x$$r): x$r=w-x@l; fi; |
| 438 |
_theta:=angle(z$r-z@r); |
| 439 |
pos$(rule_thickness,_theta-90); pos$$(rule_thickness,_theta+45); |
| 440 |
z@'=z@l+(rule_thickness-currentbreadth)*dir(_theta-90); |
| 441 |
z@''=z@l+(rule_thickness-currentbreadth)*dir(_theta+45); |
| 442 |
z@'''=whatever[z@',z$r]=whatever[z@'',z$$r]; |
| 443 |
y@l'=y@l+o; z@l'=whatever[z@l,z$l]; |
| 444 |
bskpoints(@,$,hair,hair); |
| 445 |
_less:[email protected]@l'---z$ll..z$r---obl(@''',$r,$$r)---z$$r..z$$l; |
| 446 |
if not test.modifier: filldraw _less---cycle; fi; |
| 447 |
penlabels(@,$,$$); labels(@',@'',@''',$ll,@l'); |
| 448 |
enddef; |
| 449 |
|
| 450 |
def greater(suffix @,$,$$)suffix modifier:= |
| 451 |
numeric _theta; path _greater; |
| 452 |
pos@(rule_thickness,0); x$=x$$; .5[y$l,y$$l]=y@; |
| 453 |
if (unknown y$l) and (unknown y$$l): y$l=h-.5rule_thickness; fi; |
| 454 |
if (unknown x$l) and (unknown x$$l): x$l=w-x@r; fi; |
| 455 |
_theta:=angle(z$l-z@r); |
| 456 |
pos$(rule_thickness,_theta-90); pos$$(rule_thickness,_theta-45); |
| 457 |
z@'=z@l+(rule_thickness-currentbreadth)*dir(_theta+90); |
| 458 |
z@''=z@l+(rule_thickness-currentbreadth)*dir(_theta-45); |
| 459 |
z@'''=whatever[z@',z$r]=whatever[z@'',z$$r]; |
| 460 |
y@r'=y@r+o; z@r'=whatever[z@r,z$r]; |
| 461 |
bskpoints($,@,hair,hair); |
| 462 |
_greater:[email protected]@r'---z$rr..z$l---obl(@''',$l,$$r)---z$$r..z$$l; |
| 463 |
if not test.modifier: filldraw _greater---cycle; fi; |
| 464 |
penlabels(@,$,$$); labels(@',@'',@''',$rr,@r'); |
| 465 |
enddef; |
| 466 |
|
| 467 |
def logor(suffix @,$,$$)suffix modifier:= %Logical or shape |
| 468 |
numeric _theta; path _logor; |
| 469 |
pos@(rule_thickness,90); y$=y$$; .5[x$l,x$$l]=x@; |
| 470 |
if (unknown y$l) and (unknown y$$): y$l=h; fi; |
| 471 |
if unknown x$l: lft x$l=u; fi; |
| 472 |
_theta:=angle(z$l-z@l); |
| 473 |
pos$(rule_thickness,_theta-90); pos$$(rule_thickness,_theta+45); |
| 474 |
z@'=z@l+(rule_thickness-currentbreadth)*dir(_theta-90); |
| 475 |
z@''=z@l+(rule_thickness-currentbreadth)*dir(_theta+45); |
| 476 |
z@'''=whatever[z@',z$r]=whatever[z@'',z$$r]; |
| 477 |
x@l'=x@l-o; z@l'=whatever[z@l,z$l]; |
| 478 |
bskpoints(@,$,hair,hair); |
| 479 |
_logor:[email protected]@l'---z$ll..z$r---obl(@''',$r,$$r)---z$$r..z$$l; |
| 480 |
if not test.modifier: filldraw _logor---cycle; fi; |
| 481 |
penlabels(@,$,$$); labels(@',@'',@''',$ll,@l'); |
| 482 |
enddef; |
| 483 |
|
| 484 |
def logand(suffix @,$,$$)suffix modifier:= %Logical and shape |
| 485 |
numeric _theta; path _logand; |
| 486 |
pos@(rule_thickness,90); y$=y$$; .5[x$r,x$$r]=x@; |
| 487 |
if (unknown y$r) and (unknown y$$): y$r=-d; fi; |
| 488 |
if unknown x$r: lft x$r=u; fi; |
| 489 |
_theta:=angle(z$r-z@r); |
| 490 |
pos$(rule_thickness,_theta-90); pos$$(rule_thickness,_theta-45); |
| 491 |
z@'=z@l+(rule_thickness-currentbreadth)*dir(_theta+90); |
| 492 |
z@''=z@l+(rule_thickness-currentbreadth)*dir(_theta-45); |
| 493 |
z@'''=whatever[z@',z$l]=whatever[z@'',z$$r]; |
| 494 |
x@r'=x@r-o; z@r'=whatever[z@r,z$r]; |
| 495 |
bskpoints(@,$,hair,hair); |
| 496 |
_logand:[email protected]@r'---z$r...z$ll---obl(@''',$l,$$r)---z$$r..{z@r-z$$l}z$$l; |
| 497 |
if not test.modifier: filldraw _logand---cycle; fi; |
| 498 |
penlabels(@,$,$$); labels(@',@'',@''',$ll,@r'); |
| 499 |
enddef; |
| 500 |
|
| 501 |
def circle_points(expr sirka):= |
| 502 |
x4=x8=.5[x2,x6]; x1=x3=superness[x4,x2]; x5=x7=superness[x4,x6]; |
| 503 |
y2=y6=.5[y4,y8]; y1=y7=superness[y2,y8]; y3=y5=superness[y2,y4]; |
| 504 |
path _circle_path; |
| 505 |
_circle_path:=z8{right}...z1{z2-z8}...z2{down}...z3{z4-z2}...z4{left} |
| 506 |
...z5{z6-z4}...z6{up}...z7{z8-z6}...cycle; |
| 507 |
pos2(sirka,180); pos4(sirka,90); pos6(sirka,0); pos8(sirka,270); |
| 508 |
pos1(sirka,angle(direction 1 of _circle_path)+270); |
| 509 |
pos3(sirka,angle(direction 3 of _circle_path)+270); |
| 510 |
pos5(sirka,angle(direction 5 of _circle_path)-90); |
| 511 |
pos7(sirka,angle(direction 7 of _circle_path)-90); |
| 512 |
penlabels(1,2,3,4,5,6,7,8); |
| 513 |
enddef; |
| 514 |
|
| 515 |
def draw_circle suffix smer:= |
| 516 |
z8.smer{right}...z1.smer{z2-z8}...z2.smer{down}...z3.smer{z4-z2}...z4.smer{left}...z5.smer{z6-z4}...z6.smer{up}...z7.smer{z8-z6}...cycle |
| 517 |
enddef; |
| 518 |
|
| 519 |
vardef vlnka_points(suffix $,$$):= |
| 520 |
y$a.l=y$$; y$$a.r=y$; .5[x$,x$$]=.5[x$a,x$$a]=.5w; |
| 521 |
if unknown x$ : lft x$ =u; fi; |
| 522 |
top y$$- bot y$= spread; |
| 523 |
if unknown y$$: top y$$=h; fi |
| 524 |
x$$-x$$a=1/4(x$$-x$); |
| 525 |
pos$(hair,0); pos$$(hair,0); pos$a(curve,290); pos$$a(curve,250); |
| 526 |
z$$a.s=z$$a.r+curve*unitvector(z$$-z$); |
| 527 |
penlabels($,$a,$$,$$a); labels($$a.s); |
| 528 |
enddef; |
| 529 |
|
| 530 |
vardef vlnka(suffix $,$$)suffix modifier:= |
| 531 |
vlnka_points($,$$); |
| 532 |
path _vlnka; |
| 533 |
_vlnka:=z$r{z$a-z$}..z$a.r..z$$a.r..z$$a.s..{z$$-z$$a.r}z$$r.. |
| 534 |
z$$l{z$$a-z$$}..z$$a.l..z$a.l..{z$-z$a.l}z$l..{z$a-z$}z$r; |
| 535 |
if not test.modifier: filldraw _vlnka..cycle; fi; |
| 536 |
enddef; |
| 537 |
|
| 538 |
vardef vlnka_inv_points(suffix $,$$):= |
| 539 |
y$a.r=y$$; y$$a.l=y$; .5[x$,x$$]=.5[x$a,x$$a]=.5w; |
| 540 |
if unknown x$ : lft x$ =u; fi; |
| 541 |
top y$- bot y$$= spread; |
| 542 |
if unknown y$: top y$=h; fi |
| 543 |
x$$-x$$a=1/4(x$$-x$); |
| 544 |
pos$(hair,180); pos$$(hair,180); pos$a(curve,250); pos$$a(curve,290); |
| 545 |
z$$a.s=z$$a.l+curve*unitvector(z$$-z$); |
| 546 |
penlabels($,$a,$$,$$a); labels($$a.s); |
| 547 |
enddef; |
| 548 |
|
| 549 |
vardef vlnka_inv(suffix $,$$)suffix modifier:= |
| 550 |
vlnka_inv_points($,$$); |
| 551 |
path _vlnka_inv; |
| 552 |
_vlnka_inv:=z$r{z$a-z$}..z$a.r..z$$a.r..{z$$-z$$a.r}z$$r.. |
| 553 |
z$$l{z$$a-z$$}..z$$a.s...z$$a.l..z$a.l..{z$-z$a.l}z$l..{z$a-z$}z$r; |
| 554 |
if not test.modifier: filldraw _vlnka_inv..cycle; fi; |
| 555 |
enddef; |
| 556 |
|
| 557 |
def sipka_points(suffix $,$$):= |
| 558 |
numeric bskaw, bskat, bsktim[]; bskaw=abs(z$$l-z$$r)+currentbreadth; |
| 559 |
pair bskadir; bskadir=unitvector(z$-z$$r); bskat=angle(bskadir); |
| 560 |
path bskap[]; |
| 561 |
pos$a(bskaw,bskat+90); z$a.r=z$-bskadir*arrsize; |
| 562 |
z$b=z$a.r+arrwidth*dir(bskat-90); |
| 563 |
z$c=z$a.l+((1/3arrsize,0) rotated bskat); |
| 564 |
z$d=z$a.r+((1/3arrsize,0) rotated bskat); |
| 565 |
z$e=z$a.r+(arrwidth-.5currentbreadth)*dir(bskat+90); |
| 566 |
bskap0:=z$b+(hair*up rotated bskat){dir(bskat+45)}..z$c; |
| 567 |
bskap1:=z$d..{dir(bskat+135)}z$e+(hair*down rotated bskat); |
| 568 |
bsktim0=xpart(bskap0 intersectiontimes ((z$a.l--z$) shifted (.35arrwidth*dir(bskat-90)))); |
| 569 |
bsktim1=xpart(bskap1 intersectiontimes ((z$a.r--z$) shifted (.35arrwidth*dir(bskat+90)))); |
| 570 |
penlabels($,$$,$a); labels($c,$b,$c,$d,$e); |
| 571 |
enddef; |
| 572 |
|
| 573 |
vardef sipka(suffix $,$$):= |
| 574 |
sipka_points($,$$); |
| 575 |
z$a.r{bskadir}..subpath(bsktim1,infinity) of bskap1&z$e+(hair*down rotated bskat){dir(bskat+135)} |
| 576 |
..z$e{dir(bskat-45)}..{dir(bskat-30)}z${dir(bskat-160)}..{dir(bskat-135)}z$b |
| 577 |
..{dir(bskat+45)}z$b+(hair*up rotated bskat)&subpath (0,bsktim0) of bskap0..{-bskadir}z$a.l |
| 578 |
enddef; |
| 579 |
|
| 580 |
vardef sipka_ext(suffix $,$$):= |
| 581 |
numeric bskaw, bskat, bsktim[]; bskaw=abs(z$$l-z$$r)+currentbreadth; |
| 582 |
pair bskadir; bskadir=unitvector(z$-z$$); bskat=angle(bskadir); |
| 583 |
path bskap[]; |
| 584 |
pos$a(bskaw,bskat+90); z$a=z$-bskadir*arrsize; |
| 585 |
z$b=z$a.r+arrwidth*dir(bskat-90); |
| 586 |
z$c=z$a.l+((1/3arrsize,0) rotated bskat); |
| 587 |
z$d=z$a.r+((1/3arrsize,0) rotated bskat); |
| 588 |
z$e=z$a.r+(arrwidth-.5currentbreadth)*dir(bskat+90); |
| 589 |
bskap0:=z$b+(hair*up rotated bskat){dir(bskat+45)}..z$c; |
| 590 |
bskap1:=z$d..{dir(bskat+135)}z$e+(hair*down rotated bskat); |
| 591 |
bsktim0=xpart(bskap0 intersectiontimes ((z$a.l--z$) shifted (.35arrwidth*dir(bskat-90)))); |
| 592 |
bsktim1=xpart(bskap1 intersectiontimes ((z$a.r--z$) shifted (.35arrwidth*dir(bskat+90)))); |
| 593 |
penlabels($,$$,$a); labels($c,$b,$c,$d,$e); |
| 594 |
z$a.r{bskadir}..subpath(bsktim1,infinity) of bskap1&z$e+(hair*down rotated bskat){dir(bskat+135)} |
| 595 |
..z$e{dir(bskat-45)}..{dir(bskat-30)}z${dir(bskat-160)}..{dir(bskat-135)}z$b |
| 596 |
..{dir(bskat+45)}z$b+(hair*up rotated bskat)&subpath (0,bsktim0) of bskap0..{-bskadir}z$a.l |
| 597 |
enddef; |
| 598 |
|
| 599 |
def dvojsipka_points(suffix $,$$,@,@@):= |
| 600 |
bsktim100=xpart(bskap0 intersectiontimes (z@@--z@@+(z$-z$$r))); |
| 601 |
bsktim101=xpart(bskap1 intersectiontimes (z@--z@+(z$-z$$r))); |
| 602 |
z$p=point bsktim100 of bskap0; z$p.r-z$p.l=z$$r-z$$l; .5[z$p.r,z$p.l]=z$p; |
| 603 |
z$q=point bsktim101 of bskap1; z$q.r-z$q.l=z$$r-z$$l; .5[z$q.r,z$q.l]=z$q; |
| 604 |
z@r-z@l=z$$r-z$$l; .5[[email protected],[email protected]]=z@; z@@r-z@@l=z$$r-z$$l; .5[z@@.r,z@@.l]=z@@; |
| 605 |
bskap3=z@l+(z$-z$$r)--z@l; bskap4=z@r--z@r+(z$-z$$r); |
| 606 |
(bsktim11,bsktim12)=bskap1 intersectiontimes bskap3; |
| 607 |
(bsktim13,bsktim14)=bskap1 intersectiontimes bskap4; |
| 608 |
bskap5=z@@l+(z$-z$$r)--z@@l; bskap6=z@@r--z@@r+(z$-z$$r); |
| 609 |
(bsktim15,bsktim16)=bskap0 intersectiontimes bskap5; |
| 610 |
(bsktim17,bsktim18)=bskap0 intersectiontimes bskap6; |
| 611 |
penlabels($p,$q); |
| 612 |
enddef; |
| 613 |
|
| 614 |
vardef dvojsipka(suffix $,$$,@,@@):= |
| 615 |
sipka_points($,$$); |
| 616 |
dvojsipka_points($,$$,@,@@); |
| 617 |
oblu:=f_obl; |
| 618 |
penlabels(@,@@); |
| 619 |
subpath(0,rundy(bskap1,bsktim11).zpet) of bskap1.. |
| 620 |
subpath(rundy(bskap3,bsktim12),infinity) of bskap3.. |
| 621 |
subpath(0,rundy(bskap4,bsktim14).zpet) of bskap4.. |
| 622 |
subpath(rundy(bskap1,bsktim13),infinity) of bskap1 |
| 623 |
&z$e+(hair*down rotated bskat){dir(bskat+135)}..z$e{dir(bskat-45)}.. |
| 624 |
{dir(bskat-30)}z${dir(bskat-160)}..{dir(bskat-135)}z$b.. |
| 625 |
{dir(bskat+45)}z$b+(hair*up rotated bskat)& |
| 626 |
subpath(0,rundy(bskap0,bsktim15).zpet) of bskap0.. |
| 627 |
subpath(rundy(bskap5,bsktim16),infinity) of bskap5.. |
| 628 |
subpath(0,rundy(bskap6,bsktim18).zpet) of bskap6.. |
| 629 |
subpath(rundy(bskap0,bsktim17),infinity) of bskap0 |
| 630 |
enddef; |
| 631 |
|
| 632 |
vardef whitehead(suffix $,$$,@,@@):= |
| 633 |
z$'=z$+(rule_thickness-currentbreadth)*dir(bskat+180); |
| 634 |
path _whp[]; numeric _wht[]; |
| 635 |
_whp0:=z$'{dir(bskat+180)}..{dir(bskat+160)}point bsktim12 of bskap3; |
| 636 |
_whp1:=(bskap0 intersectionpoint (z@@r--z@@r+(z$-z$$))){dir(bskat+20)}..{dir(bskat)}z$'; |
| 637 |
(_wht0,_wht1)=(_whp0 shifted ((max(1,.5currentbreadth))*dir(bskat-90))) |
| 638 |
intersectiontimes (_whp1 shifted ((max(1,.5currentbreadth))*dir(bskat+90))); |
| 639 |
labels($',$''); |
| 640 |
subpath(rundy(_whp1,0),rundy(_whp1,_wht1).zpet) of _whp1 |
| 641 |
..subpath(rundy(_whp0,_wht0),rundy(_whp0,infinity).zpet) of _whp0 |
| 642 |
enddef; |
| 643 |
|
| 644 |
vardef trojsipka(suffix $,$$,@,@@):= |
| 645 |
sipka_points($,$$); |
| 646 |
dvojsipka_points($,$$,@,@@); |
| 647 |
oblu:=f_obl; |
| 648 |
penlabels(@,@@); |
| 649 |
bskap7=(x$$,y$d)--z$d; |
| 650 |
bskap8=z$$l+(z$-z$$r)--z$$l; |
| 651 |
(bsktim19,bsktim20)=bskap0 intersectiontimes bskap8; |
| 652 |
subpath(0,rundy(bskap7,infinity).zpet) of bskap7.. |
| 653 |
subpath(rundy(bskap1,0),rundy(bskap1,bsktim11).zpet) of bskap1.. |
| 654 |
subpath(rundy(bskap3,bsktim12),infinity) of bskap3.. |
| 655 |
subpath(0,rundy(bskap4,bsktim14).zpet) of bskap4.. |
| 656 |
subpath(rundy(bskap1,bsktim13),infinity) of bskap1 |
| 657 |
&z$e+(hair*down rotated bskat){dir(bskat+135)}..z$e{dir(bskat-45)}.. |
| 658 |
{dir(bskat-30)}z${dir(bskat-160)}..{dir(bskat-135)}z$b.. |
| 659 |
{dir(bskat+45)}z$b+(hair*up rotated bskat)& |
| 660 |
subpath(0,rundy(bskap0,bsktim15).zpet) of bskap0.. |
| 661 |
subpath(rundy(bskap5,bsktim16),infinity) of bskap5.. |
| 662 |
subpath(0,rundy(bskap6,bsktim18).zpet) of bskap6.. |
| 663 |
subpath(rundy(bskap0,bsktim17),rundy(bskap0,bsktim19).zpet) of bskap0.. |
| 664 |
subpath(rundy(bskap8,bsktim20),infinity) of bskap8 |
| 665 |
enddef; |
| 666 |
|
| 667 |
%%%%%%%%%%Accents |
| 668 |
boolean capital, capital.capital; capital:=false; capital.capital:=true; |
| 669 |
|
| 670 |
def grave(suffix $,$$)suffix modifier:= |
| 671 |
pos$(stem,10); pos$$(hair,0); |
| 672 |
x$$-x$=.25w; |
| 673 |
if unknown y$ : top y$=h; fi |
| 674 |
if unknown y$$: y$$=if capital.modifier: cap_height + .5u else: 1/4[x_height,y$] fi; fi |
| 675 |
bskpoints($,$$,hair,hair); |
| 676 |
filldraw z$$r---z$rr..z$---z$l--z$$l--cycle; |
| 677 |
penlabels($,$$);labels($rr,$$rr); |
| 678 |
enddef; |
| 679 |
|
| 680 |
def d_grave(suffix $,$$,@,@@)(expr mid)suffix modifier:= |
| 681 |
y$=y@; y$$=y@@; |
| 682 |
.5[.5[x$,x$$],.5[x@,x@@]]=mid; x$$-x$=x@@-x@; |
| 683 |
pos$(stem,10); pos$$(hair,0); pos@(stem,10); pos@@(hair,0); |
| 684 |
x$$-x$=2u; |
| 685 |
if unknown y$ : top y$=h; fi |
| 686 |
if unknown y$$: y$$=if capital.modifier: cap_height + .5u else: 1/4[x_height,y$] fi; fi |
| 687 |
bskpoints($,$$,hair,hair); bskpoints(@,@@,hair,hair); |
| 688 |
filldraw z$$r---z$rr..z$---z$l--z$$l--cycle; |
| 689 |
filldraw z@@[email protected]@---z@l--z@@l--cycle; |
| 690 |
penlabels($,$$,@,@@);labels($rr,$$rr,@rr,@@rr); |
| 691 |
enddef; |
| 692 |
|
| 693 |
def acute(suffix $,$$)suffix modifier:= |
| 694 |
pos$(stem,-10); pos$$(hair,0); |
| 695 |
if (unknown x$) or (unknown x$$): x$-x$$=.25w; fi |
| 696 |
if unknown y$ : top y$=h; fi |
| 697 |
if unknown y$$: y$$=if capital.modifier: cap_height + .5u else: 1/4[x_height,y$] fi; fi |
| 698 |
bskpoints($,$$,hair,hair); |
| 699 |
filldraw z$$r---z$rr..z$---z$l{z$$-z$l}..{z$$l-z$}z$$l--cycle; |
| 700 |
penlabels($,$$);labels($rr,$$rr); |
| 701 |
enddef; |
| 702 |
|
| 703 |
vardef acute_slope(suffix $,$$)(expr slope)suffix modifier:= |
| 704 |
save w; w:=4slope; |
| 705 |
acute($,$$).modifier; |
| 706 |
enddef; |
| 707 |
|
| 708 |
def hacek(suffix $,$$,$$$)suffix modifier:= |
| 709 |
{{ save oblu; oblu:=f_obl; |
| 710 |
y$=y$$$; .55[x$,x$$$]=x$$; |
| 711 |
if unknown y$ : top y$=h; fi |
| 712 |
if unknown y$$l: top y$$l=if capital.modifier: cap_height + .5u else: 1/4[x_height,y$] |
| 713 |
fi; fi |
| 714 |
pos$(hair,10); pos$$$(hair,0); pos$$(stem,90); pos$$'(stem,0); |
| 715 |
if unknown x$: x$$$-x$=5.5u; fi; |
| 716 |
z$$'=z$$+.25tiny*left; |
| 717 |
filldraw z$$$l---obl($$r,$$$l,$r)---z$r..z$---z$$'l..if not capital.modifier: z$$l.. fi z$$'r---z$$$r--cycle; |
| 718 |
penlabels($,$$,$$',$$$); |
| 719 |
}} |
| 720 |
enddef; |
| 721 |
|
| 722 |
def circumflex(suffix $,$$,$$$)suffix modifier:= |
| 723 |
{{ save oblu; oblu:=f_obl; |
| 724 |
y$=y$$$; .55[x$,x$$$]=x$$; |
| 725 |
if unknown y$$l: top y$$l=h; fi |
| 726 |
if unknown y$l : top y$l=if capital.modifier: cap_height + .75u else: 1/2[x_height,top y$$] |
| 727 |
fi; fi |
| 728 |
pos$(hair,-10); pos$$$(hair,0); pos$$(.2[stem,hair],270); pos$$'(stem,0); |
| 729 |
if unknown x$: x$$$-x$=6u; fi; |
| 730 |
z$$'=z$$+.25tiny*left; |
| 731 |
filldraw z$$$l---obl($$r,$$$l,$r)---z$r..z$---z$$'l..z$$l..z$$'r---z$$$r--cycle; |
| 732 |
penlabels($,$$,$$',$$$); |
| 733 |
}} |
| 734 |
enddef; |
| 735 |
|
| 736 |
def breve(suffix $,$$,$$$)suffix modifier:= |
| 737 |
y$=y$$$; .55[x$,x$$$]=x$$; |
| 738 |
if unknown y$ : top y$=h; fi |
| 739 |
if unknown y$$l: bot bot y$$l=if capital.modifier: cap_height else: 1/3[x_height, top y$]; |
| 740 |
fi; fi |
| 741 |
pos$(hair,10); pos$$$(hair,0); pos$$(.75[hair,stem],90); |
| 742 |
if unknown x$$$ or unknown x$: x$$$-x$=w-2u; fi; |
| 743 |
y$$$r:=y$$$r-.5tiny; |
| 744 |
filldraw z$l{down}..z$$l..{up}z$$$r--z$$$l{down}..z$$r..{up}z$r--cycle; |
| 745 |
penlabels($,$$,$$$); |
| 746 |
enddef; |
| 747 |
|
| 748 |
def tieacc(suffix $,$$,$$$)suffix modifier:= |
| 749 |
y$=y$$$; .55[x$,x$$$]=x$$; |
| 750 |
if unknown y$$r : top y$$l=h; fi |
| 751 |
if unknown y$: bot y$=if capital.modifier: cap_height else: 1/3[x_height, top y$$]; |
| 752 |
fi; fi |
| 753 |
pos$(hair,-10); pos$$$(hair,0); pos$$(.75[hair,stem],270); |
| 754 |
if unknown x$$$ or unknown x$: x$$$-x$=w-2u; fi; |
| 755 |
y$$$r:=y$$$r-.5tiny; |
| 756 |
filldraw z$l{up}..z$$l..{down}z$$$r--z$$$l{up}..z$$r..{down}z$r--cycle; |
| 757 |
penlabels($,$$,$$$); |
| 758 |
enddef; |
| 759 |
|
| 760 |
def macron(suffix $,$$):= |
| 761 |
y$=y$$; |
| 762 |
if unknown y$: top y$=h; fi |
| 763 |
if unknown x$$: x$$-x$=5u; fi |
| 764 |
if (unknown x$) or (unknown x$$): .5[x$,x$$]=.5w; fi |
| 765 |
pos$(hair,90); pos$$(hair,90); |
| 766 |
filldraw bskrule($$,$,hair,hair); |
| 767 |
penlabels($,$$); |
| 768 |
enddef; |
| 769 |
|
| 770 |
def ring(suffix $,$$)suffix modifier:= |
| 771 |
numeric ring_stroke; ring_stroke:=2/3[tiny,hair]; |
| 772 |
.5[z$$a,z$$c]=.5[z$$b,z$$d]=z$; |
| 773 |
x$$b=x$$d; y$$a=y$$c; y$$d-y$$b=(x$$c-x$$a); x$$a.l=x$$; |
| 774 |
if unknown x$$: lft x$$=1.5u; fi |
| 775 |
if unknown y$ : y$=if capital.modifier: .5[h,cap_height] else: .5[1/4[x_height,h],h] |
| 776 |
fi; fi |
| 777 |
pos$$a(ring_stroke,0); pos$$b(ring_stroke,90); |
| 778 |
pos$$c(ring_stroke,180); pos$$d(ring_stroke,270); |
| 779 |
filldraw z$$a.l{down}..z$$b.l..z$$c.l..z$$d.l..cycle; |
| 780 |
infill z$$a.r{down}..z$$b.r..z$$c.r..z$$d.r..cycle; |
| 781 |
penlabels($$a,$$b,$$c,$$d); labels($); |
| 782 |
enddef; |
| 783 |
|
| 784 |
vardef dotabove(suffix $):= |
| 785 |
save dot_size; dot_size:=stem; |
| 786 |
if unknown y$: top y$=h; fi |
| 787 |
y$:=y$-.5dot_size; |
| 788 |
dot($); |
| 789 |
enddef; |
| 790 |
|
| 791 |
def umlaut(suffix $,$$):= |
| 792 |
y$=y$$; |
| 793 |
if unknown x$ : lft x$ =u +.5dot_size; fi |
| 794 |
if unknown x$$: lft x$$=w-u-.5dot_size; fi |
| 795 |
dotabove($); dotabove($$); |
| 796 |
enddef; |
| 797 |
|
| 798 |
def h_umlaut(suffix $,$$,@,@@)(expr slope)suffix modifier:= |
| 799 |
y$=y$$; y@=y@@; |
| 800 |
if unknown x$: lft x$=u+slope; fi |
| 801 |
if unknown x$$: rt x$$=w-u; fi |
| 802 |
acute_slope($,@,slope).modifier; acute_slope($$,@@,slope).modifier; |
| 803 |
enddef; |
| 804 |
|
| 805 |
vardef tilde(suffix $,$$)suffix modifier:= |
| 806 |
save tstem; tstem:=if capital.modifier: .7\\fi stem; |
| 807 |
y$a.l=y$$; y$$a.r=y$; .5[x$,x$$]=.5[x$a,x$$a]=if known x.tilde: x.tilde else: .5w fi; |
| 808 |
if unknown x$ : x$ =u; fi; |
| 809 |
if unknown y$$: top y$$=h; fi |
| 810 |
if unknown y$ : bot y$=if capital.modifier: cap_height else:1/3[x_height,top y$$] |
| 811 |
fi; fi |
| 812 |
x$$-x$$a=1/4(x$$-x$); |
| 813 |
pos$(hair,0); pos$$(hair,0); pos$a(tstem,270); pos$$a(tstem,270); |
| 814 |
filldraw z$r{z$a-z$}..z$a.r..z$$a.r..{z$$-z$$a}z$$r.. |
| 815 |
z$$l{z$$a-z$$}..z$$a.l..z$a.l..{z$-z$a}z$l..cycle; |
| 816 |
penlabels($,$a,$$,$$a); |
| 817 |
enddef; |
| 818 |
|
| 819 |
def pol_cross(suffix $,$$):= |
| 820 |
x$$-x$=4u; y$$-y$=stem; |
| 821 |
if unknown y$: .5[y$,y$$]=.8[bar_height,x_height]; fi |
| 822 |
pos$(bar,angle(z$$-z$)+90); pos$$(bar,angle(z$$-z$)+90); |
| 823 |
filldraw bskrule($,$$,bar,bar); |
| 824 |
penlabels($,$$); |
| 825 |
enddef; |
| 826 |
|
| 827 |
%%%%%%Font making macros (some from cmbase) |
| 828 |
newinternal l,r,shrink_fit; % adjustments to spacing |
| 829 |
|
| 830 |
def charscription(expr width, height, depth)(text t):= |
| 831 |
def _saved_char := t; enddef; |
| 832 |
_saved_w:=width; _saved_u:=u; _saved_h:=height; _saved_d:=depth; |
| 833 |
let bskcharscriptcmd=relax; |
| 834 |
enddef; |
| 835 |
|
| 836 |
def multiply(expr x)(text t) = |
| 837 |
forsuffixes xx=t: |
| 838 |
multiply_:= xx; save xx; xx:=multiply_/x; |
| 839 |
endfor; |
| 840 |
enddef; |
| 841 |
|
| 842 |
def usechar text t= |
| 843 |
{{ |
| 844 |
save t_, WW, HH, DD; |
| 845 |
WW:=w; HH:=h; DD:=d; |
| 846 |
if not monospace: |
| 847 |
save w,h,d; numeric w,h,d; |
| 848 |
w=(u/_saved_u)*_saved_w; h=_saved_h; d=_saved_d; |
| 849 |
else: |
| 850 |
save h,d; numeric h,d; |
| 851 |
h=_saved_h; d=_saved_d; |
| 852 |
fi; |
| 853 |
def t_ = transformed currenttransform t enddef; |
| 854 |
_saved_char; |
| 855 |
}}; |
| 856 |
enddef; |
| 857 |
|
| 858 |
def restore_pars = w:=WW; h:=HH; d:=DD; enddef; |
| 859 |
|
| 860 |
def do_expansion(expr expansion_factor) = |
| 861 |
forsuffixes $=u,jut,cap_jut,beak_jut,apex_corr: |
| 862 |
$:=$.#*expansion_factor*hppp; endfor |
| 863 |
enddef; |
| 864 |
|
| 865 |
def normal_adjust_fit(expr left_adjustment,right_adjustment) = |
| 866 |
numeric charwd_in; charwd_in=charwd; |
| 867 |
l:=-hround(left_adjustment*hppp)-letter_fit; |
| 868 |
interim xoffset:=-l; |
| 869 |
charwd:=charwd+2letter_fit#+left_adjustment+right_adjustment; |
| 870 |
r:=l+hround(charwd*hppp)-shrink_fit; |
| 871 |
w:=r-hround(right_adjustment*hppp)-letter_fit; |
| 872 |
do_expansion(w/(charwd_in*hppp)); |
| 873 |
enddef; |
| 874 |
|
| 875 |
def mono_adjust_fit(expr left_adjustment,right_adjustment) = |
| 876 |
numeric charwd_in; charwd_in=charwd; |
| 877 |
numeric expansion_factor; |
| 878 |
mono_charwd#=2letter_fit# |
| 879 |
+expansion_factor*(charwd+left_adjustment+right_adjustment); |
| 880 |
l:=-hround(left_adjustment*expansion_factor*hppp)-letter_fit; |
| 881 |
interim xoffset:=-l; |
| 882 |
r:=l+mono_charwd-shrink_fit; |
| 883 |
w:=r-hround(right_adjustment*expansion_factor*hppp)-letter_fit; |
| 884 |
charwd:=mono_charwd#; charic:=mono_charic#; |
| 885 |
do_expansion(w/(charwd_in*hppp)); |
| 886 |
enddef; |
| 887 |
|
| 888 |
extra_endchar:=extra_endchar&"r:=r+shrink_fit;w:=r-l;"; |
| 889 |
|
| 890 |
def ignore_math_fit(expr left_adjustment,right_adjustment) = enddef; |
| 891 |
def do_math_fit(expr left_adjustment,right_adjustment) = |
| 892 |
l:=l-hround(left_adjustment*hppp); interim xoffset:=-l; |
| 893 |
charwd:=charwd+left_adjustment+right_adjustment; |
| 894 |
r:=l+hround(charwd*hppp)-shrink_fit; |
| 895 |
charic:=charic-right_adjustment; |
| 896 |
if charic<0: charic:=0; fi enddef; |
| 897 |
def zero_width = charwd:=0; r:=l-shrink_fit enddef; |
| 898 |
def change_width = if not monospace: % change width by $\pm1$ |
| 899 |
if r+shrink_fit-l=floor(charwd*hppp): w:=w+1; r:=r+1; |
| 900 |
else: w:=w-1; r:=r-1; fi fi enddef; |
| 901 |
def center_on(expr x) = if not monospace: % change width for symmetric fit |
| 902 |
r:=r+2x-w; w:=2x; fi enddef; |
| 903 |
def padded expr del_sharp = |
| 904 |
charht:=charht+del_sharp; chardp:=chardp+del_sharp enddef; |
| 905 |
|
| 906 |
def font_setup = |
| 907 |
if monospace: let adjust_fit=mono_adjust_fit; |
| 908 |
def mfudged=fudged enddef; |
| 909 |
mono_charic#:=body_height#*slant; |
| 910 |
if mono_charic#<0: mono_charic#:=0; fi |
| 911 |
mono_charwd#:=9.5u#; define_whole_pixels(mono_charwd); |
| 912 |
else: let adjust_fit=normal_adjust_fit; |
| 913 |
def mfudged= enddef; fi |
| 914 |
if math_fitting: let math_fit=do_math_fit |
| 915 |
else: let math_fit=ignore_math_fit fi; |
| 916 |
def medfig := if medieval: x_height# else: fig_height# fi enddef; |
| 917 |
def medfigd := if medieval: desc_depth# else: 0 fi enddef; |
| 918 |
def medfigu := if medieval: x_height else: fig_height fi enddef; |
| 919 |
def medfigdu := if medieval: desc_depth else: 0 fi enddef; |
| 920 |
def figw(text x) := if monofig: 9u# else: x# fi enddef; |
| 921 |
def figwu(text x) := if monofig: 9u else: x fi enddef; |
| 922 |
if unknown Acc_height#: Acc_height#:=cap_height#+.3x_height#; fi |
| 923 |
define_pixels(u,width_adj,serif_fit,cap_serif_fit,jut,cap_jut,beak, |
| 924 |
bar_height,punct_fit); |
| 925 |
define_whole_pixels(letter_fit,tiny,ser_boule); |
| 926 |
define_whole_vertical_pixels(body_height,asc_height,drop_stem, |
| 927 |
cap_height,fig_height,com_height,x_height,Acc_height,comma_depth,desc_depth,serif_drop); |
| 928 |
define_whole_blacker_pixels(hair,like_hair,stem,like_stem,curve,like_curve, |
| 929 |
dot_size,cap_hair,like_cap_hair,alt_cap_hair,cap_stem,like_cap_stem,cap_curve,like_cap_curve); |
| 930 |
define_whole_vertical_blacker_pixels(vair,bar,cap_bar); |
| 931 |
define_corrected_pixels(o,apex_o); |
| 932 |
forsuffixes $=hair,stem,cap_stem: |
| 933 |
fudged$.#:=fudge*$.#; fudged$:=hround(fudged$.#*hppp+blacker); |
| 934 |
forever: exitif fudged$>.9fudge*$; fudged$:=fudged$+1; endfor endfor |
| 935 |
rule_thickness:=ceiling(rule_thickness#*hppp); |
| 936 |
heavy_rule_thickness:=ceiling(3rule_thickness#*hppp); |
| 937 |
oo:=vround(.5o#*hppp*o_correction)+eps; |
| 938 |
apex_oo:=vround(.5apex_o#*hppp*o_correction)+eps; |
| 939 |
lowres_fix(stem,curve) 1.3; |
| 940 |
lowres_fix(stem,curve) 1.2; |
| 941 |
lowres_fix(cap_stem,cap_curve) 1.2; |
| 942 |
lowres_fix(hair,cap_hair,alt_cap_hair) 1.2; |
| 943 |
lowres_fix(cap_bar,bar) 1.2; |
| 944 |
ess:=(ess#/stem#)*stem; cap_ess:=(cap_ess#/cap_stem#)*cap_stem; |
| 945 |
dw:=(curve#-stem#)*hppp; bold:=curve#*hppp+blacker; |
| 946 |
serif_bend:=.25o*down; |
| 947 |
dh#:=.6designsize; define_whole_vertical_pixels(dh); |
| 948 |
more_super:=max(superness,sqrt .77superness); |
| 949 |
hein_super:=max(superness,sqrt .81225258superness); % that's $2^{-.3}$ |
| 950 |
clear_pen_memory; |
| 951 |
if tiny=0: tiny:=1; fi |
| 952 |
%%% fine $ %%%% temporary formatting convention for MFT |
| 953 |
if tiny>fudged.hair: tiny:=fudged.hair; fi |
| 954 |
tiny.breadth:=tiny; |
| 955 |
pickup if tiny=0: nullpen else: pencircle scaled tiny; tiny:=tiny-eps fi; |
| 956 |
tiny.nib:=savepen; breadth_[tiny.nib]:=tiny; |
| 957 |
forsuffixes $$=lft,rt,top,bot: shiftdef(tiny.$$,$$ 0); endfor |
| 958 |
%%% @ $ %%%% restore ordinary formatting for $ |
| 959 |
min_Vround:=tiny.breadth; |
| 960 |
if min_Vround<vround min_Vround: min_Vround:=vround min_Vround; fi |
| 961 |
forsuffixes $=vair,bar,cap_bar,bold: |
| 962 |
if $<min_Vround: $:=min_Vround; fi endfor |
| 963 |
pickup pencircle scaled rule_thickness; rule.nib:=savepen; |
| 964 |
math_axis:=good.y(math_axis#*hppp); |
| 965 |
currenttransform:=identity slanted slant |
| 966 |
yscaled aspect_ratio scaled granularity; |
| 967 |
if currenttransform=identity: let t_=relax |
| 968 |
else: def t_ = transformed currenttransform enddef fi; |
| 969 |
numeric paren_depth#; .5[body_height#,-paren_depth#]=math_axis#; |
| 970 |
define_whole_vertical_pixels(paren_depth); |
| 971 |
numeric asc_depth#; .5[asc_height#,-asc_depth#]=math_axis#; |
| 972 |
body_depth:=desc_depth+body_height-asc_height; |
| 973 |
shrink_fit:=1+hround(2letter_fit#*hppp)-2letter_fit; |
| 974 |
if not string mode: if mode<=smoke: shrink_fit:=0; fi fi |
| 975 |
numeric ser_height, serif_o, dig_stem, ddot, n_str_hair; |
| 976 |
ser_height:=1.5stem; |
| 977 |
serif_o:=.5cap_hair; |
| 978 |
dig_stem := if medieval: stem else: .5[stem,cap_stem] fi; |
| 979 |
ddot=.5(dot_size-stem); |
| 980 |
n_str_hair=1.3hair; |
| 981 |
if not known f_obl#: numeric f_obl#, f_obl; f_obl#:=10/36pt#; define_pixels(f_obl); fi |
| 982 |
if drop_stem = 1: drop_stem:=0; fi |
| 983 |
if ser_boule = 1: ser_boule:=0; fi |
| 984 |
boolean bold_face; bold_face:= if (stem/u > 4/3): true else: false fi; |
| 985 |
if known bsk_outline#: %Don't work correctly at small resolutions |
| 986 |
define_whole_pixels(bsk_outline); |
| 987 |
numeric bskoutsize; bskoutsize:= tiny-bsk_outline; if bskoutsize<1: bskoutsize:=1; fi; |
| 988 |
pickup pencircle scaled bskoutsize; bskoutlinepen.nib:=savepen; |
| 989 |
breadth_[bskoutlinepen.nib]:=bskoutsize; forsuffixes $$=lft,rt,top,bot: shiftdef(bskoutlinepen.$$,$$ 0); endfor |
| 990 |
def bsk_savepen:= pen bsk_pen; bsk_pen:=currentpen; enddef; |
| 991 |
def bsk_restorepen:= currentpen:=bsk_pen; enddef; |
| 992 |
let bskfilldraw = filldraw; |
| 993 |
def infill text t:= bsk_savepen; path _bp; _bp:=t; cullit; |
| 994 |
picture bskpict; bskpict:=currentpicture; currentpicture:=nullpicture; |
| 995 |
draw _bp; cullit; fill _bp; cull currentpicture keeping (2,2); |
| 996 |
pickup bskoutlinepen.nib; erase draw _bp; |
| 997 |
bsk_restorepen; |
| 998 |
currentpicture:=currentpicture+bskpict; bskpict:=nullpicture; |
| 999 |
enddef; |
| 1000 |
def filldraw text t:= bsk_savepen; path _bp; _bp:=t; bskfilldraw _bp; cullit; pickup bskoutlinepen.nib; erase bskfilldraw _bp; cullit; bsk_restorepen; enddef; |
| 1001 |
fi; |
| 1002 |
begingroup interim warningcheck:=0; testdpi:=(pixels_per_inch<=300); endgroup; |
| 1003 |
if unknown bbw: numeric bbw; bbw:=curve; fi %For blackboard-bold letters |
| 1004 |
enddef; |
| 1005 |
|
| 1006 |
vardef clockwise primary c = |
| 1007 |
if turningcheck>0: |
| 1008 |
interim autorounding:=0; |
| 1009 |
if turningnumber c > 0: reverse fi |
| 1010 |
fi |
| 1011 |
c enddef; |
| 1012 |
|
| 1013 |
def shiftdef(suffix $)(expr delta) = |
| 1014 |
vardef $ primary x = x+delta enddef enddef; |
| 1015 |
|
| 1016 |
def makebox(text rule) = |
| 1017 |
for y=0,asc_height,body_height,x_height,bar_height,-desc_depth,-body_depth: |
| 1018 |
rule((l,y)t_,(r,y)t_); endfor % horizontals |
| 1019 |
for x=l,r: rule((x,-body_depth)t_,(x,body_height)t_); endfor % verticals |
| 1020 |
rule((r,-max(body_depth,d)),(r,body_height)); |
| 1021 |
for x=u*(1+floor(l/u)) step u until r-1: |
| 1022 |
rule((x,-body_depth)t_,(x,body_height)t_); endfor % more verticals |
| 1023 |
if charic<>0: |
| 1024 |
rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); |
| 1025 |
if h=0: rule((r+charic*pt,0),(r+charic*pt,-.5d.o_)); fi |
| 1026 |
fi % italic correction |
| 1027 |
for y=math_axis,-d,h: rule((l-3u,y)t_,(r+3u,y)t_); endfor |
| 1028 |
enddef; |
| 1029 |
def maketicks(text rule) = |
| 1030 |
for y=0,h.o_,-d.o_: |
| 1031 |
rule((l,y),(l+10,y)); rule((r-10,y),(r,y)); endfor % horizontals |
| 1032 |
for x=l,r: |
| 1033 |
rule((x,10-d.o_),(x,-d.o_)); rule((x,h.o_-10),(x,h.o_)); endfor % verticals |
| 1034 |
if charic<>0: |
| 1035 |
rule((r+charic*pt,h.o_-10),(r+charic*pt,h.o_)); fi % italic correction |
| 1036 |
enddef; |
| 1037 |
rulepen:=pensquare; |
| 1038 |
|
| 1039 |
vardef penpos@#(expr b,d) = |
| 1040 |
if known b: if b<=0: errmessage "bad penpos"; fi fi |
| 1041 |
(x@#r-x@#l,y@#r-y@#l)=(b,0) rotated d; |
| 1042 |
x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef; |
| 1043 |
|
| 1044 |
newinternal currentbreadth; |
| 1045 |
vardef pos@#(expr b,d) = |
| 1046 |
% if known b: if b<=currentbreadth: errmessage "bad pos"; fi fi |
| 1047 |
(x@#r-x@#l,y@#r-y@#l)=(b-currentbreadth,0) rotated d; |
| 1048 |
x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef; |
| 1049 |
def numeric_pickup_ primary q = |
| 1050 |
currentpen:=pen_[q]; |
| 1051 |
pen_lft:=pen_lft_[q]; pen_rt:=pen_rt_[q]; |
| 1052 |
pen_top:=pen_top_[q]; pen_bot:=pen_bot_[q]; |
| 1053 |
currentpen_path:=pen_path_[q]; |
| 1054 |
if known breadth_[q]: currentbreadth:=breadth_[q]; fi enddef; |
| 1055 |
|
| 1056 |
vardef ic# = charic enddef; |
| 1057 |
vardef h# = charht enddef; |
| 1058 |
vardef w# = charwd enddef; |
| 1059 |
vardef d# = chardp enddef; |
| 1060 |
|
| 1061 |
let {{=begingroup; let }}=endgroup; |
| 1062 |
def .... = .. tension atleast .9 .. enddef; |
| 1063 |
def less_tense = save ...; let ...=.... enddef; |
| 1064 |
def ?? = hide(showvariable x,y) enddef; |
| 1065 |
|
| 1066 |
let semi_ =;; let colon_ = :; let endchar_ = endchar; |
| 1067 |
def iff expr b = if b:let next_=use_it else:let next_=lose_it fi; next_ enddef; |
| 1068 |
def use_it = let : = restore_colon; enddef; |
| 1069 |
def restore_colon = let : = colon_; enddef; |
| 1070 |
def lose_it = let endchar=fi; inner bskchar; let ;=fix_ semi_ if false enddef; |
| 1071 |
def fix_=let ;=semi_; let endchar=endchar_; outer bskchar; enddef; |
| 1072 |
def always_iff = let : = endgroup; killboolean enddef; |
| 1073 |
def killboolean text t = use_it enddef; |
| 1074 |
outer bskchar; |
| 1075 |
|
| 1076 |
endinput |