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


% punctt.mf  punctuation: for typewriter text set

% 8 characters


iff OK "-":  "Minus sign";
  beginchar(oct"055",.5width#+b_mono#,cap#,0); 
  pickup mathpen;
  lft z1=(0,math_axis)//;
  rt z2=lft z1+(w,0);
  draw z1--z2;
adjust(v_a*fitbasis.uc#+m_a*b_mfit#,v_a*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;

% use different mathpen for softness
% character position, but not shape slants with obliqueness
% must make sure that the plus/minus have the same widths


iff OK "<":  "Less than"; 
  beginchar(oct"074",.4width#+b_mono#,cap#,0); 
  min_limit(join_radius)(.5mathlines);
  lft z2r=lft z4r=(0,math_axis)//;     
  top z1r=(lft x2r+min(w,math_axis+.5h),math_axis+.4h);   
  bot z3r=(lft x2r+min(w,math_axis+.5h),math_axis-.4h);    
  multpos(1,2)(mathlines,angle(z1r-z2r)+90);
  multpos(3,4)(mathlines,angle(z4r-z3r)+90);
  z40=(z1l--z2l)intersectionpoint(z3l--z4l);
 
  p1=(z40 soften(z3l,z3r,z2r,z1r,z1l) z40)--cycle;

  showpoints(1,2,3,4,40);
adjust(v_F*fitbasis.uc#+m_a*b_mfit#,v_H*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;


iff OK ">":  "Greater than"; 
  beginchar(oct"076",.4width#+b_mono#,cap#,0); 
  min_limit(join_radius)(.5mathlines);
  rt z2r=rt z4r=(min(w,math_axis+.5h),math_axis)//;  
  top z1r=(0,math_axis+.4h);   
  bot z3r=(0,math_axis-.4h);    
  multpos(1,2)(mathlines,angle(z1r-z2r)-90);
  multpos(3,4)(mathlines,angle(z4r-z3r)-90);
  z40=(z1l--z2l)intersectionpoint(z3l--z4l);

  p1=(z40 soften(z3l,z3r,z2r,z1r,z1l) z40)--cycle;

  showpoints(1,2,3,4,40);
adjust(v_H*fitbasis.uc#+m_a*b_mfit#,v_F*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;

% character position, but not shape slants with obliqueness
% maximum width=1.5 |math_axis|


iff OK "\":  "Left leaning slash";          % need to add shift if w>.45h
  beginchar(oct"134",.45width#+b_mono#,maxheight#,maxdepth#); 
  pickup  mathpen rotated angle((0,h)//-(min(w,.5(h+d)),-d)//);
  top lft z1=(0,h)//;
  bot rt z2=(min(w,.5(h+d)),-d)//;
  x1:=min(x1,x2-2);          
  draw z1--z2;
adjust(v_H*fitbasis.uc#+m_a*b_mfit#,v_H*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;

% use different mathpen for softness
% limits character to vertical line minus 2 pixels


iff OK "_":  "Underscore"; 
  beginchar(oct"137",.5width#+mono#,cap#,0); 
  pickup mathpen;
  top lft z1=(0,0);
  top rt z2=(w,0);  
  draw z1--z2;
adjust (0,0); show_character; endchar;

% use different mathpen for softness
% no slant of shape with obliqueness
% placement just below the baseline; meant for computer programs where the
%   underscore often has the same token value as a letter




iff OK "{": "Left curly brace"; 
  beginchar(oct"173",.4width#+b_mono#,maxheight#,maxdepth#); 
  
  save_num(width_limit)=min(w,.4(h+d)); 
  z40=(width_limit,.5(h-d));
  z41=(width_limit,h)rotatedaround(z40//,-oblique);
  z42=(width_limit,-d)rotatedaround(z40//,-oblique);

  pos0(max(1,.5thin_stem.uc),90-oblique);  
  pos1(max(1,.75thin_stem.uc),90-oblique);  
  multpos(2,4)(max(1,.75stem.uc),180-oblique);
  pos3(max(1,.5stem.uc),180-oblique);
  pos5(max(1,.75thin_stem.uc),-90-oblique);  
  pos6(max(1,.5thin_stem.uc),-90-oblique);
  multpos(20,21)(2,90-oblique);  

  lft z2r=.25[z41,z42]+.7(.95width_limit,0)rotated(180-oblique);
  lft z3r=.5[z41,z42] +  (.95width_limit,0)rotated(180-oblique);    z20=z3r;
  rt z21 =.5[z41,z42] +  (   width_limit,0)rotated(180-oblique);
  lft z4r=.75[z41,z42]+.7(.95width_limit,0)rotated(180-oblique);
  top z1r=(x41-.2width_limit,h);  
  bot z5r=(x42-.2width_limit,-d);    
  z0r=whatever[z41,z42]; bot y0l=bot y1l;
  z6r=whatever[z41,z42]; top y6l=top y5l;

  ref1=z3l{dir -oblique} i_t z4l{downward} i_t z5l{right}...z6l;
  ref2=z6r...z5r{left} o_t z4r{upward} o_t z20l{-dir -oblique}--z21l--
       z21r--z20r{dir -oblique} o_t z2r{upward} o_t z1r{right}...z0r;
  ref3=z0l...z1l{left} i_t z2l{downward} i_t z3l+(0,epsilon){-dir -oblique};
     
  if softpath:
       p1=ref1 softjoin(z6l--z6r)softjoin ref2 softjoin(z0r--z0l)softjoin ref3
          --cycle;
    else:p1=ref1--ref2--ref3--cycle;  fi 

 showpoints(0,1,2,3,4,5,6,20,21,40,41,42);
adjust(v_H*fitbasis.uc#+m_a*b_mfit#,v_H*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;


iff OK "}": "Right curly brace"; 
  beginchar(oct"175",.4width#+b_mono#,maxheight#,maxdepth#); 
  
  save_num(width_limit)=min(.95w,.4(h+d)); 
  z40=(0,.5(h-d));
  z41=(0,h)rotatedaround(z40//,-oblique);
  z42=(0,-d)rotatedaround(z40//,-oblique);;

  pos0(max(1,.5thin_stem.uc),90-oblique);  
  pos1(max(1,.75thin_stem.uc),90-oblique);  
  multpos(2,4)(max(1,.75stem.uc),-oblique);
  pos3(max(1,.5stem.uc),-oblique);
  pos5(max(1,.75thin_stem.uc),-90-oblique);  
  pos6(max(1,.5thin_stem.uc),-90-oblique);
  multpos(20,21)(2,90-oblique);  

  rt z2r=.25[z41,z42]+ .7(width_limit,0)rotated(-oblique);
  rt z3r=.5[z41,z42] +   (width_limit,0)rotated(-oblique);     z20=z3r;
  rt z21=.5[z41,z42] +(min(w,.4(h+d)),0)rotated(-oblique);
  rt z4r=.75[z41,z42]+ .7(width_limit,0)rotated(-oblique);
  top z1r=(x41+.2width_limit,h);  
  bot z5r=(x42+.2width_limit,-d);    
  z0r=whatever[z41,z42]; bot y0l=bot y1l;
  z6r=whatever[z41,z42]; top y6l=top y5l;

  ref1=z3l{-dir -oblique} i_t z4l{downward} i_t z5l{left}...z6l;
  ref2=z6r...z5r{right} o_t z4r{upward} o_t z20l{dir -oblique}--z21l--
       z21r--z20r{-dir -oblique} o_t z2r{upward} o_t z1r{left}...z0r;
  ref3=z0l...z1l{right} i_t z2l{downward} i_t z3l+(0,epsilon){dir -oblique};
     
  if softpath:
       p1=ref1 softjoin(z6l--z6r)softjoin ref2 softjoin(z0r--z0l)softjoin ref3
          --cycle;
    else:p1=ref1--ref2--ref3--cycle;  fi 

 showpoints(0,1,2,3,4,5,6,20,40,41,42);
adjust(v_H*fitbasis.uc#+m_a*b_mfit#, v_H*fitbasis.uc#+m_a*b_mfit#); 
show_character; endchar;


iff OK "|":  "Vertical bar";         % need to add shift if w>.45h
  beginchar(oct"174",I_w*width#+a_mono#,maxheight#,maxdepth#);  
  pickup mathpen;
  z0=(.5w,.5[-d,h])//;
  top z1=(x0,h);          
  bot z2=(x0,-d);
  draw z1--z2;
adjust(v_A*fitbasis.uc#+m_a*a_mfit#,v_A*fitbasis.uc#+m_a*a_mfit#); 
show_character; endchar;

% use different mathpen for softness
% always vertical; no slant but shifts position with obliqueness
