% mathematical symbols by Anthony Phan.
% file: mathltlk.mf (mathematical letter-like symbols)
% last modification: May 16, 2005.
% Only known charcodes will be generated.

def horizontal_rules_list=math_axis,
  -body_depth,-desc_depth,x_height,cap_height,asc_height,body_height
enddef;

use_rule1;

%turningcheck:=0;

%
%  A
%

beginchar(for_all,8.2u#+2appr#,cap_height#,0);
  "Universal quantifier";
  pickup tiny.nib;
  lft x1l=w-rt x3r=appr-hround 0.5u; x2=x4=0.5[x1l,x3r];
  top y1l=top y3r=h; bot y2=bot y4=-o;
  adjust_slanted_bar(1l,2,1,2l)(0.5(rth-tiny),1);
  adjust_slanted_bar(3r,4,3,4r)(0.5(rth-tiny),-1);
  forsuffixes $=1,2,3,4: z$r-z$=z$-z$l; endfor
  z5=whatever[z1r,z2r]; z5=whatever[z3l,z4l];
  top y6r-bot y6l=top y7r-bot y7l=rth;
  top y6r=top y7r=vround(x_height+0.5rth);
  forsuffixes $=r,l: z6$=whatever[z1,z2]; z7$=whatever[z3,z4]; endfor
  filldraw z1l--z2l--z4r--z3r--z3l--z5--z1r--cycle;
  filldraw stroke z6e..z7e; penlabels(1,2,3,4,5,6,7);
endchar;

%
%  C
%

beginchar(complement,5.5u#+2appr#,cap_height#,0);
  "Complement";
       autorounded; pickup tiny.nib;
  pos1(rth,0); pos2(rth,0);
  pos7(rth,0); pos8(rth,0);
  h-bot y1=top y8+d=vround 0.25(h+d);
  y3+0.5rth=h+o; y6-0.5rth=-d-o;
  rt x1r=w-appr; x1=x2=x7=x8;
  x4=x5=appr+0.5rth; x3=x6=0.5[x1,x4];
  y2=y4=max(y3-x1+x3,1/6[y1,y3]);
  y5=y7=min(y6+x1-x3,1/6[y8,y6]);
  filldraw stroke z1e..z2e; filldraw stroke z7e..z8e;
  pickup rule.nib;
  draw z2 up_to_left z3 left_to_down
  z4..z5 down_to_right z6 right_to_up z7;
  penlabels(1,2,7,8); labels(3,4,5,6);
endchar;

%
%  E
%

beginchar(there_exists,6.5u#+appr#+Appr#,cap_height#,0);
  "Existential quantifier";
  pickup tiny.nib;
  pos1(rth,90); pos4(rth,-90); pos5(rth,90); pos6(rth,90);
  y2l=y1l; y2r=y1r; y3l=y4l; y3r=y4r; top y1r=h; bot y4r=0;
  top y5r=top y6r=vround 0.5(h+rth);
  x2r-x2l=x3r-x3l=rth-tiny;
  lft x1=lft x4=lft x5-hround 0.15u=appr;
  rt x2r=rt x3r=w-Appr; x6=0.5[x2l,x2r]; filldraw stroke z5e..z6e;
  filldraw stroke z1e--z2e--z3e--z4e; penlabels(1,2,3,4,5,6);
endchar;

beginchar(there_not_exists,6.5u#+appr#+Appr#,
    min(body_height#,cap_height#+asc_depth#),asc_depth#);
  "Not existential quantifier";
  pickup tiny.nib;
  pos1(rth,90); pos4(rth,-90); pos5(rth,90); pos6(rth,90);
  y2l=y1l; y2r=y1r; y3l=y4l; y3r=y4r; top y1r=cap_height; bot y4r=0;
  top y5r=top y6r=vround 0.5(cap_height+rth);
  x2r-x2l=x3r-x3l=rth-tiny;
  lft x1=lft x4=lft x5-hround 0.15u=appr;
  rt x2r=rt x3r=w-Appr; x6=0.5[x2l,x2r]; filldraw stroke z5e..z6e;
  filldraw stroke z1e--z2e--z3e--z4e;
  lft x8l-appr=w-Appr-rt x7r=hround u;
  bot y8l=-d-eps; y7r-y1r=y4r-y8l;
  adjust_slanted_bar(8l,7r,8r,7l)(rth-tiny,-1);
  filldraw stroke z7e..z8e; penlabels(1,2,3,4,5,6,7,8);
endchar;

%
%  F
%

beginchar(F_inverse,6.5u#+appr#+Appr#,cap_height#,0);
  "F inverse";
  pickup tiny.nib;
  pos1(rth,0); pos3(rth,-90); pos4(rth,90); pos5(rth,90);
  y2l=y3l; y2r=y3r; top y1=h; bot y3r=0;
  top y4r=top y5r=vround 0.5(h+rth);
  lft x3=lft x4-hround 0.15u=appr; rt x1r=w-Appr;
  x1r=x2r; x1l=x2l; x5=x1; filldraw stroke z4e..z5e;
  filldraw stroke z1e--z2e--z3e; penlabels(1,2,3,4,5);
endchar;

%
%  G
%

beginchar(G_inverse,11.2u#+2appr#,cap_height#,0);
  "G inverse (game)";
  pickup tiny.nib;
  top y2r=h+o; bot y4r=-o; y3=y0=0.5[y2r,y4r];
  top y7r=vround y3;
  rt x3r=w-appr; rt x3r-lft x0r=hround 13u;
  x2=x4=0.5[x0r,x3r]; lft x6r=appr; x6l-x6r=rth-tiny;
  pos0(rth,180); pos2(rth,90); pos3(rth,0); pos4(rth,-90);
  pos7(rth,90); rt x7=hround x2;
  path tmp_path.r,tmp_path.l; numeric t[].r,t[].l;
  forsuffixes $=r,l: y6$=y7$;
    tmp_path.$=z0$ up_to_right z2$ right_to_down z3$
    down_to_left z4$ left_to_up z0$;
    t2$=xpart(tmp_path.$ intersectiontimes (z6$..(x6$,y4$)));
    z5$=point t2$ of tmp_path.$;
  endfor
  t1r=xpart(tmp_path.r intersectiontimes (z6r..(x6r,y2r)));
  z1r=point t1r of tmp_path.r; y1=y3;
  z1-z1r=whatever*(direction t1r of tmp_path.r rotated -90);
  t1l=xpart(tmp_path.l intersectiontimes (z1r..z1));
  z1l=point t1l of tmp_path.l;
  filldraw stroke subpath (t1e,t2e) of tmp_path.e--z6e--z7e;
  penlabels(0,1,2,3,4,5,6,7);
endchar;

%
%  O
%

beginchar(empty_set,min(15.2u#,asc_height#+asc_depth#)+2appr#,
    asc_height#,asc_depth#);
  "The empty set";
  pickup rule.nib;
  a:=w-2appr;
  lft x3=w-rt x1=appr+hround(a/16.5)-eps;
  lft x5=appr; rt x6=w-appr;
  y2=good.y(math_axis+x1-0.5w)+eps;
  y6=good.y(math_axis+x6-0.5w);
  0.5[y2,y4]=0.5[y5,y6]=math_axis;
  x2=x4=0.5[x1,x3]; y1=y3=0.5[y2,y4];
  draw superellipse(z1,z2,z3,z4,1/sqrt 2);
  draw z5..z6; labels(1,2,3,4,5,6);
endchar;

beginchar(diameter_sign,12u#+2appr#,fig_height#,0);
  "Diameter sign";
  pickup rule.nib;
  top y2=top y6-o=h; bot y4=bot y5+o=-d;
  lft x3=appr; rt x1=w-appr;
  lft x5=appr+hround u; rt x6=w-appr-hround u;
  x2=x4=0.5[x1,x3]; y1=y3=0.5[y2,y4];
  draw superellipse(z1,z2,z3,z4,1/sqrt 2);
  draw z5..z6; labels(1,2,3,4,5,6);
endchar;

%
%  T
%

beginchar(top_sign,11.2u#+2appr#,cap_height#,0);
  "Top sign";
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0); pos3(rth,90); pos4(rth,90);
  top y1=top y3r=top y4r=cap_height; bot y2=-o;
  lft x1l=hround 0.5(w-rth);
  x2=x1; lft x3=appr; x1-x3=x4-x1;
  filldraw stroke z1e..z2e; % stem
  filldraw stroke z3e..z4e; % crossbar
  penlabels(1,2,3,4);
endchar;

beginchar(not_top_sign,11.2u#+2appr#,cap_height#,0);
  "Not top sign";
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0); pos3(rth,90); pos4(rth,90);
  top y1=top y3r=top y4r=cap_height; bot y2=-o;
  lft x1l=hround 0.5(w-rth);
  x2=x1; lft x3=appr; x1-x3=x4-x1;
  filldraw stroke z1e..z2e; % stem
  filldraw stroke z3e..z4e; % crossbar
  lft x5r=lft x5l=appr; rt x6r=rt x6l=w-appr;
  h-top y6r=bot y5l+d=hround 0.15(h+d)-eps;
  numeric a,b; a=rth-tiny; b=abs(z6r-z5l);
  y5r-y5l=y6r-y6l=a/(((x6r-x5l)/b)*((b+-+a)/b)+((y6r-y5l)/b)*(a/b));
  filldraw stroke z5e..z6e;
  penlabels(1,2,3,4,5,6);
endchar;

beginchar(bot_sign,11.2u#+2appr#,cap_height#,0);
  "Bot sign";
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0); pos3(rth,90); pos4(rth,90);
  bot y2=bot y3l=bot y4l=0; top y1=cap_height+o;
  lft x1l=hround 0.5(w-rth); x2=x1;
  lft x3=appr; x1-x3=x4-x1;
  filldraw stroke z1e..z2e; % stem
  filldraw stroke z3e..z4e; % crossbar
  penlabels(1,2,3,4);
endchar;

beginchar(not_bot_sign,11.2u#+2appr#,cap_height#,0);
  "Not bot sign";
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0); pos3(rth,90); pos4(rth,90);
  bot y2=bot y3l=bot y4l=0; top y1=cap_height+o;
  lft x1l=hround 0.5(w-rth); x2=x1;
  lft x3=appr; x1-x3=x4-x1;
  filldraw stroke z1e..z2e; % stem
  filldraw stroke z3e..z4e; % crossbar
  lft x5r=lft x5l=appr; rt x6r=rt x6l=w-appr;
  h-top y6r=bot y5l+d=hround 0.15(h+d)-eps;
  numeric a,b; a=rth-tiny; b=abs(z6r-z5l);
  y5r-y5l=y6r-y6l=a/(((x6r-x5l)/b)*((b+-+a)/b)+((y6r-y5l)/b)*(a/b));
  filldraw stroke z5e..z6e;
  penlabels(1,2,3,4,5,6);
endchar;

%
%  EPSILONS
%

% use_rule2;

rth:=ceiling((1/3[rth1#,rth2#])*hppp);
pickup pencircle scaled rth;
math_axis:=good.x(math_axis#*hppp);

beginchar(belong_to,7.5u#+2appr#,v_center(spread3#));
  "Belong to";
  pickup tiny.nib;
  pos2(rth,90); pos6(rth,90); pos3(rth,90); pos4(rth,270);
  y3=y6=math_axis;
  y2-y3=y3-y4=vround(0.5spread3-0.5rth+0.5[oo,o])+eps;
  top y1r=vround(y3+0.5spread3); y1r-y3=y3-y5r;
  rt x1r=rt x5r+hround 0.6u=w-appr; x3=appr-ho+0.5rth;
  x2r=0.5[x1r,x3]; x4=0.5[x5r,x3];
  z1'-z1r=(z2r-z1r) xscaled 0.35; z5'-z5r=(z4r-z5r) xscaled 0.325;
  pos1(rth,angle(z1'-z1r)-90); pos5(rth,angle(z5r-z5')-90);
  x6=good.x x1l;
  filldraw stroke z2e{right}...z1e{z1r-z1'};
  filldraw stroke z5e{z5'-z5r}...z4e{left};
  filldraw stroke z3e..z6e;
  pickup pencircle scaled rth;
  draw z2..controls 0.625[z2,(x3,y2)] and 0.65[z3,(x3,y2)]..
  z3..controls 0.65[z3,(x3,y4)] and 0.625[z4,(x3,y4)]..z4;
  penlabels(1,2,3,4,5,6,7,1',5');
  tmp_picture:=currentpicture;
endchar;

beginchar(not_belong_to,7.5u#+2appr#,asc_height#,asc_depth#);
  "Not belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  lft x2l=w-rt x1r=appr+hround u;
  top y1r=h+eps; 0.5[y1r,y2l]=math_axis;
  adjust_slanted_bar(2l,1r,2r,1l)(rth-tiny,-1);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(var_not_belong_to,7.5u#+2appr#,asc_height#,asc_depth#);
  "Variant not belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0);
  top y1l=h+eps; 0.5[y1l,y2l]=math_axis;
  lft x1l=lft x2l=vround 0.5(w-rth);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(belong_to_bar,7.5u#+2appr#,
    math_axis#+0.5spread3#+spread1#+0.5rth#,
    0.5spread3#-math_axis#);
  "Variant not reverse belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  pos1(rth,90); pos2(rth,90); top y1r=top y2r=h;
  lft x1l=appr; rt x2=w-appr;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(rev_belong_to,7.5u#+2appr#,v_center(spread3#));
  "Reverse belong to";
  pickup tiny.nib;
  pos2(rth,-90); pos6(rth,90); pos3(rth,90); pos4(rth,90);
  y3=y6=math_axis;
  y3-y2=y4-y3=vround(0.5spread3-0.5rth+0.5[oo,o])+eps;
  top y5r=vround(y3+0.5spread3); y1r-y3=y3-y5r;
  lft x1r=lft x5r-hround 0.6u=appr; x3=w-appr+ho-0.5rth;
  x2r=0.5[x1r,x3]; x4=0.5[x5r,x3];
  z1'-z1r=(z2r-z1r) xscaled 0.35; z5'-z5r=(z4r-z5r) xscaled 0.325;
  pos1(rth,angle(z1'-z1r)-90); pos5(rth,angle(z5r-z5')-90);
  x6=good.x x1l;
  filldraw stroke z2e{left}...z1e{z1r-z1'};
  filldraw stroke z5e{z5'-z5r}...z4e{right};
  filldraw stroke z6e..z3e;
  pickup pencircle scaled rth;
  draw z2..controls 0.625[z2,(x3,y2)] and 0.65[z3,(x3,y2)]..
  z3..controls 0.65[z3,(x3,y4)] and 0.625[z4,(x3,y4)]..z4;
  penlabels(1,2,3,4,5,6,7,1',5');
  tmp_picture:=currentpicture;
endchar;

beginchar(not_rev_belong_to,7.5u#+2appr#,asc_height#,asc_depth#);
  "Not reverse belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  pickup tiny.nib;
  lft x2l=w-rt x1r=appr+hround u;
  top y1r=h+eps; 0.5[y1r,y2l]=math_axis;
  adjust_slanted_bar(2l,1r,2r,1l)(rth-tiny,-1);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(var_not_rev_belong_to,7.5u#+2appr#,asc_height#,asc_depth#);
  "Variant not reverse belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0);
  top y1l=h; 0.5[y1l,y2l]=math_axis;
  lft x1l=lft x2l=vround 0.5(w-rth);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(rev_belong_to_bar,7.5u#+2appr#,math_axis#+0.5spread3#,
    0.5spread3#+spread1#+0.5rth#-math_axis#);
  "Variant not reverse belong sign";
  currentpicture:=tmp_picture;
  pickup tiny.nib;
  pos1(rth,90); pos2(rth,90); bot y1l=bot y2l=-d;
  lft x1l=appr; rt x2=w-appr;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

%
%  U
%

use_rule1;

beginchar(cap_sign,12u#+2appr#,x_height#,0);
  "Small cap sign";
  pickup tiny.nib;
  pos1(rth,180); pos2(rth,180);
  pos4(rth,0); pos5(rth,0);
  y3+0.5rth=h+o; bot y1r=bot y5r=-d; y2=y4=2/3[y3,y1r];
  lft x1r=w-rt x5r=appr+hround 0.8u;
  x1=x2; x4=x5; x3=0.5[x2,x4];
  filldraw stroke z1e..z2e; filldraw stroke z4e..z5e;
  pickup rule.nib; autorounded;
  draw z2 down_to_right z3 right_to_up z4;
  penlabels(1,2,3,4,5);
endchar;

beginchar(cup_sign,12u#+2appr#,x_height#,0);
  "Small cup sign";
  pickup tiny.nib;
  pos1(rth,180); pos2(rth,180);
  pos4(rth,0); pos5(rth,0);
  y3-0.5rth=-d-o; top y1r=top y5r=h; y2=y4=2/3[y3,y1r];
  lft x1r=w-rt x5r=appr+hround 0.8u;
  x1=x2; x4=x5; x3=0.5[x2,x4];
  filldraw stroke z5e..z4e; filldraw stroke z2e..z1e;
  pickup rule.nib; autorounded;
  draw z2 down_to_right z3 right_to_up z4;
  penlabels(1,2,3,4,5);
endchar;

beginchar(cup_plus,12u#+2appr#,x_height#,0);
  "Small cup-plus sign";
  ensure_centering_of(rth);
  %
  pickup tiny.nib;
  pos1(rth,180); pos2(rth,180); pos3(rth,-90);
  pos4(rth,0); pos5(rth,0);
  y3-0.5rth=-d-o; top y1r=top y5r=h; y2=y4=2/3[y3,y1r];
  lft x1r=w-rt x5r=appr+hround 0.8u;
  x1=x2; x4=x5; x3=0.5[x2,x4];
  filldraw stroke z5e..z4e; filldraw stroke z2e..z1e;
  %
  pos6(rth,0); pos7(rth,0); pos8(rth,90); pos9(rth,90);
  top y6=h; x6=x7=0.5w;
  numeric a;
  a=0.5(min(lft x5r-rt x1r-1.2u,h-rth-0.6u)-rth);
  y6-y8r=y8l-y7=vround a; x6l-x8=x9-x6r=hround a; y8=y9;
  filldraw stroke z6e..z7e; filldraw stroke z8e..z9e;
  pickup rule.nib; autorounded;
  draw z2 down_to_right z3 right_to_up z4;
  penlabels(1,2,3,4,5,6,7,8,9);
endchar;

beginchar(sqcap_sign,12u#+2appr#,x_height#,0);
  "Small square cap sign";
  pickup tiny.nib;
  pos1(rth,180); pos4(rth,0);
  top y2r=top y3r=h; bot y1=bot y4=-d;
  top y2r-bot y2l=top y3r-bot y3l=rth;
  lft x1r=w-rt x4r=appr+hround 0.95u;
  x2r=x1r; x3r=x4r; x2l=x1l; x3l=x4l;
  filldraw stroke z1e--z2e--z3e--z4e;
  penlabels(1,2,3,4);
endchar;

beginchar(sqcup_sign,12u#+2appr#,x_height#,0);
  "Small square cup sign";
  pickup tiny.nib;
  pos1(rth,180); pos4(rth,0);
  bot y2r=bot y3r=-d; top y1=top y4=h;
  top y2l-bot y2r=top y3l-bot y3r=rth;
  lft x1r=w-rt x4r=appr+hround 0.95u;
  x2r=x1r; x3r=x4r; x2l=x1l; x3l=x4l;
  filldraw stroke z4e--z3e--z2e--z1e;
  penlabels(1,2,3,4);
endchar;

beginchar(sqcup_plus,12u#+2appr#,x_height#,0);
  "Small square cup-plus sign";
  pickup tiny.nib;
  ensure_centering_of(rth);
  pos1(rth,180); pos4(rth,0);
  bot y2r=bot y3r=-d; top y1=top y4=h;
  top y2l-bot y2r=top y3l-bot y3r=rth;
  lft x1r=w-rt x4r=appr+hround 0.95u;
  x2r=x1r; x3r=x4r; x2l=x1l; x3l=x4l;
  filldraw stroke z4e--z3e--z2e--z1e;
  %
  pos6(rth,0); pos7(rth,0); pos8(rth,90); pos9(rth,90);
  top y6=h; x6=x7=0.5w;
  numeric a;
  a=0.5(min(lft x4l-rt x1l-1.2u,h-rth-0.6u)-rth);
  y6-y8r=y8l-y7=vround a; x6l-x8=x9-x6r=hround a; y8=y9;
  filldraw stroke z6e..z7e; filldraw stroke z8e..z9e;
  penlabels(1,2,3,4,6,7,8,9);
endchar;

def tmp_program(expr stem,orientation,$)=
  autorounded; pickup tiny.nib;
  pos1(stem,0); pos2(stem,0);
  pos4(stem,180); pos5(stem,180);
  lft x1l=w-rt x5l=appr+hround $;
  x1l=x2l; x4l=x5l; x3=0.5[x1,x5];
  if orientation=up: pos3(stem,90);
    top y1=top y5=h; bot y3l=-d-o;
    y2=y4=min(0.25[y1,y3r],y3+0.5(x5-x1));
  else: pos3(stem,-90);
    bot y1=bot y5=-d; top y3l=h+o;
    y2=y4=max(0.25[y1,y3r],y3-0.5(x5-x1));
  fi
  filldraw stroke z1e..z2e..controls (x2e,y3e) and (flatness[x3e,x2e],y3e)
  ..z3e..controls (flatness[x3e,x4e],y3e) and (x4e,y3e)..z4e..z5e;
  penlabels(1,2,3,4,5);
enddef;

beginchar(bold_cap,12u#+2appr#,x_height#,0);
  "Bold cap";
  tmp_program(stem,down,0.8u);
endchar;

beginchar(bold_cup,12u#+2appr#,x_height#,0);
  "Bold cup";
  tmp_program(stem,up,0.8u);
endchar;

%
%  V
%

beginchar(wedge_sign,12u#+2appr#,x_height#,0);
  "Wedge sign";
  pickup tiny.nib;
  top y2r=x_height+o; bot y1r=0; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=hround((y2r-y1r)/sqrt3);
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  filldraw stroke z1e--z2e--z3e; penlabels(1,2,3);
endchar;

beginchar(vee_sign,12u#+2appr#,x_height#,0);
  "Vee sign";
  pickup tiny.nib;
  bot y2r=-o; top y1r=x_height; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=-hround((y2r-y1r)/sqrt3);
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  filldraw stroke z3e--z2e--z1e; penlabels(1,2,3);
endchar;

beginchar(wedge_eq,12u#+2appr#,x_height#,0);
  "Wedge-bar sign";
  pickup tiny.nib;
  top y2r=x_height; bot y1r=0; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=hround((y2r-y1r+o)/sqrt3);% see wedge sign (+o)
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  pos4(rth,90); pos5(rth,90); y4r=y5r=y2r;
  lft x4=min(Appr,lft x1r); x5-x3r=x1r-x4;
  filldraw stroke z1e--z2e--z3e; filldraw stroke z4e..z5e;
  penlabels(1,2,3,4,5);
endchar;

beginchar(vee_eq,12u#+2appr#,x_height#,0);
  "Vee-bar sign";
  pickup tiny.nib;
  bot y2r=0; top y1r=x_height; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=-hround((y2r-y1r-o)/sqrt3);% see vee sign (-o)
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  pos4(rth,-90); pos5(rth,-90); y4r=y5r=y2r;
  rt x4=max(w-Appr,rt x1r); x5-x3r=x1r-x4;
  filldraw stroke z3e--z2e--z1e; filldraw stroke z4e..z5e;
  penlabels(1,2,3,4,5);
endchar;

beginchar(wedge_eqq,12u#+2appr#,asc_height#,0);% strange choice
  "Wedge-equal sign";
  pickup tiny.nib;
  top y2r=x_height; bot y1r=0; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=hround((y2r-y1r+o)/sqrt3);% see wedge sign (+o)
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  pos4(rth,90); pos5(rth,90); pos6(rth,90); pos7(rth,90);
  y4r=y5r=y2r; y6=y7=y4+spread1;
  lft x4=min(Appr,lft x1r); x5-x3r=x1r-x4; x4=x6; x5=x7;
  filldraw stroke z1e--z2e--z3e; filldraw stroke z4e..z5e;
  filldraw stroke z6e..z7e; penlabels(1,2,3,4,5,6,7);
endchar;

beginchar(vee_eqq,12u#+2appr#,asc_height#,0);% strange choice
  "Vee-equal sign";
  pickup tiny.nib;
  bot y2r=0+spread1; top y1r=x_height+spread1; y1r=y1l=y3r=y3l;
  x2r=good.x 0.5w;
  x3r-x2r=x2r-x1r=-hround((y2r-y1r-o)/sqrt3);% see vee sign (-o)
  x1l-x1r=diag_width(rth-tiny,z2r-z1r);
  x3r-x3l=diag_width(rth-tiny,z2r-z3r);
  z2l-z1l=whatever*(z2r-z1r); z2l-z3l=whatever*(z2r-z3r);
  pos4(rth,-90); pos5(rth,-90); pos6(rth,-90); pos7(rth,-90);
  y4r=y5r=y2r; y6=y7=y4-spread1;
  rt x4=max(w-Appr,rt x1r); x5-x3r=x1r-x4; x4=x6; x5=x7;
  filldraw stroke z3e--z2e--z1e; filldraw stroke z4e..z5e;
  filldraw stroke z6e..z7e; penlabels(1,2,3,4,5,6,7);
endchar;

beginchar(wedge_curly,12u#+2appr#,x_height#,0);
  "Curly wedge sign";
  pickup tiny.nib;
  x2=hround 0.5(w-rth)+0.5rth;
  top y2=h+o; pos2(rth,0); bot y1r=bot y3l=0;
  lft x1r=hround min(appr+1.0u,lft x2l-((y2r-y1r)/sqrt3));
  x3l-x2r=x2l-x1r; x1l=x1r; x3l=x3r;
  x4=x2; pos4(rth,0); y4=0.625[y2,y1r];
  y1l-y1r=y3r-y3l=(rth-tiny)/cosd angle(z4r-z1r);
  filldraw stroke z2e{down}...z1e{z1r-z4r};
  filldraw stroke z2e{down}...z3e{z3l-z4l};
  penlabels(1,2,3,4);
endchar;

beginchar(vee_curly,12u#+2appr#,x_height#,0);
  "Curly vee sign";
  pickup tiny.nib;
  x2=hround 0.5(w-rth)+0.5rth;
  bot y2=-o; pos2(rth,0); top y1r=top y3l=h;
  lft x1r=hround min(appr+1.0u,lft x2l+((y2r-y1r)/sqrt3));
  x1l=x1r; x3l=x3r; x3l-x2r=x2l-x1r;
  x4=x2; pos4(rth,0); y4=0.625[y2,y1r];
  y1r-y1l=y3l-y3r=(rth-tiny)/cosd angle(z4r-z1r);
  filldraw stroke z2e{up}...z1e{z1r-z4r};
  filldraw stroke z2e{up}...z3e{z3l-z4l};
  penlabels(1,2,3,4);
endchar;

beginchar(double_cap_sign,
    12u#+2appr#,cap_height#,0);% maybe too high
  "Double cap sign";
  pickup tiny.nib;
  pos1(rth,180); pos2(rth,180);
  pos4(rth,0); pos5(rth,0);
  pos6(rth,180); pos7(rth,180);
  pos9(rth,0); pos10(rth,0);
  rt x1l=w-appr; lft x5l=appr;
  numeric a; a=min(spread1,0.25(x1-x5));
  x1=x2; x4=x5; x6=x7; x9=x10; x3=x8=0.5[x1,x5];
  x1-x6=x10-x5=hround a;
  bot y1=bot y5=-d-o; bot y6=bot y10=-d;
  y3+0.5rth=h+o; y8-y3=-vround a;
  y2=y4=y7=y9=1/3[y8,y6];
  filldraw stroke z1e..z2e; filldraw stroke z4e..z5e;
  filldraw stroke z6e..z7e; filldraw stroke z9e..z10e;
  pickup rule.nib; autorounded;
  draw z2 up_to_right z3 right_to_down z4;
  draw z7 up_to_right z8 right_to_down z9;  
  penlabels(1,2,3,4,5,6,7,8,9,10);
endchar;

beginchar(double_cup_sign,
    12u#+2appr#,cap_height#,0);% maybe too high
  "Double cup sign";
  pickup tiny.nib;
  pos1(rth,0); pos2(rth,0);
  pos4(rth,180); pos5(rth,180);
  pos6(rth,0); pos7(rth,0);
  pos9(rth,180); pos10(rth,180);
  rt x1r=w-appr; lft x5r=appr;
  numeric a; a=min(spread1,0.25(x1-x5));
  x1=x2; x4=x5; x6=x7; x9=x10; x3=x8=0.5[x1,x5];
  x1-x6=x10-x5=hround a;
  top y1=top y5=h+o; top y6=top y10=h;
  y3-0.5rth=-d-o; y8-y3=vround a;
  y2=y4=y7=y9=1/3[y8,y6];
  filldraw stroke z1e..z2e; filldraw stroke z4e..z5e;
  filldraw stroke z6e..z7e; filldraw stroke z9e..z10e;
  pickup rule.nib; autorounded;
  draw z2 down_to_right z3 right_to_up z4;
  draw z7 down_to_right z8 right_to_up z9;
  penlabels(1,2,3,4,5,6,7,8,9,10);
endchar;

beginchar(double_sqcap_sign,
    12u#+2appr#,cap_height#,0);% maybe too high
  "Double square cap sign";
  pickup tiny.nib;
  pos1(rth,180); pos3(rth,90); pos5(rth,0);
  pos6(rth,180); pos8(rth,90); pos10(rth,0);
  lft x1r=appr; rt x5r=w-appr;
  numeric a; a=min(spread1,0.25(x5-x1));
  x6-x1=x5-x10=hround a; x3=x8=0.5[x1,x5];
  bot y1=bot y5=-d-o; bot y6=bot y10=-d;
  top y3r=h; y8-y3=-vround a;
  forsuffixes $=,r,l:
    x1$=x2$; x4$=x5$; x6$=x7$; x9$=x10$;
    y2$=y3$=y4$; y7$=y8$=y9$; endfor
  filldraw stroke z1e--z2e--z4e--z5e;
  filldraw stroke z6e--z7e--z9e--z10e;
  penlabels(1,2,3,4,5,6,7,8,9,10);
endchar;

beginchar(double_sqcup_sign,
    12u#+2appr#,cap_height#,0);% maybe too high
  "Double square cup sign";
  pickup tiny.nib;
  pos1(rth,0); pos3(rth,90); pos5(rth,180);
  pos6(rth,0); pos8(rth,90); pos10(rth,180);
  lft x1l=appr; rt x5l=w-appr;
  numeric a; a=min(spread1,0.25(x5-x1));
  x6-x1=x5-x10=hround a; x3=x8=0.5[x1,x5];
  top y1=top y5=h+o; top y6=top y10=h;
  bot y3l=0; y8-y3=vround a;
  forsuffixes $=,r,l:
    x1$=x2$; x4$=x5$; x6$=x7$; x9$=x10$;
    y2$=y3$=y4$; y7$=y8$=y9$; endfor
  filldraw stroke z1e--z2e--z4e--z5e;
  filldraw stroke z6e--z7e--z9e--z10e;
  penlabels(1,2,3,4,5,6,7,8,9,10);
endchar;



