% blackboard typefaces by Anthony Phan.
% file: mbbgrkup.mf (Greek uppercase)
% last modification: 25.10.2001.

% One can choose to generate only Greek uppercase letters 
% which are different from latin (don't define the others' codes).
% Some Greek-like symbols, defined at the end, obey the same rule.

def horizontal_rules_list=0.4h,0.5h,0.6h,
  -body_depth,-desc_depth,cap_height,asc_height,body_height
enddef;

use_rule2;

iff known bbAlpha:
beginchar(bbAlpha,11.5u#+2appr#,cap_height#,0);
  "Uppercase Greek Alpha";
  % no italic correction
  complete_AV(1,apprl-0.5u,w-apprr+0.5u);
  pickup circle.nib;
  z11=whatever[z1,z2];
  z12=whatever[z5,z6];
  bot y11=bot y12=vround 0.25h;
  draw z11..z12;
  labels(11,12);
  math_fit(0,0);
endchar;

iff known bbBeta:
beginchar(bbBeta,10.15u#+Appr#+appr#,cap_height#,0);
  "Uppercase Greek Beta";
  italcorr 0.8cap_height#*slant-0.85u#;
  pickup circle.nib; bot y4=vround 0.5h;
  lft x1=lft x9=Apprl; x2=x4=0.56[x1,x3];
  rt x3=w-apprr-hround 0.35u;
  x6=x8=0.56[x1,x7]; rt x7=w-apprr; x5=x10=x11=x1+hthick;
  top y1=top y2=top y11=h; y4=y5=y6; y3=0.5[y2,y4];
  y7=0.5[y6,y8]; bot y8=bot y9=bot y10=0;
  x12=max(x7-hThick,x6); x14=min(x12,x3);
  tmp_path:=z1..z2 right_to_down z3 down_to_left z4..z5
  &z5..z6 right_to_down z7 down_to_left z8..z9;
  draw tmp_path; draw z10..z11;
  bbbowl(z6,z7,z8,hThick) tmp_path;
  bbbowl(z2,z3,z4,max(0,x3-x.bowl.mid)) tmp_path;
  pickup square.nib; draw z1..z9;
  labels(1,2,3,4,5,6,7,8,9,10,11);
  math_fit(0,0.3cap_height#*slant);
endchar;

beginchar(bbGamma,7.5u#+Appr#+appr#,cap_height#,0);
  "Uppercase Greek Gamma";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib; rt x1=w-apprr; lft x2=lft x3=Apprl;
  x4=x5=x3+hthick; top y1=top y2=top y5=h; bot y3=bot y4=0;
  pickup square.nib; draw z1--z2--z3--z4--z5;
  labels(1,2,3,4,5);
  math_fit(0,max(0.5cap_height#*slant-0.7u#,0));
endchar;

beginchar(bbDelta,13u#+2appr#,cap_height#,0);
  "Uppercase Greek Delta";
  % no italic correction
  complete_AV(1,apprl-0.5u,w-apprr+0.5u);
  y1a-y1=thin; z1a=whatever[z1,z2];
  fill z1--z5--z5a--z1a--cycle; labels(1a);
  math_fit(0,0);
endchar;

iff known bbEpsilon:
beginchar(bbEpsilon,7.5u#+Appr#+appr#,cap_height#,0);
  "Uppercase Greek Epsilon";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib; rt x1=rt x4=w-apprr; lft x2=lft x3=Apprl;
  x5=x6=lft x7=x3+hthick; rt x8=w-apprr-hround 0.7u;
  top y1=top y2=top y6=h; bot y3=bot y4=bot y5=0;
  bot y7=bot y8=floor 0.5h; pickup square.nib;
  draw z1--z2--z3--z4; draw z5..z6; draw z7..z8;
  labels(1,2,3,4,5,6,7,8);
  math_fit(0,max(0.5cap_height#*slant-0.7u#,0));
endchar;

iff known bbZeta:
beginchar(bbZeta,10.15u#+2appr#,cap_height#,0);
  "Uppercase Greek Zeta";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;
  z1l=(apprl-hround 0.2u,0);
  z2l=(w-apprr+hround 0.2u,0);
  z3r=(apprl+hround 0.2u,h);
  z4r=(w-apprr,h);
  penpos1(thin,90); penpos2(thin,90);
  penpos3(thin,90); penpos4(thin,90);
  z5l=z1r; z8r=z4l;
  adjust_slanted_bar(5l,8r,6r,7l)(thick+thin,-1);
  a:=diag_width(thin,z8r-z6r);
  penpos5(a,0); penpos6(a,0); penpos7(a,0); penpos8(a,0);
  penstroke z1e..z2e; penstroke z3e..z4e;
  penstroke z5e..z7e; penstroke z6e..z8e; 
  penlabels(1,2,3,4,5,6,7,8);
  math_fit(0,0.5cap_height#*slant);
endchar;

iff known bbEta:
beginchar(bbEta,11u#+2Appr#,cap_height#,0);
  "Uppercase Greek Eta";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;  
  lft x1=lft x3=Apprl; rt x5=rt x7=w-Apprr;
  x7-x8=x5-x6=x4-x3=x2-x1=hthick;
  bot y1=0; top y3=h; y1=y2=y5=y6; y3=y4=y7=y8;
  bot y9=bot y10=floor 0.5h; lft x9=x2; rt x10=x6;
  draw z9..z10; pickup square.nib; draw z1--z2--z4--z3--cycle;
  draw z5--z6--z8--z7--cycle; labels(1,2,3,4,5,6,7,8,9,10);
  math_fit(0,0.5ic#);
endchar;

beginchar(bbTheta,13u#+2appr#,cap_height#,0);
  "Uppercase Greek Theta";
  italcorr 0.6cap_height#*slant-0.5u#;
  pickup circle.nib;
  bbcircle1(apprl,w-apprr,h+o,-o);
  draw last_path;
  bbbowl(z1b,z1a,z1d,hThick) last_path;
  lft x.bowl.top-rt x2=hround u; 
  bbbowl(z1b,z1c,z1d,hThick) last_path;
  lft x3-rt x.bowl.top=hround u; 
  y2=y3=good.y 0.5h;
  pickup square.nib; draw z2..z3;
  penlabels(2,3);  
  math_fit(-0.4cap_height#*slant,ic#);
endchar;

iff known bbIota:
beginchar(bbIota,hthick#+thin#+2Appr#,cap_height#,0);
  "Uppercase Greek Iota";
  italcorr cap_height#*slant-u#;
  center_bar(1,2) x1=x3; x2=x4;
  bot y1=bot y2=0; top y3=top y4=h; pickup square.nib;
  draw z1--z2--z4--z3--cycle; labels(1,2,3,4);
  math_fit(0,0.5ic#);
endchar;

iff known bbKappa:
beginchar(bbKappa,11.5u#+Appr#+appr#,cap_height#,0);
  "Uppercase Greek Kappa";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;
  lft x1=lft x3=Apprl; x2-x1=hthick; x4=x5=x2;
  bot y1=0; y2=y1; top y3=h; y4=y3;
  x6r=w-apprr; y6r=h; y5=0.4h;
  adjust_slanted_bar(5,6r,5a,6)(0.5thin,-1);
  z6-z6l=z6r-z6; ortho_penpos5(thin,z6-z5);
  z7=(w-apprr,0); top z8b=(0.78[x3,x4],h);
  adjust_slanted_bar(8b,7,7b,8)(thick,1);
  z9=whatever[z5,z6]; z9=whatever[z7,z7b];
  z10=whatever[z5,z6]; z10=whatever[z8,z8b];
  y7a-y7=y8a-y8=thin; z7a=whatever[z7,z7b]; z8a=whatever[z8,z8b];
  penpos7(diag_width(thin,z7b-z7),0);
  penpos8(diag_width(thin,z8b-z8),0);
  ortho_penpos9(thin, z7b-z7); ortho_penpos10(thin, z8b-z8);
  pickup square.nib; draw z1--z2--z4--z3--cycle;
  penstroke z5e..z6e; penstroke z7e..z9e; penstroke z8e..z10e;
  fill z7--z8--z8a--z7a--cycle;
  labels(1,2,3,4,5a,7a,7b,8a,8b); penlabels(5,6,7,8,9,10);
  math_fit(0,0);
endchar;

beginchar(bbLambda,11.5u#+2appr#,cap_height#,0);
  "Uppercase Greek Lambda";
  % no italic correction
  complete_AV(1,apprl-0.5u,w-apprr+0.5u);
  math_fit(0,0);
endchar;

iff known bbMu:
beginchar(bbMu,14u#+2Appr#,cap_height#,0);
  "Uppercase Greek Mu";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;
  bot y1=0; y1=y6=y7=y11=y12; top y2=h; y2=y3=y9=y10;
  lft x1=lft x2=Apprl; rt x10=rt x11=w-Apprr;
  x10-x9=x11-x12=x7-x6=x3-x2=hthick; x6-x1=x12-x7;
  y6r=y7r=0; y2l=y3l=y8l=h;
  y2l-y2r=y3l-y3r=y6l-y6r=y7l-y7r=thin;
  x2l=x2r=x2; x8l=lft x9;
  adjust_slanted_bar(6,3,4',5')(thick,-1);
  adjust_slanted_bar(7,8l,7',8')(0.5thin,1);
  if x4'>x7:
    z4=whatever[z3,z4']; z4=whatever[z7,z8']; 
    z5=whatever[z1,z2]; z5=whatever[z6,z5'];
  else: z4=z4'; z5=z5'; fi
  ortho_penpos4(thin,z4'-z3);
  ortho_penpos5(thin,z6-z5');
  ortho_penpos8(thin,z8'-z7);
  forsuffixes $=r,l:
    z3$-z4$=whatever*(z3-z4);
    z7$-z8$=whatever*(z7-z8);
    z6$-z5$=whatever*(z6-z5);
  endfor;
  penstroke z2e--z3e--z4e; penstroke z5e--z6e--z7e--z8e;
  pickup square.nib; draw z1..z2; draw z9--z10--z11--z12--cycle;
  penlabels(2,3,4,5,6,7,8); labels(1,4',5',7'8',9,10,11,12);
  math_fit(0,0.5ic#);
endchar;

iff known bbNu:
beginchar(bbNu,10.7u#+2Appr#,cap_height#,0);
  "Uppercase Greek Nu";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;
  bot y1=0; y1=y6=y7; top y2=h; y2=y3=y5;
  lft x1=lft x2=Apprl; rt x5=rt x6=w-Apprr;
  x3-x2=x6-x7=hthick; penpos2(thin,-90); penpos6(thin,90);
  y3l=h; y7l=0; y3l-y3r=y7r-y7l=thin;
  adjust_slanted_bar(3,7,8a,4a)(thick,-1);
  if x8a>x2: z8=z8a; else: x8=x2; z8=whatever[z7,z8a]; fi
  if x4a<x6: z4=z4a; else: x4=x6; z4=whatever[z3,z4a]; fi
  ortho_penpos4(thin,z4-z3); ortho_penpos8(thin,z8-z7);
  z8r-z7r=whatever*(z8-z7); z8l-z7l=whatever*(z8-z7);
  z4r-z3r=whatever*(z4-z3); z4l-z3l=whatever*(z4-z3);
  penstroke z2e--z3e--z4e; penstroke z6e--z7e--z8e;
  pickup square.nib; draw z1..z2; draw z5..z6;
  labels(1,5,4a,8a); penlabels(2,3,4,6,7,8);
  math_fit(0,0.5ic#);
endchar;

iff known bbOmicron:
beginchar(bbOmicron,13u#+2appr#,cap_height#,0);
  "Uppercase Greek Omicron";
  italcorr 0.6cap_height#*slant-0.5u#;
  pickup circle.nib;
  bbcircle1(apprl,w-apprr,h+o,-o);
  draw last_path;
  bbbowl(z1b,z1a,z1d,hThick) last_path;
  bbbowl(z1b,z1c,z1d,hThick) last_path;
  math_fit(-0.4cap_height#*slant,ic#);
endchar;

beginchar(bbPi,11u#+2Appr#,cap_height#,0);
  "Uppercase Greek Pi";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;  
  lft x3=Apprl; bot y3=-d; top y4=h; x4=x3; x1=x2=x3+hthick; 
  y2=y7=y6=y3; y1=y8=y5=y4; rt x6=w-Apprr; x5=x6; x7=x8=x6-hthick;
  pickup square.nib; draw z1--z2--z3--z4--z5--z6--z7--z8;
  labels(1,2,3,4,5,6,7,8);
  math_fit(0,0.5ic#);
endchar;

iff known bbRho:
beginchar(bbRho,10.15u#+Appr#+appr#,cap_height#,0);
  "Uppercase Greek Rho";
  italcorr 0.8cap_height#*slant-0.5u#;
  pickup circle.nib;
  lft x1=lft x3=Apprl; rt x6=w-apprr; x2-x1=x4-x3=hthick;
  x5=0.50[x1,x6]; x7=0.50[x1,x6]; x8=x2;
  bot y1=bot y2=0; top y3=top y4=top y5=h;
  bot y7=bot y8=vround 0.4h; y6=0.5[y5,y7];
  tmp_path:=z3..z5 right_to_down z6 down_to_left z7..z8;
  draw tmp_path;
  bbbowl(z5,z6,z7,hThick) tmp_path;
  pickup square.nib; draw z4--z2--z1--z3;
  labels(1,2,3,4,5,6,7,8);
  math_fit(0,0.4cap_height#*slant-u#);
endchar;

beginchar(bbXi,11u#+2appr#,cap_height#,0);
  "Uppercase Greek Xi";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;
  lft x1=apprl; top y1=h; rt x2=w-apprr; y2=y1; bot y3=0; x3=x1;
  x4=x2; y4=y3; bot y5=bot y6=floor 0.5h;
  lft x5-apprl=w-apprr-rt x6=hround u;
  pickup square.nib; draw z1..z2; draw z3..z4; draw z5..z6;
  labels(1,2,3,4,5,6);  
  math_fit(0,0);
endchar;

beginchar(bbSigma,11.5u#+2appr#,cap_height#,0);
  "Uppercase Greek Sigma";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;  
  x1=x3=w-apprr; top y1=h; y2=y1; x2=x4=apprl; bot y3=0; y4=y3;
  penpos1(thin,90); penpos2(thin,90);
  penpos3(thin,90); penpos4(thin,90);
  z0=(floor(2/3[x2,x1])+0.5,floor(h/2)+0.5);
  z5l=z4r; z6r=z0; adjust_slanted_bar(5l,6r,5r,7)(thin,-1);
  z8l=z2l; z11r=z0; adjust_slanted_bar(8l,11r,9r,12)(thin+thick,1);
  z6l=whatever[z5l,z7]; z6l=whatever[z9r,z11r];
  a:=diag_width(thin,z9r-z11r);
  penpos8(a,0); penpos9(a,0);
  z10l=whatever[z8l,z12]; z10l=whatever[0.5[z5l,z5r],0.5[z6l,z6r]];
  z10r=z8r+whatever*(z8l-z12); z10r=whatever[0.5[z5l,z5r],0.5[z6l,z6r]];
  z11l=z9l+whatever*(z8l-z12); z11l=whatever[z5r,z6r];
  penstroke z1e..z2e; penstroke z3e..z4e; penstroke z5e..z6e;
  penstroke z8e..z10e; penstroke z9e..z11e;
  penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12);
  math_fit(0,0);
endchar;

iff known bbTau:
beginchar(bbTau,10.2u#+2appr#,cap_height#,0);
  "Uppercase Greek Tau";
  italcorr cap_height#*slant;
  center_bar(1,2); bot y1=bot y2=0; top y5=top y6=h;
  lft x5=apprl-hround 0.5u; rt x6=w-apprr+hround 0.5u;
  z3=(x1,y5); z4=(x2,y5); pickup square.nib;
  draw z5..z6; draw z3--z1--z2--z4; labels(1,2,3,4,5,6);
  math_fit(-0.5cap_height#*slant,
    cap_height#*slant-2.5u#);
endchar;

iff known bbUpsilon:  
beginchar(bbUpsilon,11u#+2appr#,cap_height#,0);
  "Uppercase Greek Upsilon"; 
  italcorr cap_height#*slant; 
  center_bar(6,3); x3=x4; x5=x6;
  lft x1=apprl-hround 0.5u; rt x9=w-apprr+hround 0.5u;
  x7=0.15[x1,x6]; x8=0.15[x9,x3]; x3-x2=x5-x7;
  bot y4=bot y5=0; y3=y6=0.6h; top y1=h;
  y1=y2=y7=y8=y9;
  draw z1..z2 right_to_down z3..z4;
  draw z1..z7 right_to_down z6..z5;
  draw z9..z8 left_to_down z3;
  pickup square.nib; draw z4..z5;
  square_end1(left);
  square_end9(right);
  labels(1,2,3,4,5,6,7,8,9);  
  math_fit(-0.5cap_height#*slant+0.5u#,cap_height#*slant-2.5u#);
endchar;

% a modifier
iff known bbvarUpsilon:
beginchar(bbvarUpsilon,10.2u#+2appr#,cap_height#,0);
  "Uppercase Greek variant Upsilon"; 
  italcorr cap_height#*slant-0.5u#;
  center_bar(3,4); bot y3=bot y4=-d;
  x3l=apprl+hround(0.5(w-apprr-apprl-hthick-thin*(1++slant)));
  x4l-x3l=hround(hthick+thin*(1++slant));
  x3r-x3l=x4l-x4r=thin*(1++slant);
  y4l=y3l=-d; y3r-y3l=y4r-y4l=thin;
  y1=y6=y7r=h; x1=apprl; x7r=w-apprr;
  x2=x3; y2=y5a=0.5h; x6-x1=x5a-x2=diag_width(thick,z1-z2);
  a:=diag_width(thin,z1-z2);
  penpos1(a,0); penpos6(a,180); z8=z5;
  forsuffixes $=,r,l: x5$=x4$; z5$-z6$=whatever*(z2-z1); endfor
  forsuffixes $=r,l: x2$=x3$; z2$-z1$=whatever*(z2-z1); endfor
  y1-y1a=y6-y6a=thin; z1a=whatever[z1,z2]; z6a=whatever[z6,z5a];
  adjust_slanted_bar(7r,8,7,8a)(0.5thin,-1); z7-z7l=z7r-z7;
  ortho_penpos8(thin,z7-z8);
  penstroke z1e--z2e--z3e--z4e--z5e--z6e;
  fill z1--z6--z6a--z1a--cycle; penstroke z7e..z8e;
  penlabels(1,2,3,4,5,6,7,8,9,10); labels(1a,5a,6a,8a);
  math_fit(0,0);
endchar;

beginchar(bbPhi,13u#+2appr#,cap_height#,0);
  "Uppercase Greek Phi";
  italcorr 0.6cap_height#*slant-0.5u#;
  center_bar(1,2); x1=x3; x2=x4;
  lft x6=apprl; rt x9=w-apprr; x5=x7=x1; x8=x10=x2;
  bot y1=bot y2=0; top y3=top y4=h; y6=y9=0.5[y5,y7];
  top y7=top y10=vround(0.85h); bot y5=bot y8=vround(0.15h);
  tmp_path:=z5 left_to_up z6 up_to_right z7;
  tmpp_path:=z8 right_to_up z9 up_to_left z10;
  draw tmp_path; draw tmpp_path;
  bbbowl(z7,z6,z5,hThick) tmp_path;
  bbbowl(z10,z9,z8,hThick) tmpp_path;
  pickup square.nib; draw z1--z2--z4--z3--cycle;
  labels(1,2,3,4,5,6,7,8,9,10);
  math_fit(0,0);
endchar;

iff known bbChi:
beginchar(bbChi,12u#+2appr#,cap_height#,0);
  "Uppercase Greek Chi";
  italcorr cap_height#*slant-0.5u#;
  complete_X(0.375u);
  math_fit(0,0);
endchar;

beginchar(bbPsi,12u#+2appr#,cap_height#,0);
  "Uppercase Greek Psi";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;
  center_bar(1,2); x5=x3=x1; x9=x4=x2;
  lft x6=lft x7=apprl; rt x10=rt x11=w-apprr;
  bot y1=bot y2=0; top y3=h; y3=y4=y7=y11;
  bot y5=bot y9=vround 0.3h; y6=y10=0.5[y5,y7];
  tmp_path:=z5 left_to_up z6..z7;
  tmpp_path:=z9 right_to_up z10..z11;
  draw tmp_path; draw tmpp_path;
  hbbowl(z5,z6,z7,hthick) tmp_path; z8=z.bowl.bot;
  hbbowl(z9,z10,z11,hthick) tmpp_path; z12=z.bowl.bot;
  pickup square.nib; draw z1--z2--z4--z3--cycle;
  draw z7..z8; draw z11..z12;
  labels(1,2,3,4,5,6,7,8,9,10,11,12);  
  math_fit(0,0);
endchar;

beginchar(bbOmega,13u#+2appr#,cap_height#,0);
  "Uppercase Greek Omega";
  italcorr 0.6cap_height#*slant-0.5u#;
  pickup circle.nib;
  z0=(-20u,h);
  y1l=y2l=y11l=y10l=0;
  x1l-apprl=w-apprr-x11l=hround 0.8u;
  x2l-x1l=x11l-x10l=ceiling 4.1u;
  penpos1(thin,90); penpos2(thin,90);
  penpos10(thin,90); penpos11(thin,90);
  z3r=z2r; z9l=z10r;
  lft x5=apprl; rt x7=w-apprr; x6=0.5[x5,x7];
  top y6=h+o;
  ortho_penpos3(thin,z0); ortho_penpos9(thin,(-x0,y0));
  ortho_penpos4(thin,z0); ortho_penpos8(thin,(-x0,y0));
  slope:=y0/x0; ellipse_set(6,5,4,3);
  slope:=-y0/x0; ellipse_set(6,7,8,9);
  tmp_path:= z4{z0}...z5 up_to_right z6
  right_to_down z7...{x0,-y0}z8;
  x12-x5=x7-x14=hThick;
  if x12>x4: z12=whatever[z3,z4];
  else: z12=tmp_path intersectionpoint ((x12,y1)..(x12,y5)); fi
  if x14<x8: z14=whatever[z8,z9];
  else: z14=tmp_path intersectionpoint ((x14,y11)..(x14,y7)); fi
  z13=tmp_path intersectionpoint ((x12,y5)..(x12,y6));
  z15=tmp_path intersectionpoint ((x14,y7)..(x14,y6));
  draw tmp_path; draw z12..z13; draw z14..z15;
  penstroke z1e..z2e; penstroke z3e..z4e;
  penstroke z8e..z9e; penstroke z10e..z11e;
  penlabels(1,2,3,4,8,9,10,11); labels(5,6,,7,12,13,14,15);
  math_fit(0,0);
endchar;

% Ionian extension
% (Carl B. Boyer, ``A History of Mathematics'';
% Yannis Haralambous and Claus Thull,
% ``Typesetting Modern Greek with 128 Character Codes''.)

iff known bbDigamma:
beginchar(bbDigamma,7.5u#+Appr#+appr#,cap_height#,0);
  "Uppercase Ionian Digamma";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib; rt x1=w-apprr; lft x2=lft x3=Apprl;
  x4=x5=x3+hthick; lft x6=x4; rt x7=w-apprr-hround 0.7u;
  top y1=top y2=top y5=h; bot y3=bot y4=0;
  y6=y7=good.y 0.5h; pickup square.nib;
  draw z1--z2--z3--z4--z5; draw z6..z7;
  labels(1,2,3,4,5,6,7);
  math_fit(0,max(0.5cap_height#*slant-0.7u#,0));
endchar;

iff known bbKoppa:
beginchar(bbKoppa,10.15u#+Appr#+appr#,cap_height#,0);
  "Uppercase Ionian Koppa";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;
  rt x1=rt x3=w-Apprr; lft x6=apprl; x2-x1=x4-x3=-hthick;
  x5=0.5[x1,x6]; x7=0.5[x1,x6]; x8=x2;
  bot y1=bot y2=0; top y3=top y4=top y5=h;
  bot y7=bot y8=vround 0.4h; y6=0.5[y5,y7];
  tmp_path:=z3..z5 right_to_down z6 down_to_left z7..z8;
  draw tmp_path;
  bbbowl(z5,z6,z7,hThick) tmp_path;
  pickup square.nib;
  draw z4--z2--z1--z3; labels(1,2,3,4,5,6,7,8);
  math_fit(-0.5cap_height#*slant,0.5ic#);
endchar;

iff known bbSampi:
beginchar(bbSampi,13u#+2appr#,cap_height#,0);
  "Uppercase Ionian Sampi";
  % no italic correction
  complete_AV(1,apprl-0.5u,w-apprr+0.5u);
  z7=0.5[z5,z2]; z8=0.5[z5,z1];
  penpos8(diag_width(thin,z7-z8),0);
  z7l=whatever[z2,z5]; z7r=whatever[z2,z5];
  z7l-z8l=whatever*(z7-z8); z7r-z8r=whatever*(z7-z8);
  penstroke z7e..z8e; penlabels(7,8);
  math_fit(0,0);
endchar;

% Esoteric characters based on Greek designs.

% I've meet the following character in:
% Rogers (L. C. G.), Williams (D.),
% "Diffusions, Markov Processes and Martingales",
% Vol. 1, 2nd Edition, Wiley (1994), p. 74--77
% (very good book),
% where it appears in Times roman or Times greek.
% I suppose it's the Greek version of the dollar sign.

iff known bbslash_Sigma:
beginchar(bbslash_Sigma,11.5u#+2appr#,
    cap_height#+0.5desc_depth#,0.5desc_depth#);
  "The slashed letter Sigma";
  italcorr cap_height#*slant-0.5u#;
  pickup circle.nib;
  x1=x3=w-apprr; top y1=cap_height; y2=y1;
  x2=x4=apprl; bot y3=0; y4=y3;
  penpos1(thin,90); penpos2(thin,90);
  penpos3(thin,90); penpos4(thin,90);
  z0=(floor(2/3[x2,x1])+0.5,floor(0.5cap_height)+0.5);
  z5l=z4r; z6r=z0; adjust_slanted_bar(5l,6r,5r,7)(thin,-1);
  z8l=z2l; z11r=z0; adjust_slanted_bar(8l,11r,9r,12)(thin+thick,1);
  z6l=whatever[z5l,z7]; z6l=whatever[z9r,z11r];
  z5=0.5[z5l,z5r];
  a:=diag_width(thin,z9r-z11r);
  penpos8(a,0); penpos9(a,0);
  z10l=whatever[z8l,z12]; z10l=whatever[0.5[z5l,z5r],0.5[z6l,z6r]];
  z10r=z8r+whatever*(z8l-z12); z10r=whatever[0.5[z5l,z5r],0.5[z6l,z6r]];
  z11l=z9l+whatever*(z8l-z12); z11l=whatever[z5r,z6r];
  penstroke z1e..z2e; penstroke z3e..z4e; penstroke z5e..z6e;
  penstroke z8e..z10e; penstroke z9e..z11e;
  x13=x14=x15=x16=good.x 0.5[x1,x2];
  top y13=h; bot y16=-d; z15=whatever[z5,0.5[z0,z6l]];
  if x9>x14: y14=y1; else: z14=whatever[z9,0.5[z0,z11l]]; fi
  draw z13..z14; draw z15..z16;
  square_end13(up); square_end16(down);
  penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
  math_fit(0,0);
endchar;

iff known bbnabla:
beginchar(bbnabla,13u#+2appr#,cap_height#,0);
  "Uppercase Greek nabla";
  italcorr cap_height#*slant;
  complete_AV(-1,apprl-0.5u,w-apprr+0.5u);
  y1-y1a=thin; z1a=whatever[z1,z2];
  fill z1--z5--z5a--z1a--cycle; labels(1a);
  math_fit(-0.5cap_height#*slant,cap_height#*slant-2.25u#);
endchar;

iff known bbslash_nabla:
beginchar(bbslash_nabla,13u#+2appr#,
    cap_height#+0.5desc_depth#,0.5desc_depth#);
  "Uppercase Greek slash nabla";
  italcorr cap_height#*slant;
  begingroup save h,d; h=cap_height; d=0;
    complete_AV(-1,apprl-0.5u,w-apprr+0.5u);
  endgroup;
  y1-y1a=thin; z1a=whatever[z1,z2];
  fill z1--z5--z5a--z1a--cycle;
  z7'=1/3[z1r,z5l]; y7=-d; y10=h; z7'-z7=whatever*(z1-z2);
  z10-z7=whatever*(z1-z2);
  forsuffixes $=r,l:
    z7$-z7=z10$-z10=z1$-z1;
    z8$=whatever[z7$,z10$]; z8$=whatever[z3,z4];
    z9$=whatever[z7$,z10$]; z9$=whatever[z2,z5];
  endfor
  penstroke z7e..z8e; penstroke z9e..z10e;
  penlabels(7,8,9,10); labels(1a,7');
  math_fit(-0.5cap_height#*slant,cap_height#*slant-2.25u#);
endchar;

iff known bbcoprod:
beginchar(bbcoprod,11u#+2Appr#,cap_height#,0);
  "Coproduct symbol";
  italcorr cap_height#*slant-u#;
  pickup circle.nib;  
  lft x3=Apprl; bot y3=-d; top y4=h; x4=x3; x1=x2=x3+hthick; 
  y2=y7=y6=y3; y1=y8=y5=y4; rt x6=w-Apprr; x5=x6; x7=x8=x6-hthick;
  pickup square.nib; draw z2--z1--z4--z3--z6--z5--z8--z7;
  labels(1,2,3,4,5,6,7,8);
  math_fit(0,0.5ic#);
endchar;

iff known bbmho:
beginchar(bbmho,13u#+2appr#,cap_height#,0);
  "Uppercase Greek mho";
  italcorr cap_height#*slant-1.3u#;
  pickup circle.nib;
  z0=(20u,h);
  y1l=y2l=y11l=y10l=h;
  x1l-apprl=w-apprr-x11l=hround 0.8u;
  x2l-x1l=x11l-x10l=ceiling 4.1u;
  penpos1(thin,-90); penpos2(thin,-90);
  penpos10(thin,-90); penpos11(thin,-90);
  z3r=z2r; z9l=z10r;
  lft x5=apprl; rt x7=w-apprr; x6=0.5[x5,x7];
  bot y6=-o;
  ortho_penpos3(thin,z0); ortho_penpos9(thin,(-x0,y0));
  ortho_penpos4(thin,z0); ortho_penpos8(thin,(-x0,y0));
  slope:=y0/x0; ellipse_set(6,5,4,3);
  slope:=-y0/x0; ellipse_set(6,7,8,9);
  tmp_path:= z4{-z0}...z5 down_to_right z6
  right_to_up z7...{-x0,y0}z8;
  x12-x5=x7-x14=hThick;
  if x12>x4: z12=whatever[z3,z4];
  else: z12=tmp_path intersectionpoint ((x12,y1)..(x12,y5)); fi
  if x14<x8: z14=whatever[z8,z9];
  else: z14=tmp_path intersectionpoint ((x14,y11)..(x14,y7)); fi
  z13=tmp_path intersectionpoint ((x12,y5)..(x12,y6));
  z15=tmp_path intersectionpoint ((x14,y7)..(x14,y6));
  draw tmp_path; draw z12..z13; draw z14..z15;
  penstroke z1e..z2e; penstroke z3e..z4e;
  penstroke z8e..z9e; penstroke z10e..z11e;
  penlabels(1,2,3,4,8,9,10,11); labels(5,6,,7,12,13,14,15);
  math_fit(-0.4cap_height#*slant,ic#);
endchar;