% txaccent.mf
%
% (c) Copyright 1995, 1996, 1997 J"org Knappen
%
% This file is part of ecfonts version 1.0
%
% Please read the files 00readme.txt, 00inst.txt, 00error.txt, and
% copyrite.txt for further information
%
% You find some documentation in ecdoc.tex (needs LaTeX2e)
%
% ec Version 1.0
%
% Content:
%
% Accents for capital letters

version_check(1,0);  % |version_check| was introduced in dc1.3

% A dirty trick, better left unseen. |cap_height| and |cap_height#|
% are restored at the end of this file.

numeric saved_cap_height; saved_cap_height=cap_height;
cap_height:=hi.x_height;
numeric saved_cap_height#; saved_cap_height#=cap_height#;
cap_height#:=hi.x_height#;

vardef is_cap = true enddef;

ecchar"Grave accent";
beginchar_twice(oct"0",9u#,x_height#,0); % |put_gravis| changes the height
adjust_fit(0,0);
put_gravis;
repeat_once;
endchar;


ecchar"Acute accent"; % using acute from plfonts
beginchar_twice(oct"1",9u#,x_height#,0); % |put_accent| changes the height
italcorr h#*slant-if serifs: 1.5 fi u#;
adjust_fit(0,0);
put_accent;
repeat_once;
endchar;

ecchar"Circumflex (hat) accent";
beginchar(oct"002",9u#,cap_accent_height#,0);
if serifs: italcorr .5[x_height#,h#]*slant+.5hair#-1.75u#;
else: italcorr 2/3[x_height#,h#]*slant-.5stem#+.5vair#-.75u#;
fi
adjust_fit(0,0);
uppercase_hat(.5w,0,1,2,3,4,5);
penlabels(1,2,3,4,5); endchar;

ecchar"Tilde (squiggle) accent";
beginchar(oct"003",9u#,cap_accent_height#,0);
italcorr h#*slant-u#;
adjust_fit(0,0);
uppercase_tilde(0,0,1,2,3,4,5);
penlabels(1,2,3,4,5); endchar;

ecchar"Umlaut (double dot) accent";
beginchar(oct"004",9u#,cap_accent_height#,0);
adjust_fit(0,0);
uppercase_umlaut(0,0,1,2,3,4);
penlabels(1,2,3,4);
endchar;

ecchar"Double acute accent (Long Hungarian umlaut accent)";
beginchar_twice(oct"005",9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-u#;
adjust_fit(0,0);
if monospace: hpos_corr=-2u; put_accent; hpos_corr=2u; put_accent;
else: hpos_corr=-1.5u; put_accent; hpos_corr=1.5u; put_accent; fi
repeat_once;
endchar;

ecchar"Scandinavian circle accent";
beginchar(oct"006",13u#+.5width_adj#,cap_accent_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
y[-1]= cap_height+if hefty: .5 fi accent_gap;
uppercase_circle(.5w,y[-1],1,2,3,4);
penlabels(1,2,3,4); endchar;

ecchar"Hachek (check) accent";
beginchar(oct"007",9u#,cap_accent_height#,0);
adjust_fit(0,0);
uc_hachek_accent(.5w);
endchar;

ecchar"Breve accent";
beginchar(oct"10",9u#,cap_accent_height#,0);
italcorr h#*slant+.5vair#-1.5u#;
adjust_fit(0,0);
uppercase_breve(.5w,0,1,2,3);
penlabels(1,2,3); endchar;

ecchar"Macron (bar) accent";
numeric macron_breadth#; macron_breadth#=.2[vair#,stem#];
beginchar(oct"011",9u#,cap_accent_height#,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;

ecchar"Dot accent";
beginchar_twice(oct"012",5u#,x_height#,0);
adjust_fit(0,0);
put_dot(tiny,max(dot_size#,cap_curve#));
repeat_once;
endchar;

ecchar"Cedilla accent";
beginchar(oct"013",8u#,0,.875desc_depth#);
adjust_fit(0,0);
uppercase_cedilla(.5w,0,1,2,3,4,5);
penlabels(1,2,3,4,5); endchar;

ecchar"Ogonek";
beginchar(oct"014",5u#,0,desc_depth#);
italcorr 0;
adjust_fit(0,0);
ogon_one   := 1;
ogon_two   := 2;
ogon_three := 3;
if serifs:
 x[ogon_one]r=0.7w;
 %+outer_jut;
else:
 x[ogon_one]r=0.6w;
fi
 pickup crisp.nib;
 pos[ogon_one](
    if 0.9vair>currentbreadth: 0.9vair else: currentbreadth+eps fi,-60);
 pos[ogon_two](stem,0);
 pos[ogon_three](vair,145);
 x[ogon_two]=x[ogon_one]-2.5u if monospace: /expansion_factor fi ;
 x[ogon_three]=x[ogon_one]+0.5u if monospace: /expansion_factor fi;
 bot y[ogon_one]r = 0;
 bot y[ogon_three]=0.5(-d-o);  %0.4
 bot y[ogon_two]=0.5(-d-o);
 filldraw stroke z[ogon_one]e{dir 225}...
   z[ogon_two]e{dir -110}...{dir 60}z[ogon_three]e;  % hook
penlabels(1,2,3); endchar;

iff not is_small_cap:
ecchar"Capital tie accent";
beginchar(oct"033",max(6u#,4u#+cap_stem#),uc_acc_height#,0); % same width as `I'
italcorr 4/9[x_height#,uc_acc_height#]*slant+5u#+2letter_fit#+.5hair#;
adjust_fit(if monospace:2u#,2u# else:serif_fit#,serif_fit# fi);
pickup fine.nib; pos1(hair,180); pos2(vround 1/5[vair,stem],90); 
pos3(hair,0);
lft x1r=hround(.5w-.5hair); x2=.5[x1,x3];
rt x3r=hround(w+4.5u+2letter_fit+.5hair);
y1=y3=cap_height + if hefty: .5 fi accent_gap; top y2r=cap_height+acc_height;
filldraw stroke super_arc.e(1,2) & super_arc.e(2,3);  % arc
penlabels(1,2,3); endchar;

iff not is_small_cap:
ecchar"New capital tie accent"; % centered
beginchar(oct"035",9u#,asc_height#,0);
italcorr 4/9[x_height#,uc_acc_height#]*slant+5u#+2letter_fit#+.5hair#;
adjust_fit(if monospace:2u#,2u# else:serif_fit#,serif_fit# fi);
pickup fine.nib; pos1(hair,180); pos2(vround 1/5[vair,stem],90); 
pos3(hair,0);
lft x1r=w-rt x3r=hround(u-.5vair); x2=.5w;
y1=y3=cap_height + if hefty: .5 fi accent_gap; top y2r=cap_height+acc_height;
filldraw stroke super_arc.e(1,2) & super_arc.e(2,3);  % arc
penlabels(1,2,3); endchar;


% Restore original values of |cap_height| and |cap_height#|
cap_height:=saved_cap_height; numeric saved_cap_height;
cap_height#:=saved_cap_height#; numeric saved_cap_height#;

endinput;
