% This is UPPERO.MF  
% Version 1.0b 
% Date 17-MAR-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:
%
% O
%
% And the following on demand, i. e. if their code is known:
%
% O_grave, O_acute, O_hat, O_hachek, O_bar, O_uline, O_dot, O_dotu
% O_umlaut, O_tilde, open_O, open_O_tilde, OE_lig (\OE), crossed_O (\O)
%
% Higher versions of this file might include more characters.

cmchar "The letter O";
beginchar("O",14u#-width_adj#,cap_height#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
penpos1(vair',90); penpos3(vround(vair+1.5vair_corr),-90);
penpos2(cap_curve,180); penpos4(cap_curve,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w; y1r=h+o; y3r=-o;
y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
penstroke pulled_super_arc.e(1,2)(.5superpull)
 & pulled_super_arc.e(2,3)(.5superpull)
 & pulled_super_arc.e(3,4)(.5superpull)
 & pulled_super_arc.e(4,1)(.5superpull) & cycle;  % bowl
picture savedpicture;
savedpicture:=currentpicture;
math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;

iff known O_umlaut:
cmchar "Capital letter O with trema";
beginchar(O_umlaut,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric dot_diam;
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
currentpicture:=savedpicture;
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=good.x(.5w-1.75u); top y2r=h+1;
if bot y2l<cap_height+o+slab: y2l:=min(y2r-eps,cap_height+o+slab+.5tiny); fi
y1=.5[y2l,y2r]; dot(1,2);  % left dot
pos3(dot_diam,0); penpos4(y2r-y2l,90); y3=y4=y1; x3=x4=good.x(.5w+1.75u);
dot(3,4);  % right dot
penlabels(1,2,3,4); endchar;

iff known O_dot:
cmchar "Capital letter O with dot";
beginchar(O_dot,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
define_whole_blacker_pixels(dot_diam);
currentpicture:=savedpicture;
pickup tiny.nib;
pos88(dot_diam,0); pos99(dot_diam,90);
x88=x99=good.x(.5w); top y99r=h+1;
if bot y99l-cap_height-o<slab: 
 y99l:=min(y99r-eps,cap_height+o+tiny+slab);fi
y88=.5[y99l,y99r]; dot(88,99);  % dot
penlabels(88,99);endchar;    

iff known O_tilde:
cmchar "Capital letter O with tilde";
beginchar(O_tilde,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
currentpicture:=savedpicture;
if serifs: numeric theta; theta=angle(1/6(6u-vair),1/4(h-cap_height));
 pickup crisp.nib; numeric mid_width; mid_width=.4[vair,stem];
 pos1(vair,theta+90); pos2(vair,theta+90);
 pos3(vair,theta+90); pos4(vair,theta+90);
 z2-z1=z4-z3=(mid_width-crisp)*dir theta;
 lft x1r=hround(1/5w);rt x4l=hround(4/5w); top y4r=h;
 bot y1l=vround(bot y1l+min(2/3[cap_height,h],y3l-.25vair)-top y1r);
 pair delta; ypart delta=3(y3l-y1l); delta=whatever*dir theta;
 filldraw z1l..controls(z1l+delta)and(z3l-delta)..z3l..z4l
  --z4r..controls(z4r-delta)and(z2r+delta)..z2r..z1r--cycle;  % stroke
else: pickup fine.nib; pos1(vair,180); pos2(vair,90);
 pos3(.5[vair,slab],90); pos4(vair,90); pos5(vair,180);
 lft x1r=hround(1/5w);rt x5l=hround(4/5w); x2-x1=x3-x2=x4-x3=x5-x4;
 bot y1=bot y4l=vround(.75[cap_height,h]-vair);
 top y2r=top y5=h; y3=.5[y2,y4];
 filldraw stroke z1e{up}...z2e{right}..z3e..{right}z4e...{up}z5e; fi % stroke
penlabels(1,2,3,4,5); endchar;

iff known O_acute:
cmchar "Capital letter O with acute";
beginchar(O_acute,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
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,cap_height],cap_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,cap_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

iff known O_grave:
cmchar "Capital letter O with gravis";
beginchar(O_grave,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
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,cap_height],cap_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);
 lft x1l=hround(.5w-3u); rt x2r=hround(.5w+.25u+.5vair);
 top y1=h; bot y2=vround 2/3[h,cap_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

iff known O_bar:
cmchar "Capital letter O with macron";
beginchar(O_bar,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
currentpicture:=savedpicture;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pickup if serifs: crisp.nib else: fine.nib fi;
pos91(macron_breadth,90); pos92(macron_breadth,90);
top y91r=top y92r=h+o; lft x91=w-rt x92=hround 3u;
filldraw stroke z91e--z92e;  % bar
penlabels(91,92); endchar;

iff known O_hat:
cmchar "Capital letter O with circumflex";
beginchar(O_hat,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
currentpicture:=savedpicture;
if serifs: 
 pickup crisp.nib; pos2(.5[vair,curve],90); top y2r=h; x2=.5w;
 x1=good.x(.5w-2.25u); x3=good.x(.5w+2.25u); y1=y3=.5[cap_height,y2];
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else:
 pickup fine.nib; pos1(vair,0); pos3(vair,0);
 pos2(stem,0); top y2=h; x2=.5w; bot y1=bot y3=vround 2/3[h,cap_height]-eps;
 rt x3r=hround(lft x2l+3.25u+.5vair);
 lft x1l=hround(rt x2r-3.25u-.5vair); % same slope as in the acute accent
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x .2[x2l,x2]; x4r=good.x(.2[x2r,x2]);
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

iff known O_hachek:
cmchar "Capital letter O with hachek";
beginchar(O_hachek,14u#-width_adj#,cap_height#+comma_depth#,0);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
currentpicture:=savedpicture;
h':=vround(cap_height+comma_depth); % height of circumflex being inverted
if serifs:  pickup crisp.nib; pos2'(.5[vair,curve],90); top y2'r=h;
 pos2(.5[vair,curve],90); x2=.5w;
 x1=good.x(.5w-2.25u); x3=good.x(.5w+2.25u);
 top y1=top y3=h; y1-y2=.5(y2'-cap_height);
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: 
 pickup fine.nib; pos1(vair,0); pos3(vair,0); 
 pos2(stem,0); bot y2=vround(1/12[cap_height,h']+o); x2=.5w;
 top y1=top y3=h+o; lft x1l=hround(rt x2r-3.25u-.5vair);
 rt x3r=hround(lft x2l+3.25u+.5vair);
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x(.2[x2l,x2]); x4r=good.x(.2[x2r,x2]);
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

iff known O_dotu:
cmchar "Capital letter O with dot below";
beginchar(O_dotu,14u#-width_adj#,cap_height#,0.875desc_depth#);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
define_whole_blacker_pixels(dot_diam);
currentpicture:=savedpicture;
pickup tiny.nib;
pos88(dot_diam,0); pos99(dot_diam,90);
x88=x99=good.x(.5w); bot y99l=-d-1; 
if top y99r+oo>-slab: y99r:=max(y99l+eps,-oo-tiny-slab); fi
y88=.5[y99r,y99l];
dot(88,99); 
penlabels(88,99); endchar;

iff known O_uline:
cmchar "Capital letter O with bar below";
beginchar(O_uline,14u#-width_adj#,cap_height#,0.875desc_depth#);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
currentpicture:=savedpicture;
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pickup if serifs: crisp.nib else: fine.nib fi;
pos91(macron_breadth,90); pos92(macron_breadth,90);
bot y91l=bot y92l=-d-o; lft x91=w-rt x92=hround 3u;
filldraw stroke z91e--z92e;  % bar
penlabels(91,92); endchar;

savedpicture:=nullpicture;

iff known OE_lig:
cmchar "The ligature OE";
beginchar(OE_lig,18u#,cap_height#,0);
italcorr cap_height#*slant-beak_jut#-.5u#;
adjust_fit(cap_serif_fit#,0);
numeric light_stem;
light_stem=max(tiny.breadth,hround .8[mfudged.hair,mfudged.cap_stem]);
pickup tiny.nib; pos1(light_stem,0); pos2(light_stem,0);
lft x1l=lft x2l=hround .5w; top y1=h; bot y2=0;
filldraw stroke z1e--z2e; % stem
pickup crisp.nib; pos3(slab,90); pos4(mfudged.hair,0);
top y3r=h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak)-eps;
arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
pos5(cap_bar,-90); pos6(mfudged.hair,0);
top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
pos0(cap_bar,90); pos7(mfudged.hair,0);
z0=z5; x6=x7; y6-y5l=y0l-y7;
if serifs and not(monospace and hefty): rt x6r=hround(w-3.4u+.5mfudged.hair);
 y6=good.y(y5l+.6beak)+eps; rt x9r=hround(w-.5u);
else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
pos8(slab if not serifs:+2stem_corr fi,-90);
pos9(mfudged.hair,0); bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
penpos11(vair,90); penpos13(vair,-90);
if monospace: penpos12(fudged.cap_stem,180);
 interim superness:=sqrt superness;  % make |"O"|, not |"0"|
else: penpos12(hround(cap_curve-stem_corr),180); fi
x11=x13=.5w-2u; y11r=h+o; y13r=-o; y12=.5h-vair_corr; x12r=hround u;
x14=x15=.5w; y14=2/3h; y15=1/3h; y12l:=.52h;
penstroke super_arc.e(11,12) & super_arc.e(12,13);  % left half of bowl
fill z13r{right}..{right}(x2,0)--(x1,h){left}..{left}z11r
 --z11l{right}...{z14-z11l}(.82[x11l,x14],.82[y14,y11l])
 ...z14---z15...{z13l-z15}(.82[x13l,x15],.82[y15,y13l])
 ...{left}z13l--cycle;  % right half of bowl
if serifs: serif(1,2,a,1/3,.5cap_jut);  % upper serif
 serif(2,1,b,1/3,.5cap_jut); fi  % lower serif
penlabels(0,1,2,3,4,5,6,7,8,9,11,12,13,14,15); endchar;

iff known crossed_O:
cmchar "Scandinavian letter O/slash";
beginchar(crossed_O,14u#,cap_height#+.25desc_depth#,.25desc_depth#);
italcorr .7cap_height#*slant-.5u#;
adjust_fit(0,0);
penpos1(vair,90); penpos3(vair,-90);
penpos2(fudged.cap_stem,180); penpos4(fudged.cap_stem,0);
if monospace: x2r=hround 1.5u;
 interim superness:=sqrt superness;  % make |"O"| not |"0"|
else: x2r=hround u; fi
x4r=w-x2r; x1=x3=.5w;
y1r=cap_height+o; y2=y4=.5cap_height-vair_corr; y3r=-o;
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
x5=x4-vair; x6=x2+vair; y5=h; y6=-d;
numeric theta; theta=angle(z5-z6)-90;
pickup crisp.nib; pos5(vair',theta); pos6(vair',theta);
filldraw stroke z5e--z6e;  % diagonal
penlabels(1,2,3,4,5,6); endchar;


iff known open_O:
cmchar "Capital letter OPEN O";  % from cm 
if serifs: beginchar(open_O,13u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);  slantswitch;   % mirror will reswitch the slant
 pickup fine.nib; pos1(cap_hair,0); pos2(cap_band,90);
 pos3(cap_curve,180); pos4(cap_band,270); pos5(hair,360);
 rt x1r=rt x5r=hround(w-u); lft x3r=hround u; x2=x4=.55[x3,x1];
 top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
 bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
 y5=max(good.y .95(h-y1),y4l+eps);
 (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
 (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
 filldraw stroke z1e{x2-x1,10(y2-y1)}
  ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...{up}z5e; % arc
 pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
 x1r-x1'=2cap_curve-fine; y1'=y1;
 path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
 numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
 filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
else: beginchar(open_O,11.5u#,cap_height#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0);  slantswitch;   % mirror will reswitch the slant
 pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
 pos3(cap_curve,180); pos4(slab,270); pos5(flare,275);
 rt x1r=hround(w-1.1u); x2=x4=.5w+1.25u;
 lft x3r=hround max(u,2u-.5cap_curve); rt x5r=hround(w-.9u);
 top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
 bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
 filldraw stroke rterm.e(2,1,right,.9,4) & super_arc.e(2,3)
  & super_arc.e(3,4) & term.e(4,5,right,.8,4); fi % arc and terminals
mirror(.5w);       % reverse it
picture savedpicture;
savedpicture:=currentpicture;
math_fit(-.3cap_height#*slant-.5u#,.5ic#);
penlabels(1,1',2,3,4,5,6); endchar;

iff known open_O_tilde:
cmchar "Capital letter OPEN O with tilde";  % from cm 
if serifs: beginchar(open_O_tilde,13u#,cap_height#+comma_depth#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0); 
else: beginchar(open_O_tilde,11.5u#,cap_height#+comma_depth#,0);
 italcorr cap_height#*slant-.5u#;
 adjust_fit(0,0); 
fi
currentpicture:=savedpicture;
if serifs: numeric theta; theta=angle(1/6(6u-vair),1/4(h-cap_height));
 pickup crisp.nib; numeric mid_width; mid_width=.4[vair,stem];
 pos1(vair,theta+90); pos2(vair,theta+90);
 pos3(vair,theta+90); pos4(vair,theta+90);
 z2-z1=z4-z3=(mid_width-crisp)*dir theta;
 lft x1r=hround(1/6w);rt x4l=hround(5/6w); top y4r=h;
 bot y1l=vround(bot y1l+min(2/3[cap_height,h],y3l-.25vair)-top y1r);
 pair delta; ypart delta=3(y3l-y1l); delta=whatever*dir theta;
 filldraw z1l..controls(z1l+delta)and(z3l-delta)..z3l..z4l
  --z4r..controls(z4r-delta)and(z2r+delta)..z2r..z1r--cycle;  % stroke
else: pickup fine.nib; pos1(vair,180); pos2(vair,90);
 pos3(.5[vair,slab],90); pos4(vair,90); pos5(vair,180);
 lft x1r=hround(1/6w);rt x5l=hround(5/6w); x2-x1=x3-x2=x4-x3=x5-x4;
 bot y1=bot y4l=vround(.75[cap_height,h]-vair);
 top y2r=top y5=h; y3=.5[y2,y4];
 filldraw stroke z1e{up}...z2e{right}..z3e..{right}z4e...{up}z5e; fi % stroke
penlabels(1,2,3,4,5); endchar;
      
savedpicture:=nullpicture;

endinput;
