% This file is part of vntex. License: GPL.
%
% supplement for T1 encoding (copied from cm/ec sources)

% ec macros
let ecchar = cmchar;
pickup pencircle scaled min(hair,vair); extra_rule.nib := savepen;
vardef xvair = stem*vair#/stem# enddef;
vardef qvair = max(round(xvair), fine + epsilon) enddef;
def end_ligtable = 0 kern 0 enddef;
def lig_CGQ_table(expr k) =
    "C" kern k, "G" kern k, "Q" kern k
enddef;

cmchar "Umlaut (double dot) accent";
numeric dot_diam#,dot_diam;
dot_diam#=max(dot_size#,cap_curve#);
beginchar(oct"004",9u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
italcorr h#*slant+.5dot_diam#-2.25u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=2.75u; top y2r=h+1;
if bot y2l<x_height+o+slab: y2l:=min(y2r-eps,x_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=w-x1;
dot(3,4);  % right dot
penlabels(1,2,3,4); endchar;

cmchar "Scandinavian circle accent";
beginchar(oct"006",13u#+4/3(asc_height#-x_height#)*slant,asc_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric circ_hair,circ_vair;
circ_hair=hround min(hair,u+.5); circ_vair=vround min(vair,(h-x_height)/6+.5);
penpos1(circ_vair,90); penpos3(circ_vair,-90);
penpos2(circ_hair,180); penpos4(circ_hair,0);
x2r=hround(.5w-1.5u-.5circ_hair);
x4r=w-x2r; x1=x3=.5w; y1r=h+apex_o; y2=y4=.5[y1,y3];
y3r=vround(1/3[x_height,h]+apex_o);
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penlabels(1,2,3,4); endchar;

cmchar "Hachek (check) accent";
beginchar(oct"007",9u#,.75[x_height#,min(asc_height#,2x_height#)],0);
h':=vround min(asc_height,2x_height); % height of circumflex being inverted
if serifs: italcorr h#*slant+.5hair#-1.75u#;
 adjust_fit(0,0);
 pickup crisp.nib; pos2'(.5[vair,curve],90); top y2'r=h;
 pos2(.5[vair,curve],90); x2=.5w;
 x1=w-x3=good.x 2.25u; top y1=top y3=h; y1-y2=.5(y2'-x_height);
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: italcorr h#*slant-.5stem#+.5vair#-.75u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(vair,0); pos3(vair,0); x1=w-x3;
 pos2(stem,0); bot y2=vround(1/12[x_height,h']+o); x2=.5w;
 top y1=top y3=h+o; lft x1l=hround(rt x2r-3.25u-.5vair);
 z0=whatever[z1r,z2r]=whatever[z2l,z3l];
 y4l=y4r=y2; x4l=good.x .2[x2l,x2]; x4r=w-x4l;
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

cmchar "Macron (bar) accent";
numeric macron_breadth#; macron_breadth#=.2[vair#,stem#];
beginchar(oct"011",9u#,.4[x_height#,asc_height#]+macron_breadth#,0);
italcorr h#*slant-.75u#;
adjust_fit(0,0);
numeric macron_breadth; macron_breadth:=Vround .2[vair,stem];
pickup if serifs: crisp.nib else: fine.nib fi;
pos1(macron_breadth,90); pos2(macron_breadth,90);
top y1r=top y2r=h+o; lft x1=w-rt x2=hround 1.25u;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

iff ligs>0: cmchar "Dot accent";
numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
beginchar(oct"012",5u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
define_whole_blacker_pixels(dot_diam);
italcorr h#*slant+.5dot_diam#-2u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=.5w; top y2r=h+1;
if bot y2l<x_height+o+slab: y2l:=min(y2r-eps,x_height+o+slab+.5tiny); fi
y1=.5[y2l,y2r]; dot(1,2);  % dot
penlabels(1,2); endchar;

cmchar "Cedilla accent";
beginchar(oct"013",8u#,0,.875desc_depth#);
adjust_fit(0,0);
x1=.5w+.5u;
if serifs: pickup crisp.nib; pos1(stem,0); pos2(stem,0);
 pos3(vair,90); pos4(stem,0); pos5(vair,-90);
 x1=x2; z3l=z2l; x4=x2+1.5u; x5=x3-1.5u;
 bot y1=-o; bot y2=-vround 2/7d-o; y4=.5[y3,y5]; bot y5=-d-o;
 filldraw stroke z1e--z2e;  % stem
 filldraw stroke z3e{right}...z4e{down}...{left}z5e;  % hook
else: pickup fine.nib; pos1(vair,0); top y1=-o-2;
 pos2(.5[vair,stem],0); bot y2=-d-o; x2=x1-1.25u;
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2,3,4,5); endchar;

cmchar "German opening comma"; % same as comma
numeric dot_diam#; dot_diam#=if monospace: 5/4 fi\\ dot_size#;
define_whole_blacker_pixels(dot_diam);
beginchar(oct"015",5u#,dot_diam#,comma_depth#);
adjust_fit(0,0);
x1-.5dot_diam=hround(.5w-.5dot_diam); y1-.5dot_diam=0;
comma(1,a,dot_diam,.2u,comma_depth);  % dot and tail
penlabels(1); endchar;

ecchar "Single left guillemet"; % jk
beginchar(oct"016",8u#,2bar_height#,0);
italcorr h#*slant-u#;
adjust_fit(0,0);
 pickup fine.nib;
 pos1(qvair,0); pos2(if monospace: qvair else: stem fi,0); pos3(qvair,0);
 rt x1r=rt x3r=w-2u-eps;
 lft x2l=hround(if not monospace: 2 fi\\ u)-eps;
 bot y3=0; y2=good.y(h/2); top y1=2y2;
 if not serifs or monospace:
  filldraw stroke z1e--z2e--z3e;
 else:
  filldraw stroke
   z1e{(x2e-x1e),1.8(y2e-y1e)}..{curl1}z2e{curl1}..
   {(x3e-x2e),1.8(y3e-y2e)}z3e;
 fi
 penlabels(1,2,3);
endchar;

ecchar "Single right guillemet"; % jk
beginchar(oct"017",8u#,2bar_height#,0);
italcorr h#*slant-u#;
adjust_fit(0,0);
 pickup fine.nib;
 pos1(qvair,0); pos2(if monospace: qvair else: stem fi,0); pos3(qvair,0);
 lft x1l=lft x3l=2u+eps;
 rt x2r=w-hround(if not monospace: 2 fi\\ u)+eps;
 bot y3=0; y2=good.y(h/2); top y1=2y2;
 if not serifs or monospace:
  filldraw stroke z1e--z2e--z3e;
 else:
  filldraw stroke
   z1e{(x2e-x1e),1.8(y2e-y1e)}..{curl1}z2e{curl1}..
   {(x3e-x2e),1.8(y3e-y2e)}z3e;
 fi
penlabels(1,2,3); endchar;

cmchar "Opening quotes";
beginchar(oct"020",7u#+max(2u#,dot_size#),asc_height#,0);
italcorr asc_height#*slant-.1u#;
adjust_fit(0,0);
x2+.5dot_size=hround(w-.6u); y1+.5dot_size=h-comma_depth;
x2-x1=hround(1.5u+max(2u,dot_size)); y2=y1;
ammoc(1,a,dot_size,.25u,comma_depth); % left dot and tail
ammoc(2,b,dot_size,.25u,comma_depth); % right dot and tail
penlabels(1,2); endchar;

cmchar "Closing quotes";
beginchar(oct"021",7u#+max(2u#,dot_size#),asc_height#,0);
italcorr asc_height#*slant+dot_size#-4.1u#;
adjust_fit(0,0);
x1-.5dot_size=hround .6u; y2+.5dot_size=h;
x2-x1=hround(1.5u+max(2u,dot_size)); y2=y1;
comma(1,a,dot_size,.25u,comma_depth); % left dot and tail
comma(2,b,dot_size,.25u,comma_depth); % right dot and tail
penlabels(1,2); endchar;

ecchar "German Opening quotes";
numeric dot_diam#; dot_diam#=if monospace: 5/4 fi\\ dot_size#;
define_whole_blacker_pixels(dot_diam);
beginchar(oct"022",3u#+max(2u#,dot_diam#),dot_diam#,comma_depth#);
italcorr asc_height#*slant+dot_diam#-4.1u#;
adjust_fit(.5u#,.5u#);
x2+.5dot_diam=hround(w-.6u+.5dot_diam); y2-.5dot_diam=0;
x1=w-x2; y2=y1;
comma(1,a,dot_diam,.25u,comma_depth); % left dot and tail
comma(2,b,dot_diam,.25u,comma_depth); % right dot and tail
penlabels(1,2); endchar;

ecchar "French opening quotes"; % from pl_cud (plfonts)
beginchar(
 if not hefty: oct"023",10u#,2bar_height#,0
 else:         oct"023",12u#,2bar_height#,0 
 fi);
italcorr h#*slant-u#;
adjust_fit(0,0);
 pickup fine.nib;
 numeric the_shift,shift_corr;
 the_shift=hround(max(3u,1.7stem)); shift_corr=the_shift-3u;
 pos1(qvair,0); pos2(if monospace: qvair else: stem fi,0); pos3(qvair,0);
 rt x1r=rt x3r=hround(.6w-shift_corr)-eps;
 lft x2l=hround(if not monospace: 2 fi\\ u-shift_corr)-eps;
 bot y3=0; y2=good.y(h/2); top y1=2y2;
 for i:=1,2,3:
  forsuffixes $:=r, ,l: z[i]'$=z[i]$ + the_shift*right; endfor
 endfor
 if not serifs or monospace:
  filldraw stroke z1e--z2e--z3e; filldraw stroke z1'e--z2'e--z3'e;
 else:
  filldraw stroke
   z1e{(x2e-x1e),1.8(y2e-y1e)}..{curl1}z2e{curl1}..
   {(x3e-x2e),1.8(y3e-y2e)}z3e;
  filldraw stroke
   z1'e{(x2'e-x1'e),1.8(y2'e-y1'e)}..{curl1}z2'e{curl1}..
   {(x3'e-x2'e),1.8(y3'e-y2'e)}z3'e;
 fi;
 penlabels(1,2,3,1',2',3');
endchar;

ecchar "French closing quotes"; % from pl_cud (plfonts)
beginchar(
 if not hefty: oct"024",10u#,2bar_height#,0
 else:         oct"024",12u#,2bar_height#,0
 fi);
italcorr h#*slant-u#;
adjust_fit(0,0)
 pickup fine.nib;
 numeric the_shift,shift_corr;
 the_shift=hround(max(3u,1.7stem)); shift_corr=the_shift-3u;
 pos1(qvair,0); pos2(if monospace: qvair else: stem fi,0); pos3(qvair,0);
 lft x1l=lft x3l=w-hround(.6w-shift_corr)+eps;
 rt x2r=w-hround(if not monospace: 2 fi\\ u-shift_corr)+eps;
 bot y3=0; y2=good.y(h/2); top y1=2y2;
 for i:=1,2,3:
  forsuffixes $:=r, ,l: z[i]'$=z[i]$ + the_shift*left; endfor
 endfor
 if not serifs or monospace:
  filldraw stroke z1e--z2e--z3e; filldraw stroke z1'e--z2'e--z3'e;
 else:
  filldraw stroke
   z1e{(x2e-x1e),1.8(y2e-y1e)}..{curl1}z2e{curl1}..
   {(x3e-x2e),1.8(y3e-y2e)}z3e;
  filldraw stroke
   z1'e{(x2'e-x1'e),1.8(y2'e-y1'e)}..{curl1}z2'e{curl1}..
   {(x3'e-x2'e),1.8(y3'e-y2'e)}z3'e;
 fi;
% italic correction is set to |0| in |beginchar|, so let's correct it
%  corrital z2r;
 penlabels(1,2,3,1',2',3');
% repeat_once;
endchar;

cmchar "En dash";
beginchar(oct"025",9u#,x_height#,0);
italcorr .61803x_height#*slant+.5u#;
adjust_fit(0,0);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(.61803h+.5vair); lft x1=-eps; rt x2=w+eps;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

cmchar "Em dash";
beginchar(oct"026",18u#,x_height#,0);
italcorr .61803x_height#*slant+.5u#;
adjust_fit(letter_fit#,letter_fit#);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(.61803h+.5vair); lft x1=-eps; rt x2=w+eps;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

ecchar "Compound word mark";
beginchar(oct"027",0,x_height#,0);
zero_width;
endchar;

ecchar "Zero for p mille sign";
beginchar(oct"030",if serifs:
   if monospace: 9u#+max(6u#,2fudge*(hair#+stem#)) else: 7u# fi else: 8u# fi,
  body_height#,body_height#-asc_height#);
italcorr if hefty: .4asc_height#*slant-.5u# else: h#*slant-u# fi;
adjust_fit(0,0); pickup fine.nib;
numeric left_curve,right_curve;
left_curve=hround 5/6[fudged.hair,fudged.stem];
right_curve=max(fine.breadth,hround(fudged.hair if hefty:-2stem_corr fi));
pos1(vair,90);
pos2(left_curve,180);
pos3(vair,270);
pos4(right_curve,360);
bot y3r=-d;
rt x4r=hround(.5w +2.5u );
lft x2r=hround(.5w -2.5u ) ;
top y1r=vround(if monospace: .3 else: .5 fi\\ asc_height);
x1=x3=.5[x2,x4]; y2=y4=.5[y1,y3];
filldraw stroke pulled_super_arc.e(1,2)(superpull)
 & pulled_super_arc.e(2,3)(superpull);  % left half of lower bowl
filldraw stroke super_arc.e(3,4) & super_arc.e(4,1); % right half of lower bowl
penlabels(1,2,3,4); endchar;

cmchar "Dotless letter i";
beginchar(oct"031",5u#,x_height#,0);
italcorr x_height#*slant-serif_fit#+.5stem#-2u#;
adjust_fit(serif_fit#+stem_shift# if monospace:+.25u#fi,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=x_height if serifs: +min(oo,serif_drop) fi; bot y2=0;
filldraw stroke z1e--z2e;  % stem
if serifs: sloped_serif.l(1,2,a,1/3,.95jut,serif_drop);  % upper serif
 dish_serif(2,1,b,1/3,jut,c,1/3,.9jut); fi  % lower serif
penlabels(1,2); endchar;

iff hefty: % Sans or typewriter
ecchar "Blank-space sign";
beginchar(oct"040",9u#,x_height#,.5desc_depth#);
italcorr bar_height#*slant-.25u#;
adjust_fit(0,0);
numeric thin_vair#; thin_vair#=.7vair#;
define_whole_blacker_pixels(thin_vair);
h:=bar_height;
forsuffixes $=1,2,3,4: penpos$(thin_vair,0); endfor
penpos0(thin_vair,90); x0=.5w; y0l=vround(-d-.5thin_vair);
x1=x2; x3=x4=w-x1; lft x1l=hround .75u;
y1=y4=h; y2=y3=y0;
fill z1l---z2l...(x2,y0l)---(x3,y0l)...z3r---z4r
 ..z4l---(x3l,y0r)--(x2r,y0r)---z1r..cycle;  % the stroke
penlabels(0,1,2,3,4); endchar;

iff not hefty: % Other than the above mentioned
ecchar "Blank-space sign"; % jk
beginchar(oct"040",9u#,x_height#,.5desc_depth#);
italcorr bar_height#*slant-.25u#;
adjust_fit(0,0);
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(hair,0);
bot y1r=-d; x1=.5w; rt x2r=hround(w-.75u); y2=good.y(y1l+.5beak)+eps;
arm(1,2,a,beak_darkness,2beak_jut);  % lower right arm and beak
pos3(hair,180); x3=w-x2; y3=y2;
arm(1,3,b,beak_darkness,-2beak_jut);  % lower left arm and beak
math_fit(0,.5ic#);
penlabels(1,2,3); endchar;

ecchar "Straight double quotes";
beginchar(oct"042",9u#,asc_height#,0);
numeric top_width#,spread#;
top_width#=if serifs: flare# else: stem# fi;
spread#=max(3u#,top_width#+.5u#); define_pixels(spread);
italcorr asc_height#*slant+.5top_width#+.5spread#-4u#;
adjust_fit(0,0);
x1=x2; x3=x4=w-x1; x3-x1=spread+2; y1=y3;
y2=y4=max(.5[bar_height,x_height]+.5vair,h-x_height);
if serifs: pickup crisp.nib; pos1(flare,0); pos2(vair,0);
 pos3(flare,0); pos4(vair,0);
 y1+.5stem=h; filldraw circ_stroke z1e--z2e;  % left stem and bulb
 filldraw circ_stroke z3e--z4e;  % right stem and bulb
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0);
 top y1=h; filldraw stroke z1e--z2e;  % left stem
 filldraw stroke z3e--z4e; fi  % right stem
penlabels(1,2,3,4); endchar;

cmchar "Hyphen";
beginchar("-",6u#,x_height#,0);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric thickness; thickness=if hefty:bar else:.75[hair,stem] fi;
pickup crisp.nib; pos1(thickness,90); pos2(thickness,90);
top y1r=top y2r=vround(.5h+.5thickness); rt x2=hround(w-u)+eps;
if monospace: x2=w-x1 else: lft x1=hround .2u-eps fi;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

ecchar "Less than sign";
compute_spread(5/4x_height#,3/2x_height#);
beginchar("<",14u#,v_center(spread#+rule_thickness#));
italcorr h#*slant-u#;
adjust_fit(0,0); pickup extra_rule.nib;
lft x2=hround 1.5u-eps; x1=x3=w-x2;
y1-y3=spread; y2=.5[y1,y3]=math_axis;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

ecchar "Greater than sign";
compute_spread(5/4x_height#,3/2x_height#);
beginchar(">",14u#,v_center(spread#+rule_thickness#));
italcorr math_axis#*slant-u#;
adjust_fit(0,0); pickup extra_rule.nib;
rt x2=hround(w-1.5u)+eps; x1=x3=w-x2;
y1-y3=spread; y2=.5[y1,y3]=math_axis;
draw z1--z2--z3;  % diagonals
labels(1,2,3); endchar;

ecchar "Reverse slash (backslash)";
beginchar(oct"134",9u#,body_height#,paren_depth#);
adjust_fit(0,0); pickup extra_rule.nib;
lft x1=hround u-eps; top y1=h+eps;
rt x2=hround(w-u)+eps; bot y2=-d-eps;
draw z1--z2;  % diagonal
labels(1,2); endchar;

cmchar "Circumflex (hat) accent";
beginchar(oct"136",9u#,min(asc_height#,2x_height#),0);
if serifs: italcorr .5[x_height#,h#]*slant+.5hair#-1.75u#;
 adjust_fit(0,0);
 pickup crisp.nib; pos2(.5[vair,curve],90); top y2r=h; x2=.5w;
 x1=w-x3=good.x 2.25u; y1=y3=.5[x_height,y2];
 pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
 filldraw stroke z1e--z2e--z3e;  % diagonals
else: italcorr 2/3[x_height#,h#]*slant-.5stem#+.5vair#-.75u#;
 adjust_fit(0,0);
 pickup fine.nib; pos1(vair,0); pos3(vair,0); x1=w-x3;
 pos2(stem,0); top y2=h; x2=.5w; bot y1=bot y3=vround 2/3[h,x_height]-eps;
 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=w-x4l;
 filldraw z4l--z1l--z1r--z0--z3l--z3r--z4r--cycle; fi  % diagonals
penlabels(0,1,2,3,4); endchar;

ecchar "Underbar";
compute_spread((5/8+.45)*x_height#,(3/4+.55)*x_height#);
beginchar(oct"137",14u#,0,spread#-math_axis#+.5rule_thickness#);
adjust_fit(0,0); pickup rule.nib;
lft x1=hround 1.5u-eps; x2=w-x1; bot y1=bot y2=-d;
draw z1--z2;  % bar
labels(1,2); endchar;

ecchar "Left curly brace";
beginchar(oct"173",9u#,body_height#,paren_depth#);
italcorr body_height#*slant+.5vair#-u#;
adjust_fit(0,0); pickup fine.nib;
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor
forsuffixes $=2,3,5,6: pos$(stem,0); endfor
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
lft x4l=hround(1.5u-.5vair); lft x2l=hround(.5w-.5stem);
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
y1-y2=y3-y4=(y1-y4)/4; y1-y1'=y4-y4'=y7'-y7=vair-fine;
filldraw z1l{left}...z2l---z3l...{left}z4l
 --z4'l{right}...z5l---z6l...{right}z7l
 --z7r--z7'r{left}...z6r---z5r...{left}.5[z4r,z4'r]{right}
 ...z3r---z2r...{right}z1'r--z1r--cycle;  % stroke
penlabels(1,2,3,4,5,6,7); endchar;

ecchar "Right curly brace";
beginchar(oct"175",9u#,body_height#,paren_depth#);
italcorr math_axis#*slant+.5vair#-u#;
adjust_fit(0,0); pickup fine.nib;
forsuffixes $=1,1',4,4',7,7': pos$(vair,0); endfor
forsuffixes $=2,3,5,6: pos$(stem,0); endfor
x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
rt x4r=hround(w-1.5u+.5vair); rt x2r=hround(.5w+.5stem);
top y1=h; bot y7=-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
y1-y2=y3-y4=(y1-y4)/4; y1-y1'=y4-y4'=y7'-y7=vair-fine;
filldraw z1r{right}...z2r---z3r...{right}z4r
 --z4'r{left}...z5r---z6r...{left}z7r
 --z7l--z7'l{right}...z6l---z5l...{right}.5[z4l,z4'l]{left}
 ...z3l---z2l...{left}z1'l--z1l--cycle;  % stroke
penlabels(1,2,3,4,5,6,7); endchar;

ecchar "Vertical line";
beginchar(oct"174",5u#,body_height#,paren_depth#);
italcorr body_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0); pickup rule.nib;
x1=x2=good.x .5w; top y1=h+eps; bot y2=-d-eps;
draw z1--z2;  % stem
labels(1,2); endchar;

cmchar "Tilde (squiggle) accent";
beginchar(oct"176",9u#,min(asc_height#,10/7x_height#+.5dot_size#),0);
italcorr h#*slant-u#;
adjust_fit(0,0);
if serifs: numeric theta; theta=angle(1/6(6u-vair),1/4(h-x_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=w-rt x4l=hround 1.5u; top y4r=h;
 bot y1l=vround(bot y1l+min(2/3[x_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=w-rt x5l=hround 1.5u; x2-x1=x3-x2=x4-x3=x5-x4;
 bot y1=bot y4l=vround(.75[x_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 not monospace:
ecchar "Hyphenchar";
beginchar(oct"177",3u#,x_height#,0);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric thickness; thickness=if hefty:bar else:.75[hair,stem] fi;
pickup crisp.nib; pos1(thickness,90); pos2(thickness,90);
top y1r=top y2r=vround(.5h+.5thickness); rt x2=hround(2w-u)+eps;
lft x1=hround .2u-eps;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

iff monospace:
ecchar "Hyphenchar";
beginchar(oct"177",3u#,x_height#,0);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric thickness; thickness=if hefty:bar else:.75[hair,stem] fi;
pickup crisp.nib; pos1(thickness,90); pos2(thickness,90);
top y1r=top y2r=vround(.5h+.5thickness); rt x2=hround(w-u)+eps;
x2=w-x1;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

endinput;
