% 
% feta-timesig.mf --  implement Time Signatures
% 
% source file of the Feta (not an abbreviation of Font-En-Tja) music font
% 
% (c) 1998--1999 Mats Bengtsson <matsb@s3.kth.se>,
%		Christian Mondrup <scancm@biobase.dk>

fet_begingroup("timesig");

def set_C_width =
	save left_width, right_width;
	left_width# := 0.9 interline#;
	right_width# := .7 interline#;
	define_pixels(left_width,right_width);
enddef;

def draw_C =
  	save hair, bulb_rad, left_fatness;

  
	hair# := stafflinethickness#;
	bulb_rad# := 0.4 interline#;
	define_pixels(hair, bulb_rad);
	left_fatness = 0.55;
	
	x1r = x5r;
	y1r = .45 interline;
	z2 = (0, interline);
	z3r = (-left_width, 0);
	z4 = (0, -interline);
	z5r = (right_width - stafflinethickness, -0.4 interline);
	
	penpos1(hair, 0);
	penpos2(stafflinethickness, 90);
	penpos3(left_fatness * interline, 180);
	penpos4(stafflinethickness, -90);
	penpos5(hair, -5);
	
	draw_bulb(-1, z1l,  z1r, bulb_rad, .8);

	fill z1l{up} .. z2l{left} .. z3l{down} .. z4l{right} ..
	simple_serif(z5l, z5r, -90) .. 
	z4r{left} .. z3r{up} .. z2r{right} .. z1r -- cycle;
	
%	labels(1,2,3,4,5);
	penlabels(1,2,3,4,5);
enddef;

fet_beginchar ("4/4 meter", "C4/4", "fourfourmeter")
	set_C_width;
	set_char_box(left_width# + interline#, right_width# + interline#, 
		interline#, interline#);
	
	draw_C;
fet_endchar;

fet_beginchar ("2/2 meter", "C2/2", "allabreve")
	set_C_width;
	set_char_box(left_width# + interline#, right_width# + interline#, 
		1.4 interline#, 1.4 interline#);
	
	draw_C;
	save excentricity;
	pair excentricity;
	excentricity = (-1.25 stafflinethickness, 0);

	draw_block((- .75 stafflinethickness, -d) + excentricity, (.75 stafflinethickness , h) + excentricity);
fet_endchar;

path threequartercircle;
threequartercircle = halfcircle & quartercircle rotated 180;

save Cdiameter,Cthickness;
Cdiameter# := 3/2 interline#;
Cthickness# := 2 stafflinethickness#;
define_pixels(Cdiameter,Cthickness);

%% tempus imperfectum cum prolatione imperfecta
fet_beginchar ("Mensural 4/4 meter", "old4/4", "oldfourfourmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 45 scaled Cdiameter;
fet_endchar;

%% tempus imperfectum cum prolatione imperfecta proportio dupla
fet_beginchar ("Mensural 2/2 meter", "old2/2", "oldallabreve")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		interline#, interline#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 45 scaled Cdiameter;
	draw_block((-Cthickness, -d), (0, h));
fet_endchar;

%% tempus perfectum cum prolatione imperfecta
fet_beginchar ("Mensural 3/2 meter", "old3/2", "oldthreetwometer")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw fullcircle scaled Cdiameter;
fet_endchar;

%% tempus imperfectum cum prolatione perfecta
fet_beginchar ("Mensural 6/4 meter", "old6/4", "oldsixfourmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 45 scaled Cdiameter;
	pickup pencircle scaled 4 stafflinethickness;
	draw (0,0);
fet_endchar;

%% tempus perfectum cum prolatione perfecta
fet_beginchar ("Mensural 9/4 meter", "old9/4", "oldninefourmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw fullcircle scaled Cdiameter;
	pickup pencircle scaled 4 stafflinethickness;
	draw (0,0);
fet_endchar;

%% tempus perfectum cum prolatione imperfecta proportio dupla
fet_beginchar ("Mensural 3/4 meter", "old3/4", "oldthreefourmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		interline#, interline#);
	
	pickup pencircle scaled Cthickness;
	draw fullcircle scaled Cdiameter;
	draw_block((-Cthickness/2, -d), (Cthickness/2, h));
fet_endchar;

%% tempus imperfectum cum prolatione perfecta proportio dupla
fet_beginchar ("Mensural 6/8 meter", "old6/8", "oldsixeightmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		 interline#, interline#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 45 scaled Cdiameter;
	pickup pencircle scaled 4 stafflinethickness;
	draw (0,0);
	draw_block((-Cthickness/2, -d), (Cthickness/2, h));
fet_endchar;

%% tempus perfectum cum prolatione perfecta proportio dupla
fet_beginchar ("Mensural 9/8 meter", "old9/8", "oldnineeight")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		interline#, interline#);
	
	pickup pencircle scaled Cthickness;
	draw fullcircle scaled Cdiameter;
	pickup pencircle scaled 4 stafflinethickness;
	draw (0,0);
	draw_block((-Cthickness/2, -d), (Cthickness/2, h));
fet_endchar;

%% tempus imperfectum cum prolatione imperfecta diminutio simplex
fet_beginchar ("Mensural 4/8 meter", "old4/8", "oldfoureightmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
	.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 225 scaled Cdiameter;
fet_endchar;

%% tempus imperfectum cum prolatione perfecta diminutio simplex
fet_beginchar ("Mensural 6/8 meter", "old6/8alt", "oldsixeightmeteralt")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		.5 Cdiameter#, .5 Cdiameter#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 225 scaled Cdiameter;
	pickup pencircle scaled 4 stafflinethickness;
	draw (0,0);
fet_endchar;

%% tempus imperfectum cum prolatione imperfecta diminutio duplex
fet_beginchar ("Mensural 2/4 meter", "old2/4", "oldtwofourmeter")
	set_char_box(.5 Cdiameter# + interline#, .5 Cdiameter# + interline#, 
		interline#, interline#);
	
	pickup pencircle scaled Cthickness;
	draw threequartercircle rotated 225 scaled Cdiameter;
	draw_block((-Cthickness, -d), (0, h));
fet_endchar;

fet_endgroup("timesig");
