| 1 |
% Based on the Computer Modern source file sym.mf by D E Knuth. |
| 2 |
|
| 3 |
% Edited by Ariel Barton to produce better sans serif symbols |
| 4 |
|
| 5 |
% Date: 2013/03/22 |
| 6 |
|
| 7 |
% This file generates the following characters when their codes are known: |
| 8 |
% |minus|, |plus_minus|, |o_plus|, |o_times|, |
| 9 |
% |cup|, |cap|, |meet|, |join|, |
| 10 |
% |down_arrow|, |up_arrow|, |
| 11 |
% |left_arrow|, |right_arrow|, |double_arrow|, |
| 12 |
% |subset|, |superset|, |elt|, |
| 13 |
% |for_all|, |there_exists|, |false_that|, |
| 14 |
% |less|, |greater|, |underbar|, |
| 15 |
% |neq|, |leq|, |geq|, |eqv|, |
| 16 |
% |backslash|, |vertical|, |
| 17 |
% |cdot|, |diamond|, |
| 18 |
% |left_brace|, |right_brace|, |
| 19 |
% |straight_quotes|, |infty|, |integral|. |
| 20 |
|
| 21 |
iff known minus: cmchar "Minus sign"; |
| 22 |
beginarithchar(minus); pickup rule.nib; |
| 23 |
lft x1=hround 1.5u-eps; x2=w-x1; y1=y2=math_axis; |
| 24 |
draw z1--z2; % bar |
| 25 |
labels(1,2); endchar; |
| 26 |
|
| 27 |
iff known plus_minus: cmchar "Plus-or-minus sign"; |
| 28 |
beginarithchar(plus_minus); pickup rule.nib; |
| 29 |
numeric shiftup; shiftup=vround 1.5u; |
| 30 |
x1=x2=.5w; lft x3=lft x5=hround u-eps; x4=x6=w-x3; |
| 31 |
.5[y1,y2]=y3=y4=math_axis+shiftup; top y1=h+shiftup; y5=y6=y2; |
| 32 |
draw z1--z2; % stem |
| 33 |
draw z3--z4; % plus bar |
| 34 |
draw z5--z6; % minus bar |
| 35 |
labels(1,2,3,4,5,6); endchar; |
| 36 |
|
| 37 |
iff known o_plus: cmchar "Circle-plus operator"; |
| 38 |
beginarithchar(o_plus); pickup light_rule.nib; autorounded; |
| 39 |
lft x6=hround u; x2=w-x6; y2=math_axis; top y8=h; |
| 40 |
circle_points; draw_circle; % circle |
| 41 |
draw z2--z6; draw z4--z8; % bar and stem |
| 42 |
labels(1,2,3,4,5,6,7,8); endchar; |
| 43 |
|
| 44 |
iff known o_times: cmchar "Circle-times operator"; |
| 45 |
beginarithchar(o_times); pickup light_rule.nib; autorounded; |
| 46 |
lft x6=hround u; x2=w-x6; y2=math_axis; top y8=h; |
| 47 |
circle_points; draw_circle; % circle |
| 48 |
draw z1--z5; draw z3--z7; % diagonals |
| 49 |
labels(1,2,3,4,5,6,7,8); endchar; |
| 50 |
|
| 51 |
iff known cup: cmchar "Set union sign"; |
| 52 |
beginchar(cup,12u#,.8asc_height#,0); |
| 53 |
italcorr .8asc_height#*slant-.5u#; |
| 54 |
adjust_fit(0,0); pickup rule.nib; autorounded; |
| 55 |
lft x1=hround u; x2=x1; x3=w-x3; x4=x5=w-x1; |
| 56 |
y1=good.y h+o; bot y3=-o; y2=y4=2/3[y1,y3]; y5=y1; |
| 57 |
draw z1---z2...z3...z4---z5; % stems and cup |
| 58 |
labels(1,2,3,4,5); endchar; |
| 59 |
|
| 60 |
iff known cap: cmchar "Set intersection sign"; |
| 61 |
beginchar(cap,12u#,.8asc_height#,0); |
| 62 |
italcorr .8asc_height#*slant-.5u#; |
| 63 |
adjust_fit(0,0); pickup rule.nib; autorounded; |
| 64 |
lft x1=hround u; x2=x1; x3=w-x3; x4=x5=w-x1; |
| 65 |
y3=good.y h+o; bot y1=-o; y2=y4=2/3[y1,y3]; y5=y1; |
| 66 |
draw z1---z2...z3...z4---z5; % stems and cap |
| 67 |
labels(1,2,3,4,5); endchar; |
| 68 |
|
| 69 |
iff known meet: cmchar "Lattice infimum (logical and) sign"; |
| 70 |
beginchar(meet,12u#,.8asc_height#,0); |
| 71 |
italcorr .8asc_height#*slant-.5u#; |
| 72 |
adjust_fit(0,0); pickup rule.nib; |
| 73 |
lft x1=hround u-eps; x3=w-x3; x5=w-x1; |
| 74 |
y3=good.y h+o; bot y1=-o; y5=y1; |
| 75 |
draw z1--z3--z5; % diagonals |
| 76 |
labels(1,3,5); endchar; |
| 77 |
|
| 78 |
iff known join: cmchar "Lattice supremum (logical or) sign"; |
| 79 |
beginchar(join,12u#,.8asc_height#,0); |
| 80 |
italcorr .8asc_height#*slant-.5u#; |
| 81 |
adjust_fit(0,0); pickup rule.nib; |
| 82 |
lft x1=hround u-eps; x3=w-x3; x5=w-x1; |
| 83 |
y1=good.y h+o; bot y3=-o; y5=y1; |
| 84 |
draw z1--z3--z5; % diagonals |
| 85 |
labels(1,3,5); endchar; |
| 86 |
|
| 87 |
iff known down_arrow: cmchar "Downward arrow"; |
| 88 |
beginchar(down_arrow,9u#,asc_height#,asc_depth#); |
| 89 |
adjust_fit(0,0); pickup crisp.nib; |
| 90 |
pos1(rule_thickness,0); pos2(rule_thickness,0); |
| 91 |
pos3(rule_thickness,90); pos4(rule_thickness,90); |
| 92 |
lft x1l=hround(.5w-.5rule_thickness); y1+.5rule_thickness=h; |
| 93 |
x0=x1=x2; bot y0=-d; x0-x3=x4-x0=if monospace:3u else:4u fi+eps; |
| 94 |
y3=y4=y0+if monospace:.24 else:.36 fi asc_height+eps; |
| 95 |
pos5(rule_thickness,angle(z4-z0)); z5l=z0; |
| 96 |
pos6(rule_thickness,angle(z3-z0)); z6l=z0; |
| 97 |
z9=.2[.5[z3,z4],z0]; |
| 98 |
numeric t; path p; p=z4r{z9-z4}..z6r; |
| 99 |
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p; |
| 100 |
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r) |
| 101 |
---z1r..z1l---subpath (t,0) of\\(z3r{z9-z3}..z5r) |
| 102 |
--z3l{z9-z3}..z0 & cycle; % arrowhead and stem |
| 103 |
penlabels(0,1,2,3,4,5,6,9); endchar; |
| 104 |
|
| 105 |
iff known up_arrow: cmchar "Upward arrow"; |
| 106 |
beginchar(up_arrow,9u#,asc_height#,asc_depth#); |
| 107 |
italcorr .76asc_height#*slant+.5crisp#-u#; |
| 108 |
adjust_fit(0,0); pickup crisp.nib; |
| 109 |
pos1(rule_thickness,0); pos2(rule_thickness,0); |
| 110 |
pos3(rule_thickness,90); pos4(rule_thickness,90); |
| 111 |
lft x1l=hround(.5w-.5rule_thickness); y1-.5rule_thickness=-d; |
| 112 |
x0=x1=x2; top y0=h; x0-x3=x4-x0=if monospace:3u else:4u fi+eps; |
| 113 |
y3=y4=y0-if monospace:.24 else:.36 fi asc_height-eps; |
| 114 |
pos5(rule_thickness,angle(z4-z0)); z5l=z0; |
| 115 |
pos6(rule_thickness,angle(z3-z0)); z6l=z0; |
| 116 |
z9=.2[.5[z3,z4],z0]; |
| 117 |
numeric t; path p; p=z4l{z9-z4}..z6r; |
| 118 |
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p; |
| 119 |
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r) |
| 120 |
---z1r..z1l---subpath (t,0) of\\(z3l{z9-z3}..z5r) |
| 121 |
--z3r{z9-z3}..z0 & cycle; % arrowhead and stem |
| 122 |
penlabels(0,1,2,3,4,5,6,9); endchar; |
| 123 |
|
| 124 |
iff known left_arrow: cmchar "Leftward arrow"; |
| 125 |
compute_spread(.45x_height#,.55x_height#); |
| 126 |
beginchar(left_arrow,18u#,v_center(spread#+rule_thickness#)); |
| 127 |
adjust_fit(0,0); pickup crisp.nib; |
| 128 |
pos1(rule_thickness,90); pos2(rule_thickness,90); |
| 129 |
pos3(rule_thickness,0); pos4(rule_thickness,0); |
| 130 |
y0=y1=y2=math_axis; x1+.5rule_thickness=hround(w-u); lft x0=hround u; |
| 131 |
y3-y0=y0-y4=if monospace:.24 else:.36 fi asc_height+eps; |
| 132 |
x3=x4=x0+if monospace:3u else:4u fi+eps; |
| 133 |
pos5(rule_thickness,angle(z4-z0)); z5l=z0; |
| 134 |
pos6(rule_thickness,angle(z3-z0)); z6l=z0; |
| 135 |
z9=.2[.5[z3,z4],z0]; |
| 136 |
numeric t; path p; p=z4r{z9-z4}..z6r; |
| 137 |
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p; |
| 138 |
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r) |
| 139 |
---z1l..z1r---subpath (t,0) of\\(z3r{z9-z3}..z5r) |
| 140 |
--z3l{z9-z3}..z0 & cycle; % arrowhead and stem |
| 141 |
penlabels(0,1,2,3,4,5,6,9); endchar; |
| 142 |
|
| 143 |
iff known right_arrow: cmchar "Rightward arrow"; |
| 144 |
compute_spread(.45x_height#,.55x_height#); |
| 145 |
beginchar(right_arrow,18u#,v_center(spread#+rule_thickness#)); |
| 146 |
adjust_fit(0,0); pickup crisp.nib; |
| 147 |
pos1(rule_thickness,90); pos2(rule_thickness,90); |
| 148 |
pos3(rule_thickness,0); pos4(rule_thickness,0); |
| 149 |
y0=y1=y2=math_axis; x1-.5rule_thickness=hround u; rt x0=hround(w-u); |
| 150 |
y3-y0=y0-y4=if monospace:.24 else:.36 fi asc_height+eps; |
| 151 |
x3=x4=x0-if monospace:3u else:4u fi-eps; |
| 152 |
pos5(rule_thickness,angle(z4-z0)); z5l=z0; |
| 153 |
pos6(rule_thickness,angle(z3-z0)); z6l=z0; |
| 154 |
z9=.2[.5[z3,z4],z0]; |
| 155 |
numeric t; path p; p=z4l{z9-z4}..z6r; |
| 156 |
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p; |
| 157 |
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r) |
| 158 |
---z1l..z1r---subpath (t,0) of\\(z3l{z9-z3}..z5r) |
| 159 |
--z3r{z9-z3}..z0 & cycle; % arrowhead and stem |
| 160 |
penlabels(0,1,2,3,4,5,6,9); endchar; |
| 161 |
|
| 162 |
iff known double_arrow: cmchar "Left-and-right arrow"; |
| 163 |
compute_spread(.45x_height#,.55x_height#); |
| 164 |
beginchar(double_arrow,18u#, |
| 165 |
v_center(if monospace:.6asc_height#+fi spread#+rule_thickness#)); |
| 166 |
adjust_fit(0,0); pickup crisp.nib; |
| 167 |
pos1(rule_thickness,90); pos2(rule_thickness,90); |
| 168 |
pos3(rule_thickness,0); pos4(rule_thickness,0); |
| 169 |
y0=y1=y2=math_axis if monospace:+vround.3asc_height fi; lft x0=hround u; |
| 170 |
if monospace: x1+.5rule_thickness=hround(w-u) else: x1=.5w fi; |
| 171 |
y3-y0=y0-y4=if monospace:.24 else:.36 fi asc_height+eps; |
| 172 |
x3=x4=x0+if monospace:3u else:4u fi+eps; |
| 173 |
pos5(rule_thickness,angle(z4-z0)); z5l=z0; |
| 174 |
pos6(rule_thickness,angle(z3-z0)); z6l=z0; |
| 175 |
z9=.2[.5[z3,z4],z0]; |
| 176 |
numeric t; path p; p=z4r{z9-z4}..z6r; |
| 177 |
t=xpart(p intersectiontimes((0,y2l)--(w,y2l))); x2=xpart point t of p; |
| 178 |
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r) |
| 179 |
---z1l..z1r---subpath (t,0) of\\(z3r{z9-z3}..z5r) |
| 180 |
--z3l{z9-z3}..z0 & cycle; % left arrowhead and stem |
| 181 |
pos11(rule_thickness,90); pos12(rule_thickness,90); |
| 182 |
pos13(rule_thickness,0); pos14(rule_thickness,0); |
| 183 |
y10=y11=y12=math_axis if monospace:-vround.3asc_height fi; |
| 184 |
rt x10=hround(w-u); |
| 185 |
if monospace: x11-.5rule_thickness=hround u else: x11=.5w fi; |
| 186 |
y13-y10=y10-y14=if monospace:.24 else:.36 fi asc_height+eps; |
| 187 |
x13=x14=x10-if monospace:3u else:4u fi-eps; |
| 188 |
pos15(rule_thickness,angle(z14-z10)); z15l=z10; |
| 189 |
pos16(rule_thickness,angle(z13-z10)); z16l=z10; |
| 190 |
z19=.2[.5[z13,z14],z10]; |
| 191 |
numeric t; path p; p=z14l{z19-z14}..z16r; |
| 192 |
t=xpart(p intersectiontimes((0,y12l)--(w,y12l))); x12=xpart point t of p; |
| 193 |
filldraw z10..{z14-z19}z14r--subpath (0,t) of\\(z14l{z19-z14}..z16r) |
| 194 |
---z11l..z11r---subpath (t,0) of\\(z13l{z19-z13}..z15r) |
| 195 |
--z13r{z19-z13}..z10 & cycle; % right arrowhead and stem |
| 196 |
penlabels(0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,19); endchar; |
| 197 |
|
| 198 |
iff known subset: cmchar "Proper subset sign"; |
| 199 |
compute_spread(5/4x_height#,3/2x_height#); |
| 200 |
beginchar(subset,14u#,v_center(spread#+rule_thickness#)); |
| 201 |
italcorr h#*slant-u#; |
| 202 |
adjust_fit(0,0); pickup rule.nib; autorounded; |
| 203 |
lft x2=hround 1.5u-eps; x1=x3=w-x2; |
| 204 |
y1-y3=spread; y2=.5[y1,y3]=math_axis; |
| 205 |
x4=x5=.5w; y4=y1; y5=y3; |
| 206 |
draw z1---z4...z2{down}...z5---z3; % arc and bars |
| 207 |
labels(1,2,3,4,5); endchar; |
| 208 |
|
| 209 |
iff known superset: cmchar "Proper superset sign"; |
| 210 |
compute_spread(5/4x_height#,3/2x_height#); |
| 211 |
beginchar(superset,14u#,v_center(spread#+rule_thickness#)); |
| 212 |
italcorr h#*slant-u#; |
| 213 |
adjust_fit(0,0); pickup rule.nib; autorounded; |
| 214 |
lft x1=hround 1.5u-eps; x2=w-x1; x3=x1; |
| 215 |
y1-y3=spread; y2=.5[y1,y3]=math_axis; |
| 216 |
x4=x5=.5w; y4=y1; y5=y3; |
| 217 |
draw z1---z4...z2{down}...z5---z3; % arc and bars |
| 218 |
labels(1,2,3,4,5); endchar; |
| 219 |
|
| 220 |
iff known elt: cmchar "Element sign"; |
| 221 |
compute_spread(5/4x_height#,3/2x_height#); |
| 222 |
beginchar(elt,12u#,v_center(spread#+rule_thickness#)); |
| 223 |
italcorr h#*slant-u#; |
| 224 |
adjust_fit(0,0); pickup rule.nib; autorounded; |
| 225 |
lft x2=hround 1.5u-eps; x1=x3=x6=w-x2; |
| 226 |
y1-y3=spread; y2=y6=.5[y1,y3]=math_axis; |
| 227 |
x4=x5=.5w+u; y4=y1; y5=y3; |
| 228 |
draw z1---z4...z2{down}...z5---z3; % arc and bars |
| 229 |
draw z2--z6; % middle bar |
| 230 |
labels(1,2,3,4,5,6); endchar; |
| 231 |
|
| 232 |
iff known for_all: cmchar "Universal quantifier"; |
| 233 |
beginchar(for_all,10u#,asc_height#,0); |
| 234 |
italcorr asc_height#*slant; |
| 235 |
adjust_fit(0,0); pickup rule.nib; |
| 236 |
x2=good.x .5w; center_on(x2); |
| 237 |
lft x1=0; x3=w-x1; |
| 238 |
top y1=h; bot y2=-o; y3=y1; y4=y5=good.y x_height; |
| 239 |
z4=whatever[z1,z2]; z5=whatever[z2,z3]; |
| 240 |
draw z1--z2--z3; % diagonals |
| 241 |
draw z4--z5; % bar |
| 242 |
labels(1,2,3,4,5); endchar; |
| 243 |
|
| 244 |
iff known there_exists: cmchar "Existential quantifier"; |
| 245 |
beginchar(there_exists,10u#,asc_height#,0); |
| 246 |
italcorr asc_height#*slant; |
| 247 |
adjust_fit(0,0); pickup rule.nib; |
| 248 |
lft x1=hround u-eps; x2=x3=x5=w-x1; x4=x6-.25u=x1; |
| 249 |
top y1=h; bot y4=0; y2=y1; y5=y6=.5[y1,y3]; y3=y4; |
| 250 |
draw z1--z2--z3--z4; % upper bar, stem, lower bar |
| 251 |
draw z5--z6; % middle bar |
| 252 |
labels(1,2,3,4,5,6); endchar; |
| 253 |
|
| 254 |
iff known false_that: cmchar "Logical not sign"; |
| 255 |
beginchar(false_that,12u#,x_height#,0); |
| 256 |
italcorr x_height#*slant-.5u#; |
| 257 |
adjust_fit(0,0); pickup rule.nib; |
| 258 |
lft x1=hround u-eps; x2=x3=w-x1; |
| 259 |
y1=y2=good.y .5[bar_height,h]; y2-y3=1.2(h-bar_height); |
| 260 |
draw z1--z2--z3; % bar and stem |
| 261 |
labels(1,2,3); endchar; |
| 262 |
|
| 263 |
iff known less: cmchar "Less than sign"; |
| 264 |
compute_spread(5/4x_height#,3/2x_height#); |
| 265 |
beginchar(less,14u#,v_center(spread#+rule_thickness#)); |
| 266 |
italcorr h#*slant-u#; |
| 267 |
adjust_fit(0,0); pickup rule.nib; |
| 268 |
lft x2=hround 1.5u-eps; x1=x3=w-x2; |
| 269 |
y1-y3=spread; y2=.5[y1,y3]=math_axis; |
| 270 |
draw z1--z2--z3; % diagonals |
| 271 |
labels(1,2,3); endchar; |
| 272 |
|
| 273 |
iff known greater: cmchar "Greater than sign"; |
| 274 |
compute_spread(5/4x_height#,3/2x_height#); |
| 275 |
beginchar(greater,14u#,v_center(spread#+rule_thickness#)); |
| 276 |
italcorr math_axis#*slant-u#; |
| 277 |
adjust_fit(0,0); pickup rule.nib; |
| 278 |
rt x2=hround(w-1.5u)+eps; x1=x3=w-x2; |
| 279 |
y1-y3=spread; y2=.5[y1,y3]=math_axis; |
| 280 |
draw z1--z2--z3; % diagonals |
| 281 |
labels(1,2,3); endchar; |
| 282 |
|
| 283 |
iff known underbar: cmchar "Underbar suitable for < and >"; |
| 284 |
compute_spread((5/8+.45)*x_height#,(3/4+.55)*x_height#); |
| 285 |
beginchar(underbar,14u#,0,spread#-math_axis#+.5rule_thickness#); |
| 286 |
adjust_fit(0,0); pickup rule.nib; |
| 287 |
lft x1=hround 1.5u-eps; x2=w-x1; bot y1=bot y2=-d; |
| 288 |
draw z1--z2; % bar |
| 289 |
labels(1,2); endchar; |
| 290 |
|
| 291 |
iff known neq: cmchar "Unequals sign"; |
| 292 |
compute_spread(.45x_height#,.55x_height#); |
| 293 |
beginchar(neq,14u#,v_center(4spread#+rule_thickness#)); |
| 294 |
italcorr h#*slant-.5u#; |
| 295 |
adjust_fit(0,0); pickup rule.nib; |
| 296 |
lft x1=hround u-eps; x3=x1; x2=x4=w-x1; |
| 297 |
y1=y2; y3=y4; y1-y3=spread; .5[y1,y3]=math_axis; |
| 298 |
draw z1--z2; draw z3--z4; % bars |
| 299 |
lft x6=hround 3.5u-eps; x5=w-x6; top y5=h+o; bot y6=-d-o; |
| 300 |
draw z5--z6; % diagonal |
| 301 |
labels(1,2,3,4,5,6); endchar; |
| 302 |
|
| 303 |
iff known leq: cmchar "Less than or equal to sign"; |
| 304 |
compute_spread(.45x_height#,.55x_height#); |
| 305 |
spread#':=spread#; spread':=spread; % the spread of `$=$' |
| 306 |
compute_spread(5/4x_height#,3/2x_height#); |
| 307 |
beginchar(leq,14u#,v_center(spread#'+spread#+rule_thickness#)); |
| 308 |
italcorr h#*slant-u#; |
| 309 |
adjust_fit(0,0); pickup rule.nib; |
| 310 |
lft x2=hround 1.5u-eps; x1=x3=w-x2; |
| 311 |
y1-y3=spread; y2=.5[y1,y3]; top y1=h; |
| 312 |
draw z1--z2--z3; % diagonals |
| 313 |
x8=x1; x9=x2; y8=y9; y3-y9=spread'; draw z8--z9; % bar |
| 314 |
labels(1,2,3,8,9); endchar; |
| 315 |
|
| 316 |
iff known geq: cmchar "Greater than or equal to sign"; |
| 317 |
compute_spread(.45x_height#,.55x_height#); |
| 318 |
spread#':=spread#; spread':=spread; % the spread of `$=$' |
| 319 |
compute_spread(5/4x_height#,3/2x_height#); |
| 320 |
beginchar(geq,14u#,v_center(spread#'+spread#+rule_thickness#)); |
| 321 |
italcorr h#*slant-u#; |
| 322 |
adjust_fit(0,0); pickup rule.nib; |
| 323 |
lft x1=hround 1.5u-eps; x2=w-x1; x3=x1; |
| 324 |
y1-y3=spread; y2=.5[y1,y3]; top y1=h; |
| 325 |
draw z1--z2--z3; % diagonals |
| 326 |
x8=x1; x9=x2; y8=y9; y3-y9=spread'; draw z8--z9; % bar |
| 327 |
labels(1,2,3,8,9); endchar; |
| 328 |
|
| 329 |
iff known eqv: cmchar "Equivalence or congruence sign"; |
| 330 |
compute_spread(.45x_height#,.55x_height#); |
| 331 |
beginchar(eqv,14u#,v_center(2spread#+rule_thickness#)); |
| 332 |
italcorr h#*slant-.5u#; |
| 333 |
adjust_fit(0,0); pickup rule.nib; |
| 334 |
lft x1=hround u-eps; x3=x5=x1; x2=x4=x6=w-x1; |
| 335 |
y1=y2; y3=y4=math_axis; y5=y6; y1-y3=y3-y5=spread; |
| 336 |
draw z1--z2; % upper bar |
| 337 |
draw z3--z4; % middle bar |
| 338 |
draw z5--z6; % lower bar |
| 339 |
labels(1,2,3,4,5,6); endchar; |
| 340 |
|
| 341 |
iff known backslash: cmchar "Reverse slash (backslash)"; |
| 342 |
beginchar(backslash,9u#,body_height#,paren_depth#); |
| 343 |
adjust_fit(0,0); pickup rule.nib; |
| 344 |
lft x1=hround u-eps; top y1=h+eps; |
| 345 |
rt x2=hround(w-u)+eps; bot y2=-d-eps; |
| 346 |
draw z1--z2; % diagonal |
| 347 |
labels(1,2); endchar; |
| 348 |
|
| 349 |
iff known vertical: cmchar "Vertical line"; |
| 350 |
beginchar(vertical,5u#,body_height#,paren_depth#); |
| 351 |
italcorr body_height#*slant+.5rule_thickness#-2u#; |
| 352 |
adjust_fit(0,0); pickup rule.nib; |
| 353 |
x1=x2=good.x .5w; top y1=h+eps; bot y2=-d-eps; |
| 354 |
draw z1--z2; % stem |
| 355 |
labels(1,2); endchar; |
| 356 |
|
| 357 |
iff known cdot: cmchar "Period raised to axis height"; |
| 358 |
beginchar(cdot,5u#,v_center(7u#)); |
| 359 |
adjust_fit(0,0); pickup fine.nib; |
| 360 |
numeric dot_diam#; dot_diam#=if monospace: 5/4 fi\\ dot_size#; |
| 361 |
define_whole_blacker_pixels(dot_diam); |
| 362 |
pos1(dot_diam,0); pos2(dot_diam,90); |
| 363 |
lft x1l=hround(.5w-.5dot_diam); y1+.5dot_diam=vround(math_axis+.5dot_diam); |
| 364 |
z1=z2; dot(1,2); % dot |
| 365 |
penlabels(1,2); endchar; |
| 366 |
|
| 367 |
iff known diamond: cmchar "Diamond operator"; |
| 368 |
beginchar(diamond,9u#,v_center(7u#)); |
| 369 |
italcorr math_axis#*slant; |
| 370 |
adjust_fit(0,0); pickup rule.nib; |
| 371 |
numeric a; a=(lft 3.5u)*sqrt(3.14159/2); % an attempt to match circle area |
| 372 |
x4=x8=good.x .5w; center_on(x4); x2=w-x6=good.x(x4+a); |
| 373 |
y2=y6=.5[y4,y8]=math_axis; y8=good.y(y2+a); |
| 374 |
draw z2--z4--z6--z8--cycle; % bowl |
| 375 |
labels(2,4,6,8); endchar; |
| 376 |
|
| 377 |
iff known left_brace: cmchar "Left curly brace"; |
| 378 |
beginchar(left_brace,9u#,body_height#,paren_depth#); |
| 379 |
italcorr body_height#*slant+.5vair#-u#; |
| 380 |
adjust_fit(0,0); pickup fine.nib; |
| 381 |
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor |
| 382 |
forsuffixes $=2,3,5,6: pos$(stem,0); endfor |
| 383 |
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4'; |
| 384 |
lft x4l=hround(1.5u-.5vair); lft x2l=hround(.5w-.5stem); |
| 385 |
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5]; |
| 386 |
y1-y2=y3-y4=(y1-y4)/4; |
| 387 |
y1-y1'=y4-y4'=y7'-y7=min(vair,rule_thickness)-fine; |
| 388 |
filldraw z1l{left}...z2l---z3l...{left}z4l |
| 389 |
--z4'l{right}...z5l---z6l...{right}z7l |
| 390 |
--z7r--z7'r{left}...z6r---z5r...{left}.5[z4r,z4'r]{right} |
| 391 |
...z3r---z2r...{right}z1'r--z1r--cycle; % stroke |
| 392 |
penlabels(1,2,3,4,5,6,7); endchar; |
| 393 |
|
| 394 |
iff known right_brace: cmchar "Right curly brace"; |
| 395 |
beginchar(right_brace,9u#,body_height#,paren_depth#); |
| 396 |
italcorr math_axis#*slant+.5vair#-u#; |
| 397 |
adjust_fit(0,0); pickup fine.nib; |
| 398 |
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor |
| 399 |
forsuffixes $=2,3,5,6: pos$(stem,0); endfor |
| 400 |
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4'; |
| 401 |
rt x4r=hround(w-1.5u+.5vair); rt x2r=hround(.5w+.5stem); |
| 402 |
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5]; |
| 403 |
y1-y2=y3-y4=(y1-y4)/4; |
| 404 |
y1-y1'=y4-y4'=y7'-y7=min(vair-fine,rule_thickness); |
| 405 |
filldraw z1r{right}...z2r---z3r...{right}z4r |
| 406 |
--z4'r{left}...z5r---z6r...{left}z7r |
| 407 |
--z7l--z7'l{right}...z6l---z5l...{right}.5[z4l,z4'l]{left} |
| 408 |
...z3l---z2l...{left}z1'l--z1l--cycle; % stroke |
| 409 |
penlabels(1,2,3,4,5,6,7); endchar; |
| 410 |
|
| 411 |
iff known straight_quotes: cmchar "Straight double quotes"; |
| 412 |
beginchar(straight_quotes,9u#,asc_height#,0); |
| 413 |
numeric top_width#,spread#; top_width#=if serifs: flare# else: stem# fi; |
| 414 |
spread#=max(3u#,top_width#+.5u#); define_pixels(spread); |
| 415 |
italcorr asc_height#*slant+.5top_width#+.5spread#-4u#; |
| 416 |
adjust_fit(0,0); |
| 417 |
x1=x2; x3=x4=w-x1; x3-x1=spread+2; y1=y3; |
| 418 |
y2=y4=max(.5[bar_height,x_height]+.5vair,h-x_height); |
| 419 |
if serifs: pickup crisp.nib; pos1(flare,0); pos2(vair,0); |
| 420 |
pos3(flare,0); pos4(vair,0); |
| 421 |
y1+.5stem=h; filldraw circ_stroke z1e--z2e; % left stem and bulb |
| 422 |
filldraw circ_stroke z3e--z4e; % right stem and bulb |
| 423 |
else: pickup fine.nib; pos1(stem,0); pos2(vair,0); |
| 424 |
pos3(stem,0); pos4(vair,0); |
| 425 |
top y1=h; filldraw stroke z1e--z2e; % left stem |
| 426 |
filldraw stroke z3e--z4e; fi % right stem |
| 427 |
penlabels(1,2,3,4); endchar; |
| 428 |
|
| 429 |
iff known infty: cmchar "Infinity"; |
| 430 |
beginchar(infty,18u#,x_height#,0); |
| 431 |
italcorr .7x_height#*slant-.5u#; |
| 432 |
adjust_fit(0,0); pickup fine.nib; |
| 433 |
numeric theta,phi; |
| 434 |
if monospace: phi=-theta=90; |
| 435 |
else: phi=angle(4u,h); theta=angle(6u,-h); fi |
| 436 |
pos1(vair,180); pos2(.5[vair,curve],90+.5theta); pos3(curve,90+theta); |
| 437 |
pos4(curve,90+theta); pos5(.5[vair,curve],90+.5theta); |
| 438 |
pos6(vair,180); pos7(.2[vair,curve],270+.5phi); |
| 439 |
pos8(.3[vair,curve],270+phi); pos9(.2[vair,curve],270+.5phi); |
| 440 |
lft x1r=w-rt x6l=hround u; x2=x9=.4[x1,x8]; x5=x7=.6[x8,x6]; |
| 441 |
if monospace: x2l:=x2r; x5r:=x5l; x7r:=x7l; x9l:=x9r; fi |
| 442 |
y1=y6=.5h; top y2r=top y7l=h+oo; bot y5l=bot y9r=-oo; |
| 443 |
x8=.5[x3,x4]=.5w; y8=.5[y3,y4]=.5h; |
| 444 |
y3-y4=h/3; z3-z4=whatever*dir theta; |
| 445 |
filldraw stroke z1e{up}...z2e{right}...z3e---z4e...z5e{right} |
| 446 |
...z6e{up}...z7e{left}...{-dir phi}z8e...{left}z9e...z1e{up}; % bowls |
| 447 |
penlabels(1,2,3,4,5,6,7,8,9); endchar; |
| 448 |
|
| 449 |
iff known integral: cmchar "Integral sign"; |
| 450 |
beginchar(integral,5.25u#+max(1.25u#,stem#)+2max(1.5u#,curve#), |
| 451 |
asc_height#,desc_depth#); |
| 452 |
italcorr asc_height#*slant-.5u#; |
| 453 |
adjust_fit(0,0); pickup fine.nib; |
| 454 |
if serifs: |
| 455 |
pos2(hair,0); pos8(hair,-180); |
| 456 |
else: |
| 457 |
pos2(vair,0); pos8(vair,-180); |
| 458 |
fi |
| 459 |
pos1(curve,0); pos3(vair,90); pos4(.6[hair,stem],180); |
| 460 |
pos5(stem,180); pos5'(stem,0); z5'=z5; pos6(.6[hair,stem],0); |
| 461 |
pos7(vair,-90); pos9(curve,-180); |
| 462 |
if serifs: x7=w-x3=2.4u; rt x1r=max(rt x3+eps,hround(w-u)); |
| 463 |
else: x7=w-x3; rt x1r=hround(w-u); x3 = 0.5[x4l,x2l]; |
| 464 |
fi |
| 465 |
x9=w-x1; |
| 466 |
x5=.5[x4,x6]; x4-x6=1.5u; lft x5r=hround(.5w-.5stem); |
| 467 |
y9-.5curve=vround(-.9d-o+vair); y3-y1=y9-y7; |
| 468 |
top y3r=h+o; bot y7r=-d-o; y5=.5[y3,y7]=.5[y4,y6]; y4-y6=2/3(y3-y7); |
| 469 |
sansbulb(3,2,1); sansbulb(7,8,9); % bulbs |
| 470 |
filldraw stroke z3e{left}...z4e{(z5e-z4e)xscaled 1.1} |
| 471 |
..tension atleast 1 and atleast .8..{z5-z4}z5e; % upper stem |
| 472 |
filldraw stroke z5'e{z6-z5}..tension atleast.8 and atleast 1 |
| 473 |
..{(z6e-z5'e)xscaled 1.1}z6e...{left}z7e; % lower stem |
| 474 |
math_fit(0,-2u#); penlabels(1,2,3,4,5,6,7,8,9); endchar; |