% Computer Modern Blackboard specials:
% Was partly romand.mf and punct.mf; modified for blackboard letter
% Gilles F. ROBERT (29-03-93) v1.0
% This file contains the digits 1 and 2, together with parentheses and brackets.

% Character codes \0061, \0062, \0050, \0051, \0133 and \0135 are generated.

cmchar "The numeral 1";
beginchar("1",9u#,fig_height#,0);
italcorr fig_height#*slant-.5u#;
adjust_fit(0,0);
numeric light_stem; light_stem=hround .4[stem',cap_stem'];
pickup tiny.nib; pen_duplicate(1,2);
pos1(.5light_stem,0); pos2(.5light_stem,0);
lft x.G1l=lft x.G2l=hround(.5(w+.5u)-.5cap_stem'-.5interspace); top y1=h+o; bot y2=0;
Delta_x = hround(interspace+.5light_stem);
double filldraw stroke z1e--z2e;  % double stem
if not serifs: save slab; slab=bar; fi
dish_biserif(2,1,a,1/3,min(2.25u,lft x2l-1.5u),
  ab,1/3,
  b,1/3,min(2.25u,w-1.25u-rt x2r)); % serif
pickup crisp.nib; pos3(slab,-90); pos4(bar,-90);
top y3l=h+o; top y4l=if monospace: .8 else: .9 fi\\ h+o;
lft x4=max(1.25u,tiny.lft x.G1l-2.35u);
tiny.rt x.D1r=lft x3+.25[tiny,hair];
erase fill z3l{x4l-x3l,3(y4l-y3l)}...z4l{left}
 --(x4l,h+o+1)--(x3l,h+o+1)--cycle; % erase excess at top
filldraw stroke z3e{x4e-x3e,3(y4e-y3e)}..z4e{left};  % point
penlabels(G1,D1,G2,D2,3,4); endchar;

cmchar "The numeral 2";
beginchar("2",9u#,fig_height#,0);
italcorr fig_height#*slant-.5u#;
adjust_fit(0,0);
numeric arm_thickness, hair_vair; hair_vair=.25[vair,hair];
arm_thickness=Vround(if hefty:slab+2stem_corr else:.4[stem,cap_stem] fi);
pickup crisp.nib; pos7(arm_thickness,-90); pos8(hair,0);
bot y7r=0; lft x7=hround .9u; rt x8r=hround(w-.9u); y8=good.y(y7l+beak/2)+eps;
arm(7,8,a,.3beak_darkness,beak_jut);  % arm and beak
pickup fine.nib; pos2(slab,90); pos3(.4[.5curve,.5cap_curve],0);
pen_duplicate(3);
top y2r=h+o; x2=.5(w-.5u); rt x.D3r=hround(w-.9u); y3+.5vair=.75h;
if serifs: numeric bulb_diam; bulb_diam=hround(flare+2/3(cap_stem-stem));
 pos0(bulb_diam,180); pos1(cap_hair,180);
 lft x1r=hround .9u; y1-.5bulb_diam=2/3h;
 (x,y2l)=whatever[z1l,z2r]; x2l:=x; bulb(2,1,0);  % bulb and arc
else: x2l:=x2l-.25u; pos1(flare,angle(-9u,h));
 lft x1r=hround .75u; bot y1l=vround .7h; y1r:=good.y y1r+eps; x1l:=good.x x1l;
 filldraw stroke term.e(2,1,left,.9,4); fi  % terminal and arc
pos4(.25[hair_vair,cap_stem],0);
pos5(hair_vair,0); pos6(hair_vair,0);
y5=arm_thickness; y4=.3[y5,y3]; top y6=min(y5,slab,top y7l);
lft x6l=crisp.lft x7; z4l=whatever[z6l,(x.D3l,bot .58h)]; z5l=whatever[z6l,z4l];
erase fill z4l--z6l--lft z6l--(lft x6l,y4l)--cycle;  % erase excess at left
filldraw stroke z2e{right}..tension atleast .9 and atleast 1
 ..z.D3e{down}.. z4e---z5e--z6e;  % stroke
Delta_x = min(hround(curve_interspace+.4[.5curve,.5cap_curve]),x.D3l-x2r);
define_upper_and_lower(G2,G4,G3,z2r{right}..tension atleast .9 and atleast 1
 ..z.D3r{down}.. z4r---z5r);
filldraw stroke z.G2e--z.G4e; % inner stroke
penlabels(0,1,2,D3,4,G2,G3,G4,5,6,7,8); endchar;

cmchar "Left parenthesis";
beginchar("(",7u# if monospace: -u# fi,body_height#,paren_depth#);
italcorr body_height#*slant-.5u#; 
adjust_fit(0,0); pickup fine.nib; pen_duplicate(2);
pos1(vair,0); pos2(.75[hair,.5stem],0); pos3(vair,0);
rt x1r=rt x3r=hround(w-u); lft x.G2l=hround(x1-cap_interspace-4u if monospace: +4/3u fi);
top y1=h; y2=.5[y1,y3]=math_axis;
filldraw stroke z1e{3(x.G2e-x1e),y2-y1}...z.G2e
 ...{3(x3e-x.G2e),y3-y2}z3e;  % arc
Delta_x = min(hround(curve_interspace+.75[hair,.5stem]),x1l-x.G2r);
define_upper_and_lower(D1,D3,D2,z1l{3(x.G2l-x1l),y2-y1}...z.G2l
 ...{3(x3l-x.G2l),y3-y2}z3l);
filldraw stroke z.D1e--z.D3e; % inner stroke
penlabels(1,G2,3,D1,D2,D3); endchar;

cmchar "Right parenthesis";
beginchar(")",7u# if monospace: -u# fi,body_height#,paren_depth#);
italcorr math_axis#*slant-.5u#; 
adjust_fit(0,0); pickup fine.nib; pen_duplicate(2);
pos1(vair,0); pos2(.75[hair,.5stem],0); pos3(vair,0);
lft x1l=lft x3l=hround u; rt x.D2r=hround(x1+cap_interspace+4u if monospace: -4/3u fi);
top y1=h; y2=.5[y1,y3]=math_axis;
filldraw stroke z1e{3(x.D2e-x1e),y2-y1}...z.D2e
 ...{3(x3e-x.D2e),y3-y2}z3e;  % arc
Delta_x = min(hround(curve_interspace+.75[hair,.5stem]),x.D2l-x1r);
define_upper_and_lower(G1,G3,G2,z1r{3(x.D2r-x1r),y2-y1}...z.D2r
 ...{3(x3r-x.D2r),y3-y2}z3r);
filldraw stroke z.G1e--z.G3e; % inner stroke
penlabels(1,D2,3,G1,G2,G3); endchar;

cmchar "Left bracket";
numeric wd#; wd#=max(5u#,4.5u#+.5if hefty:stem# else:rule_thickness# fi);
beginchar("[",wd#,body_height#,paren_depth#);
italcorr body_height#*slant;
adjust_fit(0,0); pen_duplicate(1,2);
numeric top_thickness,side_thickness;
if hefty: top_thickness=vair;
 side_thickness=max(crisp.breadth,.5stem-stem_corr);
else: top_thickness=2side_thickness=rule_thickness; fi;
pickup crisp.nib; pos1(side_thickness,0); pos2(side_thickness,0);
Delta_x = hround(interspace+side_thickness);
top y1=h; bot y2=-d; lft x.G1l=lft x.G2l=hround(2.5u-.5side_thickness)-1-eps;
double filldraw stroke z1e--z2e;  % double stem
pos3(top_thickness,90); pos4(top_thickness,90);
pos5(top_thickness,90); pos6(top_thickness,90);
x3=x5=x.G1l; rt x4=rt x6=ceiling(w-.4u)+eps; y3r=y4r=y1; y5l=y6l=y2;
filldraw stroke z3e--z4e;  % upper bar
filldraw stroke z5e--z6e;  % lower bar
penlabels(G1,D1,G2,D2,3,4,5,6); endchar;

cmchar "Right bracket";
numeric wd#; wd#=max(5u#,4.5u#+.5if hefty:stem# else:rule_thickness# fi);
beginchar("]",wd#,body_height#,paren_depth#);
italcorr body_height#*slant-2u#+.5if hefty:stem# else:rule_thickness# fi;
adjust_fit(0,0); pen_duplicate(1,2);
numeric top_thickness,side_thickness;
if hefty: top_thickness=vair;
 side_thickness=max(crisp.breadth,.5stem-stem_corr);
else: top_thickness=2side_thickness=rule_thickness; fi;
pickup crisp.nib; pos1(side_thickness,0); pos2(side_thickness,0);
Delta_x = hround(interspace+side_thickness);
top y1=h; bot y2=-d; rt x.D1r=rt x.D2r=hround(w-2.5u+.5side_thickness)+1+eps;
double filldraw stroke z1e--z2e;  % double stem
pos3(top_thickness,90); pos4(top_thickness,90);
pos5(top_thickness,90); pos6(top_thickness,90);
x3=x5=x.D1r; lft x4=lft x6=floor .4u-eps; y3r=y4r=y1; y5l=y6l=y2;
filldraw stroke z3e--z4e;  % upper bar
filldraw stroke z5e--z6e;  % lower bar
penlabels(G1,D1,G2,D2,3,4,5,6); endchar;
