%*****************************************************************************
%        Copyright (c) 1989 by N. N. Billawala
%*****************************************************************************


% accent.mf  miscellaneous accents, ligatures and chars for foreign languages

%19 characters; iff OK "x": for testing



iff OK "x":  "The letter i with no dot"; 
  beginchar(oct"020",i_w*width#+a_mono#,xheight#,0); 

  bot z40=(if singlepitch:.65w else:.5w fi,0);  multpos(1,4,40)(stem.lc,0);  	
  lft x4l=round x40l; bot y4=0;  
  z1=(x4,h)//; 
  onaline(1l,4l)(2l,3l);   y3l=y3r=x_bracket_h;           
  onaline(1r,4r)(2r,3r);   y2l=y2r=max(h-x_bracket_h,y3l);

  p1=fullserif(z4,z1,z3l,z3r,.75hs,.75hs)--
     terminalserif.l(z1,z4,z2l,z2r,.5ts,x_terminal_angle)--cycle;
  if singlepitch:pickup pencircle yscaled thin_stem.lc rotated -oblique;
    lft top z12=(0,h); rt top z13=(x1,h); 
    draw z12--z13; showpoints(12,13);
    fi  

  showpoints(1,2,3,4,40);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#); 
show_character; endchar;

% Exactly the came character as the lowercase "i", but with no dot



iff OK "x":  "The letter j with no dot";
  beginchar(oct"021",j_w*width#+a_mono#,xheight#,descender#);

  top rt z1r=(w,h)//;        multpos(1,4)(stem.lc,0);
  rt z4r=(w,0);      
  onaline(1l,4l)(2l,3l);     y3l=max(.25xheight,-d+(l_arch*(d+.25xheight)));
  onaline(1r,4r)(2r,3r);     y3r=max(.25xheight,-d+(r_arch*(d+.25xheight)));
  onaline(1,4)(11);          y11=y1+max(1,.2h);  y2l=y2r=h-x_bracket_h;
  lft z6=(0,-.95d)//;      
  save_num(knob)=min(bulb_thickness,.3*abs(x4l-x6));            
  bot y5r=top y5l-minor_curve.lc=-d-ov_b.lc;
  good_x_for(5r)(z6,z3r,.4)a;  good_x_for(5l)(z6+(knob,0),z3l,.4)b;

  p1=terminalserif.l(z1,z4,z2l,z2r,.5ts,x_terminal_angle)--z3l{downward} i_t
     bulb.bl(z6,z5l,z5r,.5cs,knob,90) o_t z3r{upward}--cycle;

 if singlepitch:pickup pencircle yscaled thin_stem.lc rotated -oblique;
    lft top z12=(.2w,h); rt top z13=(x1,h); 
    draw z12--z13; showpoints(12,13);
    fi  

  showpoints(1,2,3,4,5,6,11);
adjust(m_ee*a_mfit#,v_a*fitbasis.lc#+m_e*a_mfit#);
show_character; endchar;

% Exactly the came character as the lowercase "j", but with no dot



iff OK "x":  "Grave accent";     %******* .8 ACCENT WIDTH  x  1 ACCENT DEPTH
  beginchar(oct"022",.8accent_w*width#+b_mono#,
    accent_height#+xheight#+accent_depth#,0); 
  top rt z1=(0,h)//;  
  bot lft z2=(w,h-max(1,accent_depth))//;
  p1=prime_accent(z1,z2,accent_thick_end,accent_thin_end);
  showpoints(1,2);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;

    

iff OK "x":  "Acute accent";     %******* .8 ACCENT WIDTH  x  1 ACCENT DEPTH
  beginchar(oct"023",.8accent_w*width#+b_mono#,
    accent_height#+xheight#+accent_depth#,0); 
  top rt z1=(w,h)//;  
  bot lft z2=(0,h-max(1,accent_depth))//;
  p1=prime_accent(z1,z2,accent_thick_end,accent_thin_end);
  showpoints(1,2);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;



iff OK "x":  "Hachek accent";   %******* 1 ACCENT WIDTH  x  2/3 ACCENT DEPTH
  beginchar(oct"024",accent_w*width#+b_mono#,
    accent_height#+xheight#+2/3accent_depth#,0); 
  save theta,adjustment;
  top lft z1=(0,h)//;  
  bot z2l=bot z22=(.5w,h-max(1,2/3accent_depth))//;
  rt z3=(w,y1)//;   
  pos2(.6[accent_thin_end,accent_thick_end],90);
  pos22(min(apex.lc,.5stem.lc),0-apex_angle);
  if y2=y1: x1:=x1+eps; fi      % keeps from division by 0 error on next line
  if bold:theta1=theta3=0; adjustment=1/cosd (angle(z2-z1)+90); 
    else:theta1=angle(z1-z2)-90;theta3=angle(z3-z2)-90;adjustment=1; fi
  pos1(accent_thin_end*adjustment,theta1);
  pos3(accent_thin_end*adjustment,theta3);
  onaline(1,2)(23); onaline(1l,22l)(21);
  onaline(2,3)(21); onaline(22r,3r)(23); 
 
  p1=if realsoft_accents: (z2r soften(z1r,z1l) z21{z21-z1l}...
        z23{z3r-z23} soften(z3r,z3l) z2r)--cycle;
       else: (z2r soften(z1r,z1l,z22l,z22r,z3r,z3l) z2r)--cycle; fi

  showpoints(1,2,3,21,22,23);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;

% Currently the angle of the accent is based on a varying "accent\_depth"
% The thetas are the angles at the ends, flattened for bold chars,
% but theta could be an arbitrary value



iff OK "x":  "Breve accent";   %******* 1 ACCENT WIDTH  x  2/3 ACCENT DEPTH
  beginchar(oct"025",accent_w*width#+b_mono#,
    accent_height#+xheight#+accent_depth#,0); 
  save theta,adjustment;
  save_num(thickness)=.5[accent_thin_end,accent_thick_end];
  top lft z1l=(0,h)//; 
  bot z2l=(.5w,h-accent_depth)//;
  rt z3r=(w,y1l)//;
  pos2(thickness,90);  
  if y2l=y1l: x1l:=x1l+eps; fi    % keeps from division by 0 error on next line
  ref1=z1l...z2l{right}; ref2=z3r...z2l{right};
  if bold:theta1=theta3=0; adjustment=1/cosd (angle(direction 0 of ref1)+90); 
    else:adjustment=1;
         theta1=angle(direction 0 of ref1)+90;
         theta3=angle(direction 0 of ref2)-90;fi
  pos1(thickness*adjustment,theta1);
  pos3(thickness*adjustment,theta3);
  save_pair(end_dir)=if abs(y1l-y2l)>abs(x1l-x2l):upward else:(0,0) fi;
 
  p1=(z2l{right}...z3r{end_dir}
        if softpath:)softjoin(z3r--z3l)softjoin( else:-- fi 
      z3l{-end_dir}...z2r{left}...z1r{end_dir}
        if softpath:)softjoin(z1r--z1l)softjoin( else:-- fi
      z1l...z2l{right})--cycle;

  showpoints(1,2,3);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;

% Currently the angle of the accent is based on a varying "accent\_depth"
% The thetas are the angles at the ends, flattened for bold chars,
% but theta could be an arbitrary value



iff OK "x":  "Macron accent";   %******* 1 ACCENT WIDTH  x  .5 ACCENT DEPTH
  beginchar(oct"026",accent_w*width#+b_mono#,
    accent_height#+xheight#+accent_depth#,0); 
  min_limit(join_radius)(.25[accent_thin_end,accent_thick_end]);
  lft z1=(0,h-.5accent_depth)//;  
  rt z3=(w,y1)//;
  multpos(1,3)(.5[accent_thin_end,accent_thick_end],90);
  z2l=.5[z1l,z3l];
 
  p1=(z2l soften(z3l,z3r,z1r,z1l) z2l)--cycle;

  showpoints(1,2,3);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;



iff OK "x":  "Circle accent";   %******* 1 ACCENT WIDTH  x  ACCENT DEPTH
  beginchar(oct"027",accent_w*width#+b_mono#,
    accent_height#+xheight#+accent_depth#,0); 

  save thickness; 
  thickness=min(.3[accent_thin_end,accent_thick_end],.3*accent_depth-1);
  z0=(.5w,h-.5*max(2,accent_depth))//;
  top z1r=(x0,h);                               pos1(thickness,90);
  bot z3r=(x0,round(h-max(2,accent_depth)));    pos3(thickness,-90);
  lft z2r=(round(x0-.5(y1r-y3r)),.5[y1r,y3r]);  pos2(thickness,180);
  rt z4r=(round(x0+.5(y1r-y3r)),y2r);           pos4(thickness,0);

  p1 =z1r{left} o_t z2r{downward} o_t z3r{right} o_t z4r{upward} o_t cycle;
  p1'=z1l{left} i_t z2l{downward} i_t z3l{right} i_t z4l{upward} i_t cycle;
  
  showpoints(1,2,3,4);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;



iff OK "x":  "Cedilla";   %******* 1 ACCENT WIDTH  x  .75  ACCENT DEPTH
  beginchar(oct"030",accent_w*width#+b_mono#,0,descender#); 

  bot lft z1l=(.35w,-min(.75accent_depth,d))//;
  multpos(1,3)(max(.15accent_depth,accent_thin_end),90-oblique);
  lft z4r=(.5w,0)//;                 pos4(.25accent_depth,80-oblique); 
  rt z5r=lft z4r+(.5[accent_thin_end,accent_thick_end],0);
  z3l=z4l;                           pos5(accent_depth,80-oblique); 
  rt z2r=(w,.5[y1l,y3r])//;          pos2(accent_thick_end,0);
  ref1=z2r{upward}...z3{left};
  z20=ref1 intersectionpoint (z5r--z5l);
  (t1,t2)=ref1 intersectiontimes (z5r--z5l);

  p1=(subpath(0,t1)of ref1--z5r--z4r--z4l   if softpath:)softjoin(z4l fi 
      --z3l{right}...z2l{downward}...z1r{left}
        if softpath:)softjoin(z1r--z1l)softjoin( else:-- fi 
      z1l{right}...z2r{upward})--cycle;

  showpoints(1,2,3,4,5);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;



iff OK "x":  "The Double S Ligature or scharfes S";  
  beginchar(oct"031",b_w*width#+d_mono#,ascender#,0); 

  min_limit(join_radius)(.5*max(1,thin_stem.lc)); 
  lft z1l=(0,xheight)//;  multpos(1,4)(stem.lc,0);
  bot lft z4l=(0,0);      y3l=y3r=x_bracket_h;
  onaline(1l,4l)(2l,3l);  y2l=max(xheight,.75xheight+(r_arch*(h-xheight)));
  onaline(1r,4r)(2r,3r);  y2r=max(xheight,.75xheight+(l_arch*(h-xheight)));

  top z10r=(.45w,h+ov_t.lc)//;    pos10(minor_curve.lc,90);
  z13l=(.3[x3r,w],.55h)//;        multpos(11,12,13)(1[thin_stem.lc,stem.lc],0);
  bot y16r=top y16l-minor_curve.lc=-ov_b.lc;  
  z17l=(.2[x3r,w],y16l)//;        pos17(thin_stem.lc,-90); 
  y17r:=max(0,y17r);   
  rt z15r=(w,.4[y16r,y13r])//;   multpos(14,15)(bowlstem.lc,0);
  good_x_for(16l)(z17l,z15l,.4)a; good_x_for(16r)(z17r,z15r,.5)b; 
  good_x_for(11l)(z13l,z15l,.5)c; y11l=.5[y13r,y10r]; 
  z12=.5[z11,z13]; 
  z14=.5[z13,z15]; 

  p1=(terminalserif.l(z4,z1,z3l,z3r,.5hs,0)soft--z2r{upward} i_t
     z10l{right} i_t z11l{downward}...z12l... z13l{downward}...z14l...
     z15l{downward} i_t z16l{left} i_t z17l
       if softpath:)softjoin(z17l--z17r)softjoin( else:-- fi
     z17r o_t z16r{right} o_t z15r{upward}...z14r...z13r{upward}...z12r...
     z11r{upward} o_t z10r{left} o_t z2l{downward})--cycle;
  p2=terminalserif.l(.5[z1l,z1],.5[z4l,z4],z3l,.5[z3l,z3r],.75hs,
     x_terminal_angle)--cycle;

  min_limit(join_radius)(.5*max(1,.75minor_curve.lc)); 
  showpoints(1,2,3,4,10,11,12,13,14,15,16,17);
adjust(v_a*fitbasis.lc#+m_b*d_mfit#,v_g*fitbasis.lc#+m_bb*d_mfit#); 
show_character; endchar;



iff OK "x":  "The ae ligature";   
  beginchar(oct"032",ae_w*width#+f_mono#,xheight#,0);

  min_limit(join_radius)(.5*max(1,.75minor_curve.lc));                % "e" part
  bot rt z1r=
   (if narrow_condition:w else:.95w fi,round(.6h-.65*.8thin_stem.lc))//;
  pos1(max(1,.85stem.lc),ebar_angle);
  rt z3r=(round(if mono=0:a_w*width else:.5f_mono+.45stem.lc fi),.5h)//;
  pos3(if narrow_condition:narrow_amt[thin_stem.lc,stem.lc] 
        else:max(1,.9stem.lc) fi,0);
  rt z5l=(w,.15h)//;             pos5(max(1,.75minor_curve.lc),130-oblique); 
  top y2l=bot y2r+major_curve.lc=h+ov_t.lc;    
  bot y4l=top y4r-minor_curve.lc=-ov_t.lc;   
  good_x_for(2l)(z3l,z1r,.6)a;   good_x_for(2r)(z3r,z1l,.6)b; 
  good_x_for(4l)(z3l,z5l,.5)c;   good_x_for(4r)(z3r,z5r,.5)d;
  x4r:=min(x4r,x4l+minor_curve.lc); 
  onaline(1l,1r)(40); x40=x41=0;
  z42=z1r+(max(1,.8thin_stem.lc),0)rotated(90+ebar_angle);  
  z42-z41=whatever*(z1r-z1l);

  lft z109=(if narrow_condition:0 else:.05w fi,.9h)//;                % "a" part
  rt z114r=(round(if mono=0:a_w*width else:.5f_mono+.45stem.lc fi),0);
  lft z114l=(rt x114r-max(1,.9stem.lc),0);
  z111r=(x114r,max(r_arch*h,y3r))//;       pos111(max(1,.9stem.lc),0); 
  top y110r=bot y110l+arch_thickness.lc=h+ov_t.lc;    
  good_x_for(110r)(z109,z114r,min(.95,arch_reference+.1))e; 
  good_x_for(110l)(z109,z114l,arch_inner_amt)f;
  x110l:=max(x110l,x110r-arch_thickness.lc);
  onaline(111l,114l)(101l,101r);
  y101r=y101l+max(1,minor_curve.lc)=.55h+.75minor_curve.lc;
  lft z103l=(0,.35[-ov_b.lc,y101r])//; 
  rt z103r=(lft x103l+if narrow_condition:narrow_amt[thin_stem.lc,stem.lc] 
           else:max(1,bowlstem.lc) fi,max(.4[-ov_b.lc,y101r],major_curve.lc));  
  y102=.75y101r;  good_x_for(102)(z103l,z101r,.4)g;
                                                                      % "e" part
  ref1=z2r{right}..tension atleast .8 .. z1l{downward};  % inner right ref path
  ref2=z5r i_t z4r{left} i_t z3r{upward} i_t z2r{right}; % inner left ref path
  ref3=z1r--z40;                                         % outer bar ref path
  ref4=z41--z42;                                         % inner bar ref path
  ref5=z2l{left} o_t_c z3l{downward} o_t_c z4l{right}; 
  ref6=z4l{left} o_t_c z3l{upward}; 
  (t1,t2)=ref2 intersectiontimes ref3;  z20=ref2 intersectionpoint ref3;
  (t3,t4)=ref2 intersectiontimes ref4;  z21=ref2 intersectionpoint ref4;  
  (t5,t6)=ref1 intersectiontimes ref4;  z22=ref1 intersectionpoint ref4;  

  ref101=z3r{upward}...z111r{upward} o_t_c 
         bulb.tl(z109,z110l,z110r,.75cs,.5bulb_thickness,90);
  z105=(xpart point.5of ref6,ypart point.5of ref6+minor_bowl_tip.lc);
  ref102=arch.bl(z105,-ov_b.lc,z103r,z103l)lc; 
  ref103=(0,y101l)--(w,y101l)//;
  (t7,t8)  =ref5 intersectiontimes ref101;
  (t9,t10) =ref5 intersectiontimes ref103;
  (t11,t12)=ref5 intersectiontimes reverse ref102;
  (t13,t14)=ref6 intersectiontimes ref102;

  p1=(subpath(t8,infinity)of ref101 i_t z111l--
       z101r{z102-z101r}...z103l{downward}--
      subpath(0,t14)of ref102-- subpath(t13,0)of ref6 o_t_c z5l 
        if softpath:)softjoin(z5l--z5r)softjoin( else:-- fi
      subpath(0,t1)of ref2--z20 if softpath:)softjoin(z20 fi
      --z1r)softjoin(z1r{upward}..tension atleast .8 .. z2l{left}--
      subpath(0,t7)of ref5)--cycle;
  p1'=subpath(0,t5)of ref1--z22-(eps,0)--z21+(eps,0)--              % eye of "e"
      subpath(t3,infinity)of ref2--cycle;
  p2'=subpath(0,t12)of reverse ref102--                             % eye of "a"
      subpath(t11-eps,t9+eps)of ref5{z102-z101r}...cycle;

  showpoints(1,2,3,4,5,20,21,22,40,41,42,101,102,103,105,106,109,110,111,114);
adjust(v_f*fitbasis.lc#+m_a*f_mfit#,v_f*fitbasis.lc#+m_a*f_mfit#); 
show_character; endchar;

% There's still an intersection problem with this, but it seems to work for now
% Based on the lowercase "a" and "e"



iff OK "x":  "The oe ligature"; 
  beginchar(oct"033",oe_w*width#+f_mono#,xheight#,0);
  min_limit(join_radius)(.5*max(1,.75minor_curve.lc)); 
                      
  top y11r=h+ov_t.lc;          bot y11l=top y11r-minor_curve.lc;      % "o" part
  bot y13r=-ov_b.lc;           top y13l=bot y13r+minor_curve.lc;  
  lft z12r=(0,(1-v_stress)*h)//; 
  rt z12l=(lft x12r+bowlstem.lc,(1-v_stress)*h);
  rt z14r=(if mono=0:oo_w*width else:.52f_mono+.45bowlstem.lc fi,.5h)//; 
  lft z14l=(round(x14r-if narrow_condition:narrow_amt[thin_stem.lc,bowlstem.lc] 
                        else:max(1,.9bowlstem.lc) fi),.5h);  
  good_x_for(11r)(z12r,z14r,.53)a;  good_x_for(11l)(z12l,z14l,.47)b;  
  good_x_for(13r)(z12r,z14r,.47)c;  good_x_for(13l)(z12l,z14l,.53)d;  

  p1 =z11r{left} o_t_c z12r{downward} o_t_c z13r{right} o_t_c 
      z14r{upward} o_t_c cycle;
  p1'=z11l{left} i_t z12l{downward} i_t z13l{right} i_t z14l{upward} i_t cycle;

  bot rt z1r=                                                         % "e" part
   (if narrow_condition:w else:.95w fi,round(.6h-.65*.8thin_stem.lc))//;
  z3l=z14l; z3r=z14r;            
  pos1(if narrow_condition:w_narrow_amt[thin_stem.lc,stem.lc] 
        else:max(1,.85stem.lc) fi,ebar_angle);
  rt z5l=(w,.15h)//;             pos5(max(1,.75minor_curve.lc),130-oblique); 
  top y2l=bot y2r+major_curve.lc=h+ov_t.lc;    
  bot y4l=top y4r-minor_curve.lc=-ov_t.lc;   
  good_x_for(2l)(z3l,z1r,.6)e;   good_x_for(2r)(z3r,z1l,.6)f; 
  good_x_for(4l)(z3l,z5l,.5)g;   good_x_for(4r)(z3r,z5r,.5)h;
  x4r:=min(x4r,x4l+minor_curve.lc); 
  onaline(1l,1r)(40); x40=x41=0;
  z42=z1r+(max(1,.8thin_stem.lc),0)rotated(90+ebar_angle);  
  z42-z41=whatever*(z1r-z1l);
 
  ref1=z2r{right}..tension atleast .8 ..z1l{downward};   % inner right ref path
  ref2=z5r i_t z4r{left} i_t z3r{upward} i_t z2r{right}; % inner left ref path
  ref3=z1r--z40;                                         % outer bar ref path
  ref4=z41--z42;                                         % inner bar ref path
  z20=ref2 intersectionpoint ref3;  (t1,t2)=ref2 intersectiontimes ref3;
  z21=ref2 intersectionpoint ref4;  (t3,t4)=ref2 intersectiontimes ref4;
  z22=ref1 intersectionpoint ref4;  (t5,t6)=ref1 intersectiontimes ref4;

  p2 =(z2l{left} o_t_c z3l{downward} o_t_c z4l{right} o_t_c z5l
        if softpath:)softjoin(z5l--z5r)softjoin( else:-- fi
      subpath(0,t1)of ref2--z20 if softpath:)softjoin(z20 fi
      --z1r)softjoin(z1r{upward}..tension atleast .8 ..z2l{left})--cycle;
  p2'=subpath(0,t5)of ref1--z22-(eps,0)--z21+(eps,0)--              % eye of "e"
      subpath(t3,infinity)of ref2--cycle;
 
  showpoints(1,2,3,4,5,11,12,13,14,20,21,22,40,41,42);
adjust(v_c*fitbasis.lc#+m_a*f_mfit#,v_f*fitbasis.lc#+m_a*f_mfit#); 
show_character; endchar;

% This character is based on the "o" and the "e". The center curved stem
% has been decreased a bit and the center reference points are made to 
% coincide and keep a constant height of .5h. The rightmost point of the
% "e" has been extended to w from .95w




iff OK "x":  "The lowercase o with slash"; 
  beginchar(oct"034",oo_w*width#+d_mono#,xheight#,0);
                      
  top z1=(h_stress*w,h+ov_t.uc)//;                                   % circle 
  lft z2=(0,(1-v_stress)*h)//;
  bot z3=((1-h_stress)*w,-ov_b.uc)//;  
  rt z4=(w,v_stress*h)//;      

  circular_shape(y1,y3,x2,x4,minor_curve.lc,bowlstem.lc);            % circle

  pickup  slashpen rotated angle((.95w,h)//-(.05w,0)//);             % slash
  top rt z11=(.95w,1.1h)//;          
  bot lft z12=(.05w,-.1h)//;
  draw z11--z12;

 showpoints(1,2,3,4,11,12);
adjust(v_c*fitbasis.lc#+m_a*d_mfit#,v_c*fitbasis.lc#+m_a*d_mfit#); 
show_character; endchar;

% This is just a lowercase "o" with a slash added
% Only y1/y3 and x2/x4 values actually used; the points are put in for proofs



iff OK "x":  "The AE ligature"; 
  beginchar(oct"035",AE_w*width#+f_mono#,cap#,0);

  save_bool(nonotch):=if(cap<40):true else:false fi;          % if real low res
  bot lft z14l=(2/3*A_w*width+.5f_mono,0);                          % E part
  top z11l=(x14l,h)//;             
  multpos(11,14)(if narrow_condition:narrow_amt 
                  else:1 fi[thin_stem.uc,stem.uc],0); 
  onaline(11l,14l)(13l,40,42,43);  y13l=cap_bracket_h; 
  onaline(11r,14r)(1,4,4l,4r,6);   y40=y2r-max(thin_stem.uc,.3stem.uc,1);
  top y2r=h; 
  bot y1=bot y2l=top y2r-max(1,.95thin_stem.uc);
  top rt z3=(if narrow_condition:w else:.95w fi,h)//;
  bot y7l=0; 
  bot rt z8=(w,0);
  top y6=top y7r=bot y7l+max(1,.97thin_stem.uc);
  y4=.55h; 
  top y4r=bot y4l+max(1,.9thin_stem.uc)=top y5r=round(y4+.45thin_stem.uc);
  good_x_for(2r)(z1,z3,.6)a;  good_x_for(2l)(z1,z3,.6)b;
  good_x_for(7r)(z6,z8,.6)c;  good_x_for(7l)(z6,z8,.6)d;                
  good_x_for(5r)(z4,z3,.8)e;

  z21r=z40;                                                        % A part
  bot lft z23l=(0,0); 
  multpos(21,23)(thin_stem.uc,constant_angle(z21r,z23l,thin_stem.uc));
  onaline(21l,23l)(22l);       y41=y42=round(.33y21); y22l=cap_bracket_h; 
  onaline(21r,23r)(22r,41,44); y43=y44=y41+max(1,.7thin_stem.uc);% bar height
  onaline(21,23)(20,24);       top y20=h; y22r=min(y41,y22l); bot y24=0; 
  ref1=z43--z40--z44; 

  p1=(arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle)soft soften(z6,z4l)
      arm.tr(z5r,z4l,z4r,.15as,.25tip_thickness,90) soften(z4r,z1)
      arm.tr(z3,z2l,z2r,.4as,.75tip_thickness,90)soft...
      leftserif(z20,z23,z22l,z23r,.1hs)--
      fullserif.l(z24,z21,z22l,z22r,.5hs,.5hs) soften(z41,z42)
      leftserif(z14,z11,z13l,z11r,.1hs))..cycle;
  p1'=upnotch(ref1,angle(z40-z43),notch_length.uc)etchright--cycle;

  showpoints(1,2,3,4,5,6,7,11,12,13,14,20,21,22,23,24,40,41,42,43,44);  
adjust(v_I*fitbasis.uc#+m_a*f_mfit#,v_F*fitbasis.uc#+m_a*f_mfit#); 
show_character; endchar;

% Based on the E and the left stem of the A; shortened serif on E



iff OK "x":  "The OE ligature"; 
  beginchar(oct"036",OE_w*width#+f_mono#,cap#,0);
 
  if singlepitch:save circ; circ1=circ2=circ3=.75; fi   
  rt z14r=(round(if mono=0:O_w*width else:.55f_mono+.5stem.lc fi),0)//; 
  top z11l=(x14l,h)//;                                               % E part 
  multpos(11,14)(if narrow_condition:.9%********narrow\_amt 
                  else:1 fi[thin_stem.uc,stem.uc],0);  
  onaline(11l,14l)(12l,13l,24l,25l);     y13l=cap_bracket_h; 
  onaline(11r,14r)(1,4,4l,4r,6,24r,25r); y12l=max(h-cap_bracket_h,y13l);
  top y2r=h;                             y24l=y24r=.35h; y25l=y25r=h-y24l;
  bot y1=bot y2l=top y2r-max(1,.95thin_stem.uc);
  top rt z3=(if narrow_condition:w else:.95w fi,h)//;
  bot y7l=0; 
  bot rt z8=(w,0);
  top y6=top y7r=bot y7l+max(1,.97thin_stem.uc); 
  y4=.55h; 
  top y4r=bot y4l+max(1,.9thin_stem.uc)=top y5r=round(y4+.45thin_stem.uc);
  good_x_for(2r)(z1,z3,.6)a;  good_x_for(2l)(z1,z3,.6)b;
  good_x_for(7r)(z6,z8,.6)c;  good_x_for(7l)(z6,z8,.6)d;                
  good_x_for(5r)(z4,z3,.8)e; 

  top y21r=bot y21l+minor_curve.uc=h;                                % O part
  bot y23r=top y23l-minor_curve.uc=0;  
  lft z22r=(0,(1-v_stress)*h)//; 
  rt z22l=(lft x22r+bowlstem.uc,(1-v_stress)*h);

  good_x_for(21r)(z22r,z24r,h_stress)f;good_x_for(21l)(z22l,z24l,(1-h_stress))g;
  good_x_for(23r)(z22r,z24r,(1-h_stress))h;good_x_for(23l)(z22l,z24l,h_stress)i;

  p1=(leftserif(z14,z11,z13l,z11r,eps)..
      arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle)soft soften(z6,z4l)
      arm.tr(z5r,z4l,z4r,.15as,.25tip_thickness,90) soften(z4r,z1)
      arm.tr(z3,z2l,z2r,.4as,.75tip_thickness,90)soft...
      leftserif(z11,z14,z12l,z14r,eps))--cycle;
  p2 =z21r{left} o_t z22r{downward} o_t z23r{right} o_t z24r{upward} o_t 
      z25r{upward} o_t cycle;
  p2'=z21l{left} i_t z22l{downward} i_t z23l{right} i_t z24l{upward} i_t
      z25l{upward} i_t cycle;

  showpoints(1,2,3,4,5,6,7,11,12,13,14,21,22,23,24,25);
adjust(v_C*fitbasis.uc#+m_a*f_mfit#,v_F*fitbasis.uc#+m_a*f_mfit#); 
show_character; endchar;

% Takes the O and E and overlaps them; thins right curve of the O;
% shortens the serifs on the E




iff OK "x":  "The uppercase O with slash"; 
  beginchar(oct"037",O_w*width#+d_mono#,cap#,0);
                             
  if singlepitch:save circ; circ1=circ2=circ3=.75; fi 
  top z1=(h_stress*w,h+ov_t.uc)//;                                   % circle 
  lft z2=(0,(1-v_stress)*h)//;
  bot z3=((1-h_stress)*w,-ov_b.uc)//;  
  rt z4=(w,v_stress*h)//;      

  circular_shape(y1,y3,x2,x4,minor_curve.uc,bowlstem.uc);            % circle

  pickup  slashpen rotated angle((.95w,h)//-(.05w,0)//);             % slash
  top rt z11=(.95w,1.1h)//;          
  bot lft z12=(.05w,-.1h)//;  
  draw z11--z12;

 showpoints(1,2,3,4,11,12);
adjust(v_C*fitbasis.uc#+m_a*d_mfit#,v_C*fitbasis.uc#+m_a*d_mfit#); 
show_character; endchar;

% This is just an uppercase "O" with a slash added
% Only y1/y3 and x2/x4 values actually used; the points are put in for proofs



iff OK "x":  "Circumflex accent";   %******* 1 ACCENT WIDTH  x  2/3 ACCENT DEPTH
  beginchar(oct"136",accent_w*width#+b_mono#,
    accent_height#+xheight#+2/3accent_depth#,0); 

  save theta,adjustment;
  bot lft z1=(0,h-max(1,2/3accent_depth))//;
  top z2l=top z22=(.5w,h)//;  
  rt z3=(w,y1)//;   
  pos2(.6[accent_thin_end,accent_thick_end],-90);
  pos22(min(apex.lc,.5stem.lc),0-apex_angle);
  if y2=y1: x1:=x1+eps; fi      % keeps from division by 0 error on next line
  if bold:theta1=theta3=180; adjustment=1/cosd (angle(z2-z1)+90); 
    else:theta1=angle(z1-z2)+90;theta3=angle(z3-z2)+90; adjustment=1; fi
  pos1(accent_thin_end*adjustment,theta1);
  pos3(accent_thin_end*adjustment,theta3);
  onaline(1,2)(23); onaline(1l,22l)(21);
  onaline(2,3)(21); onaline(22r,3r)(23); 
 
  p1=if realsoft_accents: (z2r soften(z1r,z1l) z21{z21-z1l}...
        z23{z3r-z23} soften(z3r,z3l) z2r)--cycle;
       else: (z2r soften(z1r,z1l,z22l,z22r,z3r,z3l) z2r)--cycle; fi

  showpoints(1,2,3,21,22,23);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;

% Currently the angle of the accent is based on a varying "accent\_depth"
% The thetas are the angles at the ends, flattened for bold chars,
% but theta could be an arbitrary value


	
iff OK "~":  "Tilde accent";   %******* 1 ACCENT WIDTH  x  .75  ACCENT DEPTH
  beginchar(oct"176",accent_w*width#+b_mono#,
    accent_height#+xheight#+.75accent_depth#,0); 

  save_pairs(end_dir);
  top z2r=(.22w,h)//; 
  bot z4l=(.78w,h-.75accent_depth)//;
  multpos(2,4)(.75[accent_thin_end,accent_thick_end],90-oblique);  
  pos3(.75[accent_thin_end,accent_thick_end],85-oblique);    
     % controls mid-width if angle<>90
  z3=.5[z2,z4]; 
  lft z1r=(0,y4l)//;
  rt z5l=(w,y2r)//;
   end_dir1=if abs(y2r-y1r)>abs(x2r-x1r):upward else:(0,0) fi;
   end_dir2=if abs(y5l-y4l)>abs(x5l-x4l):upward else:(0,0) fi;
   ref1=z1r{end_dir1}...z2r{right};
   ref2=z4l{right}...z5l{end_dir2};
  pos1(accent_thin_end,(angle direction 0 of ref1)+90);
  pos5(accent_thin_end,(angle direction 1 of ref2)+90);

  p1=(z2l{right}...z3l...z4l{right}...z5l{end_dir2}
        if softpath:)softjoin(z5l--z5r)softjoin( else:-- fi z5r{-end_dir2}
      ...z4r{left}...z3r...z2r{left}...z1r{-end_dir1}
        if softpath:)softjoin(z1r--z1l)softjoin( else:-- fi z1l{end_dir1}
      ...z2l{right})--cycle;

  showpoints(1,2,3,4,5);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;


iff OK "x":  "Umlaut (German) or double dot accent"; 
  beginchar(oct"177",accent_w*width#+b_mono#,
    accent_height#+xheight#+2/3accent_depth#,0); 

  save_num(dot_size)=min(accent_dot_diameter,.5w-1);
  lft z1=(0,h-.5dot_size)//;
  rt z2=(w,h-.5dot_size)//;
  p1=dot.l(z1,dot_size);
  p2=dot.r(z2,dot_size);
  showpoints(1,2);

draw (0,xheight)--(w,xheight);
adjust(0+m_a*b_mfit#,0+m_a*b_mfit#); 
show_character; endchar;

% no slant of shape with obliqueness


