font_coding_scheme:="The letters I, Pi, Xi";
mode_setup; font_setup;

cmchar "The letter I"; % Added serifs
beginchar("I",
	if known I_cap_jut: (cap_stem#+2I_cap_jut#+2u#),
	else: max(6u#,4u#+cap_stem#), fi
	cap_height#,0);
italcorr cap_height#*slant-.25u#;
adjust_fit(cap_serif_fit#,cap_serif_fit#);
pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
if serifs: dish_serif(1,2,a,1/3,1.05cap_jut,b,1/3,1.05cap_jut);  % upper serif
 dish_serif(2,1,c,1/3,1.05cap_jut,d,1/3,1.05cap_jut);  fi % lower serif
if known I_cap_jut: if I_cap_jut > 0:
	pos3(slab,90); pos4(slab,90);
	rt x4r=(w-u); x3=w-x4;
	top y4r = top y3r = h;
	filldraw stroke z4e--z3e;
	pos5(slab,90); pos6(slab,90);
	x5=x3; x6=x4; y5=y6; bot y5l=0;
	filldraw stroke z5e--z6e;
fi fi
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "Uppercase Greek Pi";
beginchar(oct"005",13u#+width_adj#,cap_height#,0);
italcorr 
	if hefty: cap_height#*slant
	else: cap_height#*slant-cap_serif_fit#+I_cap_jut#-2.5u#+min(.5cap_stem#,u#) fi;
adjust_fit(cap_serif_fit#,cap_serif_fit#); pickup tiny.nib;
h:=vround(h-stem_corr);
pos1(cap_stem,0); pos2(cap_stem,0); pos3(cap_stem,0); pos4(cap_stem,0);
lft x1l=lft x2l=hround if hefty: u+I_cap_jut else: max(2u,3u-.5cap_stem) fi; 
x3=x4=w-x1;
top y1=top y3=h; bot y2=bot y4=0;
filldraw stroke z1e--z2e; % left stem
filldraw stroke z3e--z4e; % right stem
penpos5(cap_bar,90); penpos6(cap_bar,90);
x5=x1; x6=x3; y5r=y6r=h;
fill stroke z5e--z6e;  % bar
if serifs: numeric inner_jut;
 if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
 else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
 nodish_serif(1,2,a,1/3,cap_jut,b,1/3,eps);  % upper left serif
 dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
 nodish_serif(3,4,e,1/3,eps,f,1/3,cap_jut);  % upper right serif
 dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut);  % lower right serif
else:
 nodish_serif(1,2,a,1/3,I_cap_jut,b,1/3,eps);  % upper left serif
 nodish_serif(3,4,e,1/3,eps,f,1/3,I_cap_jut);  % upper right serif
fi
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;

cmchar "Uppercase Greek Xi";
beginchar(oct"004",12u#,cap_height#,0);
italcorr cap_height#*slant-.35u#;
adjust_fit(0,0);
h:=vround(h-2stem_corr);
numeric shaved_stem; shaved_stem=hround .9[vair,.85cap_stem];
if shaved_stem<crisp.breadth: shaved_stem:=crisp.breadth; fi
pickup crisp.nib; pos1(shaved_stem,90); pos2(if hefty: vair else: hair fi,0);
top y1r=h; x1=.5w; rt x2r=hround(w-.85u); y2=good.y(y1l-4/9I_beak)-eps;
pos3(if hefty: vair else: hair fi,180); x3=w-x2; y3=y2;
pos4(shaved_stem,-90); pos5(if hefty: vair else: hair fi,0);
bot y4r=0; x4=.5w; rt x5r=hround(w-.75u); y5=good.y(y4l+.5I_beak)+eps;
pos6(if hefty: vair else: hair fi,180); x6=w-x5; y6=y5;
begingroup save serifs; boolean serifs; serifs = true;
arm(1,2,a,.4beak_darkness,.3 beak_jut);  % upper right arm and beak
arm(1,3,b,.4beak_darkness,-.3 beak_jut);  % upper left arm and beak
arm(4,5,c,.4beak_darkness,.3beak_jut);  % lower right arm and beak
arm(4,6,d,.4beak_darkness,-.3beak_jut);  % lower left arm and beak
endgroup;
pos7(shaved_stem,90); pos8(shaved_stem,90);
lft x7=w-rt x8=hround if serifs: 2.5 else: 2 fi\\ u;
top y7r=top y8r=vround(.52h+.5shaved_stem);
filldraw stroke z7e--z8e;  % middle bar
if serifs: numeric xjut;
 if bot y2>top y7r+.75cap_jut: xjut=.5cap_jut;
 else: bot y2=top y7r+1.5xjut; fi
 pos11(hair,0); pos12(hair,0); y11=y12;
 pos13(hair,0); pos14(hair,0); y13=y14;
 lft x11l=lft x13l=w-rt x12r=w-rt x14r=hround 2.5u;
 top y11-bot y13=shaved_stem+2xjut; .5[y11,y13]=y7;
 filldraw stroke z11e--z13e; filldraw stroke z12e--z14e; fi  % middle serifs
math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,11,12,13,14); endchar;


font_slant slant; font_x_height x_height#;
if monospace: font_normal_space 9u#; % no stretching or shrinking
 font_quad 18u#;
 font_extra_space 9u#;
else: font_normal_space 6u#+2letter_fit#;
 font_normal_stretch 3u#; font_normal_shrink 2u#;
 font_quad 18u#+4letter_fit#;
 font_extra_space 2u#;
 k#:=-.5u#;
 ligtable "I": "I" kern -k#; % Richard III
 fi
bye.