% Double Stroke Roman others:
% These letters were originally coded by D. E. Knuth in November, 1979,
% inspired by the Monotype faces used in {\sl The Art of Computer Programming}.
% Sans serif designs by Richard Southall were added in April, 1982.
% The programs were revised for the new \MF\ conventions in 1985.

% This file {\tt dsromo.mf} was compiled from various Computer
% Modern sources and modified for double stroke characters by
% Olaf Kummer, 1996.
% Version 1.0

cmchar "The numeral 1";
beginchar("1",11u#,fig_height#,0);
italcorr fig_height#*slant-.5u#;
adjust_fit(0,0);
pickup tiny.nib;
pos1(cap_stem,0); pos2(cap_stem,0);
pos11(doublestroke_thin,0); pos12(doublestroke_thin,0);
lft x1l=lft x2l=w-rt x11r;
y11=y1; lft x11l=rt x1r+doublestroke_dist;
y12=y2; lft x12l=rt x2r+doublestroke_dist;
top y1=h+o; bot y2=0;
filldraw stroke z1e--z2e;  % stem
filldraw stroke z11e--z12e;  % stroke
z13=whatever[z11,z12]; z14=whatever[z1,z2];
y13=y14=top y11-slab;
fill top z11--top z1--z14--z13--cycle;  % top closure
if not serifs: save slab; slab=bar; fi
nodish_serif(2,1,a,1/3,min(2u,lft x2l-1.5u),
  b,0,min(2u,w-1.25u-rt x2r)+doublestroke_dist); % left serif
nodish_serif(12,11,c,0,min(2u,lft x2l-1.5u)+doublestroke_dist,
  d,1/3,min(2u,w-1.25u-rt x2r)); % stroke serif
pickup crisp.nib; pos3(slab,-90); pos4(bar,-90);
top y3l=h+o; top y4l=if monospace: .75 else: .85 fi\\ h+o;
lft x4=max(1u,tiny.lft x1l-2.75u);
tiny.rt x1r=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(1,2,3,4); endchar;


cmchar "A variant of letter A";
beginchar("a",14.5u#,cap_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric left_stem,right_stem,outer_jut,alpha;
right_stem=cap_stem-stem_corr;
left_stem=min(cap_hair if hefty: -3stem_corr fi,right_stem);
outer_jut=.8cap_jut; 
y11=y1=y4=0; y12=y2=y3=h+0.4*apex_o;
x11l=w-x4r=l+letter_fit+outer_jut+.5u; 
alpha=diag_ratio(2,left_stem+doublestroke_thick+doublestroke_dist,
  y2-y11,x4r-x11l-apex_corr);
penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
penpos11(alpha*doublestroke_thick,0); penpos12(alpha*doublestroke_thick,0);
x1l=x11r+alpha*doublestroke_dist;
x2l=x12r+alpha*doublestroke_dist;
x2l-x1l=x4r-x3r; 
x3r=x2r+apex_corr; 
z0=whatever[z1r,z2r]=whatever[z3l,z4l];
if y0<h-cap_notch_cut: y0:=h-cap_notch_cut;
 fill z0+.5right{down}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
  --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  ...{up}z0+.5left--cycle; % left and right diagonals
else: 
 fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
  --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
fill diag_end(12l,11l,1,1,11r,12r)
  --diag_end(11r,12r,1,1,12l,11l)--cycle; % stroke
penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
if hefty: y5r else: y5 fi =5/12y0;
y5r-y5l=y6r-y6l=cap_band; penstroke z5e--z6e; % bar line
if serifs: numeric inner_jut; pickup tiny.nib;
 prime_points_inside(1,2); prime_points_inside(4,3);
 prime_points_inside(11,12);
 if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
 else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
 nodish_serif(1',2,a,0,outer_jut+doublestroke_dist,
   b,1/2,inner_jut)(dark);  % left serif
 nodish_serif(11',12,e,1/3,outer_jut,
   f,0,inner_jut+doublestroke_dist)(dark);  % stroke serif
 nodish_serif(4',3,c,1/2,inner_jut,d,1/3,outer_jut);  % right serif
 z13=whatever[z11,z12]; x14=x2;
 y13=y14=y12-slab;
 fill z12--z2--z14--z13--cycle; fi  % top closure
penlabels(0,1,2,3,4,5,6); endchar;

cmchar "The letter h";
beginchar("h",11.25u#+doublestroke_thin#,asc_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
pickup tiny.nib; pos1(stem,0); pos2(stem,0);
pos3(stem,0); pos11(doublestroke_thin,0); pos12(doublestroke_thin,0);
lft x1l=hround(2.5u-.5stem); x1l=x2l;
lft x11l-rt x1r=lft x12l-rt x2r=doublestroke_dist; x3=w-x1;
top y1=top y11=h; bot y2=bot y12=0;
filldraw stroke z1e--z2e;  % left stem
filldraw stroke z11e--z12e;  % stroke
h_stroke(12,a,3,4);  % arch and right stem
if serifs: serif(1,2,b,1/3,-jut); % upper left serif
 serif(11,12,i,0,-jut-doublestroke_dist); % upper stroke serif
 numeric inner_jut; pickup tiny.nib;
 if rt x12r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
 else: rt x12r+jut+.5u+1=lft x4l-inner_jut; fi
 nodish_serif(2,1,c,1/3,jut,d,0,jut+doublestroke_dist); % lower left serif
 nodish_serif(12,11,g,0,jut+doublestroke_dist,h,1/3,jut); % lower left stroke serif
 nodish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
penlabels(1,2,3,4); endchar;

cmchar "The letter k";
beginchar("k",10.75u#+doublestroke_thin#,asc_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
numeric right_jut,stem[],alpha[];
stem1=stem2=max(tiny.breadth,hround(fudged.stem-stem_corr));
stem3=max(tiny.breadth,hround(fudged.hair if hefty:-\\4stem_corr fi));
stem4=max(tiny.breadth,hround(fudged.stem-3stem_corr));
if serifs: right_jut=.6jut; else: right_jut=.4tiny; fi
pos1(stem1,0); pos2(stem2,0);
pos21(doublestroke_thin,0); pos22(doublestroke_thin,0);
top y1=top y21=h; bot y2=bot y22=0;
lft x1l=lft x2l=hround(2.5u-.5stem1);
lft x21l-rt x1r=lft x22l-rt x2r=doublestroke_dist;
top y3=x_height; rt x3r=hround(r-letter_fit-.7u-right_jut)+eps;
bot y6=0; rt x6r=hround(r-letter_fit-.3u-right_jut)+eps;
x4=x11=x21; y4=.7bar_height; y11=y3;
alpha1=diag_ratio(1,.5(stem3-tiny),y3-y4,x3r-x4);
alpha2=diag_ratio(1,.5(stem4-tiny),y11-y6,x6r-x21);
penpos3(alpha1*(stem3-tiny),0); penpos4(whatever,-90);
z5=.5[z5l,z5r]; penpos6(alpha2*(stem4-tiny),0);
forsuffixes $=l,r: y3'$=x_height; y6'$=0; z4$=z3'$+whatever*(z3-z4);
 z5$=z6'$+whatever*(z11-z6)=whatever[z3,z4]; endfor
z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
% we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
z6'r=z6r+penoffset z11-z6 of currentpen+whatever*(z11-z6);
z6'l=z6l+penoffset z6-z11 of currentpen+whatever*(z11-z6);
fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % lower diagonal
filldraw stroke z1e--z2e; % stem
filldraw stroke z21e--z22e; % stroke
if serifs: numeric inner_jut;
 if rt x2r+jut+.5u+1<=lft x6l-jut: inner_jut=jut;
 else: rt x2r+inner_jut+.5u+1=lft x6l-inner_jut; fi
 serif(1,2,a,1/3,-jut); % upper stem serif
 serif(21,22,j,0,-jut-doublestroke_dist); % upper stroke serif
 nodish_serif(2,1,b,1/3,jut,c,0,inner_jut+doublestroke_dist);  % lower stem serif
 nodish_serif(22,21,h,0,jut+doublestroke_dist,i,1/3,inner_jut);  % lower stroke serif
 nodish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
 nodish_serif(6,5,f,1/2,inner_jut,g,1/3,right_jut)(dark);fi % lower diagonal serif
penlabels(0,1,2,3,4,5,6,11); endchar;





