% This is  LOWERKLM.MF
% Version 1.0b 
% Date 8-APR-1992
% 
% (c) 1991, 1992 by J"org Knappen. See fc.rme for copying conditions
% This file is part of the fc-package 
% See fc.rme for more information
%
% J"org Knappen
% Institut f"ur Kernphysik
% Postfach 39 80
% D-W 6500 Mainz
% knappen@vkpmzd.kph.uni-mainz.de

% Contents:
%
% The following characters are generated without condition:
%
% k, l, m
%
% And the following on demand, i. e. if their code is known:
%
% hooktop_k, kra, m_acute
%
% Higher versions of this file might include more characters.

cmchar "The letter k";
beginchar("k",9.5u#,asc_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
numeric right_jut,stem[],alpha[];
stem1=max(tiny.breadth,hround(fudged.stem-stem_corr));
stem2=max(tiny.breadth,hround(fudged.stem-2stem_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); top y1=h; bot y2=0;
lft x1l=lft x2l=hround(2.5u-.5stem1);
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=x1; 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-x1);
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
pos0(stem1,0); pos0'(stem2,0); y0=y0'; x0=x1; x0'=x2;
rt z0r=whatever[z3,z4]; filldraw stroke z1e..z0e--z0'e..z2e; % stem
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
 sloped_serif.l(1,0,a,1/3,jut,serif_drop); % upper stem serif
 dish_serif(2,0',b,1/3,jut,c,1/3,inner_jut);  % lower stem serif
 dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
 dish_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;

iff known hooktop_k:
cmchar "The letter hooktop k";           % jk
beginchar(hooktop_k,9.5u#,asc_height#,0);
italcorr max(asc_height#*slant+if serifs:flare#-.25u# else: 1.25u# fi,
  x_height#*slant-.2u#);
adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
numeric right_jut,stem[],alpha[];
stem1=max(tiny.breadth,hround(fudged.stem-stem_corr));
stem2=max(tiny.breadth,hround(fudged.stem-2stem_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(stem',0); lft x1l=hround(2.5u-.5stem');
pickup fine.nib; numeric bulb_diam;
if serifs: bulb_diam=hround .8[stem,flare];
 pos2(bulb_diam,0); y2+.5bulb_diam=.9[x_height,h+oo];
 if monospace: rt x2r=hround(.5w)+1 else: lft x2l=hround(.6w+.5) fi;
else: pos2(5/7[vair,flare],90); top y2r=h;
 rt x2=hround(if monospace:w-4.5u else:w-3.25u fi); fi
f_stroke(1,2,a,b,c,jut,if not monospace:1.25fi\\ jut); % stem, terminal, serif
pickup tiny.nib; 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=x1; 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-x1);
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
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
 dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
 dish_serif(6,5,f,1/2,inner_jut,g,1/3,right_jut)(dark);fi % lower diagonal serif
penlabels(1,2,3,4,5,6,11); endchar;

% kra.mf 12-mar-1991 by J"org Knappen

iff known kra:               % This is cm k, but without ascender
cmchar "The letter kra";     % greenlandic
beginchar(kra,9.5u#,x_height#,0);
italcorr x_height#*slant-.2u#;
adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
numeric right_jut,stem[],alpha[];
stem1=max(tiny.breadth,hround(fudged.stem-stem_corr));
stem2=max(tiny.breadth,hround(fudged.stem-2stem_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); top y1=h; bot y2=0;
lft x1l=lft x2l=hround(2.5u-.5stem1);
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=x1; 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-x1);
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
pos0(stem1,0); pos0'(stem2,0); y0=y0'; x0=x1; x0'=x2;
rt z0r=whatever[z3,z4]; filldraw stroke z1e..z0e--z0'e..z2e; % stem
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
 sloped_serif.l(1,0,a,1/3,jut,serif_drop); % upper stem serif
 dish_serif(2,0',b,1/3,jut,c,1/3,inner_jut);  % lower stem serif
 dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
 dish_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;

cmchar "The letter l";
beginchar("l",5u#,asc_height#,0); l_width#:=5u#+2serif_fit#;
italcorr asc_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);
if odd(w-stem'): change_width; fi
lft x1l=hround(.5w-.5stem'); x1=x2; top y1=h; bot y2=0;
filldraw stroke z1e--z2e;  % stem
if serifs or monospace: 
  sloped_serif.l(1,2,a,1/3,jut,serif_drop);  % upper serif
fi
if serifs:
 dish_serif(2,1,b,1/3,jut,c,1/3,jut); fi  % lower serif
penlabels(1,2); endchar;

cmchar "The letter m";
beginchar("m",15u#,x_height#,0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
numeric shaved_stem; shaved_stem=hround(mfudged.stem-2stem_corr);
pickup tiny.nib; pos1(mfudged.stem,0); pos2(mfudged.stem,0);
pos1'(shaved_stem,0); pos2'(shaved_stem,0);
pos3(mfudged.stem,0); pos5(mfudged.stem,0);
lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; % stem, sic
lft x3l=hround(.5w-.5mfudged.stem); x5-x3=x3-x1;
if not monospace: r:=hround(x5+x1)+r-w; fi  % change width for better fit
top y1=h+min(oo,serif_drop); bot y2=0; y1=y1'; y2=y2';
filldraw stroke z1'e--z2'e;  % left stem
h_stroke(2,a,3,4);  % left arch and middle stem
h_stroke(4,b,5,6);  % right arch and right stem
if serifs: sloped_serif.l(1',2',c,1/3,jut,serif_drop); % upper left serif
 numeric inner_jut; pickup tiny.nib;
 if rt x2r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
 else: rt x2r+jut+.5u+1=lft x4l-inner_jut; fi
 dish_serif(2,1,d,1/3,jut,e,1/3,jut); % lower left serif
 dish_serif(4,3,f,1/3,inner_jut,g,1/3,jut); % lower middle serif
 dish_serif(6,5,h,1/3,inner_jut,i,1/3,jut); fi % lower right serif
picture savedpicture;
savedpicture:=currentpicture;
penlabels(1,2,3,4,5,6); endchar;

iff known m_acute:
cmchar "The letter m with acute";
beginchar(m_acute,15u#,.75[x_height#,min(asc_height#,2x_height#)],0);
italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
currentpicture:=savedpicture;
if serifs: pickup crisp.nib; x1=hround(.5w+2.5u-.5stem); 
  x2=hround(.5w-5/6u);
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(.5w+3u); lft x2l=hround(.5w-.25u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

savedpicture:=nullpicture;

endinput;
