From: hanwen <hanwen>
Date: Tue, 30 Dec 2003 02:16:04 +0000 (+0000)
Subject: rewrite note head MF code.
X-Git-Tag: release/2.1.4~7
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a80735f691d92d9813658078cfd52afc69b598eb;p=lilypond.git

rewrite note head MF code.
(test_outlines): make heads more rotund for smaller sizes.
---

diff --git a/ChangeLog b/ChangeLog
index 306161c853..bf26638ba9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
+2003-12-30  Han-Wen Nienhuys   <hanwen@cs.uu.nl>
+
+	* mf/feta-bolletjes.mf: rewrite note head MF code.
+	(test_outlines): make heads more rotund for smaller sizes. 
+
 2003-12-29  Han-Wen Nienhuys   <hanwen@cs.uu.nl>
 
 	* mf/feta-params.mf (stafflines): fix stafflinethickness at 0.5 pt
-	throughout. Many fixes.
+	throughout. Font scaling fixes throughout.
 
 	* mf/feta-sleur,slur.mf: remove. 
 
@@ -9,6 +14,8 @@
 
 2003-12-24  Han-Wen Nienhuys   <hanwen@cs.uu.nl>
 
+	* VERSION: release 2.1.3
+
 	* stepmake/stepmake/toplevel-targets.make: remove pfa targets
 
 	* make/lilypond.redhat.spec.in (Group): remove MAKE_PFA_FILES
diff --git a/VERSION b/VERSION
index f62c2cb57d..3ff2a68cfe 100644
--- a/VERSION
+++ b/VERSION
@@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=1
 PATCH_LEVEL=3
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
 
diff --git a/ly/paper19-init.ly b/ly/paper19-init.ly
index 539311117f..377a4bdbd5 100644
--- a/ly/paper19-init.ly
+++ b/ly/paper19-init.ly
@@ -4,8 +4,8 @@
 \version "1.9.8"
 
 paperNineteen = \paper {
-	staffheight = 19.0\pt
-	#(define fonts (make-font-list 'paper19))
+	staffheight = 18.0\pt
+	#(define fonts (scale-font-list  (/ 18.0 20.0) ))
 
 	\include "params-init.ly"
 }
diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf
index b895f96e44..0a9dc06aa0 100644
--- a/mf/feta-bolletjes.mf
+++ b/mf/feta-bolletjes.mf
@@ -19,102 +19,87 @@ numeric black_notehead_width;
 
 fet_begingroup("noteheads");
 
+test_outlines := 0;
+
 noteheight#:=staff_space#+ (1 + overdone_heads) *stafflinethickness#;
-define_pixels(noteheight);
 
-%
 
-%%% TODO: Document these!
+%
+% SLANT moves both extremes on the long axis (by SLANT * ELLIPSIDITY,
+% so SLANT = -1, puts the extreme on the long axis next to the short axis one.)
 %
 
-% setup user vars
-def setup_notehead_vars =
-	save a_b,err_y_a,tilt,superness;
-	save ai_a,ai_bi,err_y_ai,err_x_bi,inner_tilt,inner_superness;
-	save b_h,a_w;
-	enddef;
-
-% setup addititional vars and calc them
-def notehead_calc =
-	save a,beta,ai,bi, ht, wd;
-	ht# =noteheight#;
-	2beta#=ht#*b_h;
-	a# = beta#*a_b;
-	wd# = 2a# / a_w;
-	ai# = a# * ai_a;
-	bi# = ai#/ai_bi;
-	define_pixels(a,beta);
-	define_pixels(ai,bi);
-	set_char_box(0, wd#, .5 ht#, .5 ht#);
-	enddef;
-
-
-% a: x diameter
-% b: y diameter
-% err_x: drift of y axis at top
-% err_y: drift of x axis at right
-def distorted_ellipse(expr a,b,err_y,err_x,super) =
-	superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
-	enddef;
-
-
-
-% draw the outer and inner ellipse.
-def notehead_draw =
-	path black,white;
-	black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
-	white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
-if test > 1: %fixme
-		save x;
-		x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
-		penlabels(1,2,3,4);
-		test_grid;
-else:
-		black:=black rotated tilt;
-		black:=black shifted (w/2,0);
-		white:=white rotated inner_tilt;
-		white:=white shifted (w/2,0);
-fi
-
-	if test = 1:
-		pickup pencircle scaled 1;
-		draw black;
-		draw white;
-	else:
-		fill black;
-		unfill white;
-	fi	
+def draw_outside_ellipse (expr ellipsidity, tilt, superness,
+			slant) =
+	save p;
+	path p;
+
+	p := superellipse ((ellipsidity, 0), (-slant * ellipsidity, 1.0),
+			(- ellipsidity, 0), (slant * ellipsidity, -1.0), superness);
+
+	p := p rotated tilt;
+
+	save top_point, right_point;
+	pair top_point, right_point;
 
-		
-	enddef;
+	top_point := directionpoint left of p;
+	right_point := directionpoint up of p;
 
-def draw_whole_head =
-	setup_notehead_vars;
+	save scaling, width, height;
+
+	scaling# = noteheight# /(2 ypart (top_point));
+	width# := 2 xpart (right_point) * scaling#;
+
+	define_pixels (width, scaling);
 	
-	a_b:=1.80;
-	err_y_a:=0; % no slant
-	tilt:=0;
-	superness:=0.707;
-	ai_a:=0.508;
-	% ai_bi:=1.23;
-	ai_bi:=1.30; % jcn
-	% err_y_ai:=0.0938;
-	% err_x_bi:=0;
-	err_y_ai:=0;
-	err_x_bi:=0.115;
-	% inner_tilt:=135;
-	inner_tilt:=125; % jcn
-	% inner_superness:=0.69;
-	inner_superness:=0.68; % jcn
-	b_h:=1; %no rotate-> no height correction
-	a_w:=1; % no rotate-> no width correction
-
-	notehead_calc;
-	whole_notehead_width# := wd#;
-	notehead_draw;
+	set_char_box (0, width#, noteheight#/2, noteheight#/2);
+
+	p := p scaled scaling shifted (width/2, 0) ;
+	if test_outlines = 1:
+		pickup pencircle scaled 1 ; draw p;
+	else:
+		fill p;
+	fi;
+enddef;
+
+
+def undraw_inside_ellipse (expr ellipsidity, tilt, superness, clearance,
+			center) =
+begingroup
+	save p;
+	path p;
+
+	p := superellipse ((ellipsidity, 0), (0, 1.0),
+			(- ellipsidity, 0), (0, -1.0), superness);
+
+	p := p rotated tilt;
+
+	save top_point, right_point;
+	pair top_point, right_point;
+
+	top_point := directionpoint left of p;
+	right_point := directionpoint up of p;
+
+	save height, scaling;
+
+	height# = staff_space# + stafflinethickness# - clearance;
+	scaling# = height# /(2 ypart (top_point));
+
+	define_pixels (scaling);
+	p := (p scaled scaling) shifted center;
+
+	if test_outlines = 1:
+		pickup pencircle scaled 1; draw p;
+	else:
+		unfill p;
+	fi
+endgroup;
 enddef;
 
 
+
+
+
 %
 % dimensions aren't entirely right.
 %
@@ -124,7 +109,9 @@ fet_beginchar ("Brevis notehead", "-1", "brevishead");
 	fudge = blot_diameter /2;
 	stemthick# = 2 stafflinethickness#;
 
-	draw_whole_head;
+	draw_outside_ellipse (1.80, 0, 0.707, 0);
+	undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#,
+				(w /2, 0));
 
 	pickup pencircle scaled stemthick;
 
@@ -140,170 +127,71 @@ fet_beginchar ("Brevis notehead", "-1", "brevishead");
 
 	draw_gridline(z1,z2,stemthick);
 	draw_gridline(z3,z4,stemthick);
+
 fet_endchar;
 
+
+
 % whole note
 % Wanske, p.38
 fet_beginchar("Whole notehead", "0", "wholehead")
-	draw_whole_head;
-fet_endchar;
+	draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
+	undraw_inside_ellipse (1.30, 125 - puff_up_factor *10,
+			0.68, 2 stafflinethickness#,
+			(w /2, 0));
 
+%	draw_staff_outline (-2, 2, 0.5);
 
-
-% half note
-% Wanske, p.39
-fet_beginchar("Half notehead", "1", 
-	"halfhead")
-	setup_notehead_vars;
-	% a_b:=1.49; % after text
-	a_b:=1.50; % after drawing
-	err_y_a:=0.157;
-	tilt:=34;
-
-	% superness:=0.66;
-	superness:=0.67; % jcn
-
-	% ai_a:=0.863;
-	% was 0.85
-	% set to 0.83 to avoid stem entering white part.
-	ai_a:=0.830; 
-	% ai_bi:=3.14;
-	ai_bi:=3.25;
-	err_y_ai:=0;
-	err_x_bi:=-0.12;
-	inner_tilt:=tilt;
-	inner_superness:=0.80;
-	b_h:=0.935;
-	a_w:=1.12;
-
-	notehead_calc;
-	half_notehead_width# := wd#;
-	notehead_draw;
-
-	define_pixels (wd);
-	if test = 1:
-		pickup penrazor scaled stemthickness;
-		draw (.5 stemthickness, -2 staff_space) ..
-		    (.5 stemthickness, - wd * (ypart dir (inner_tilt - 10)) /2);
-	fi;
 fet_endchar;
 
 
+% half note
+% Wanske, p.39
+fet_beginchar("Half notehead", "1", "halfhead")
+	draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
+	undraw_inside_ellipse (3.25, 33, 0.81,
+		2.5 stafflinethickness#, (w/2, 0));
 
+fet_endchar;
+	
 % quarter note
 % Wanske p.38
 fet_beginchar("Quart notehead", "2", "quarthead")
-	setup_notehead_vars;
-	% a_b:=1.57; % after text
-	a_b:=1.54; % after drawing
-	err_y_a:=0.044;
-	tilt:=32;
-	superness:=0.707;
-	ai_a:=0;
-	ai_bi:=1;
-	err_y_ai:=0;
-	err_x_bi:=0;
-	inner_tilt:=0;
-	inner_superness:=0.707;
-	b_h:=0.85;
-	a_w:=1.09;
-
-	notehead_calc;
-	black_notehead_width# := wd#;
-	notehead_draw;
+	draw_outside_ellipse (1.54 - puff_up_factor / 2.0, 32, 0.707, 0);
+	black_notehead_width# := charwd;
 fet_endchar;
 
 
-% whole note
-% Wanske, p.38
+
+
 fet_beginchar("Whole diamondhead", "0diamond", "wholediamondhead")
-	setup_notehead_vars;
-	
-	a_b:=1.80;
-	err_y_a:=0; % no slant
-	tilt:=0;
-	superness:=0.495;
-	ai_a:=0.350;
-	% ai_bi:=1.23;
-	ai_bi:=1.30; % jcn
-	% err_y_ai:=0.0938;
-	% err_x_bi:=0;
-	err_y_ai:=0;
-	err_x_bi:=0.115;
-	% inner_tilt:=135;
-	inner_tilt:=125; % jcn
-	% inner_superness:=0.69;
-	inner_superness:=0.6; % jcn
-	b_h:=1; %no rotate-> no height correction
-	a_w:=1; % no rotate-> no width correction
-
-	notehead_calc;
-	whole_notehead_width# := wd#;
-	notehead_draw;
-fet_endchar;
+	draw_outside_ellipse (1.80, 0, 0.495, 0);
+	undraw_inside_ellipse (1.30, 125, 0.6,
+			.4 staff_space# +  stafflinethickness#,
+				(w /2, 0));
 
+fet_endchar;
 
 % half note
 % Wanske, p.39
 fet_beginchar("Half diamondhead", "1diamond", 
 	"halfdiamondhead")
-	setup_notehead_vars;
-
-	a_b := 1.50; % after drawing
-	err_y_a:=0.157;
 
-	tilt:=34;
-	superness:=0.49; % jcn
-	ai_a:=0.550; % jcn
-	ai_bi:=3.30; % jcn
+	draw_outside_ellipse (1.50, 34, 0.49, 0.17);
+	undraw_inside_ellipse (3.5, 33, 0.80,
+		.3 staff_space# + 1.5 stafflinethickness#, (w/2, 0));
 
-	err_y_ai:=0;
-	err_x_bi:=-0.12;
-	inner_tilt:=tilt;
-	inner_superness:=0.80;
-
-	b_h:= 1.03;
-	a_w:= 1.2;
-
-	notehead_calc;
-	half_notehead_width# := wd#;
-	notehead_draw;
 fet_endchar;
 
-
 % quarter note
 % Wanske p.38
-fet_beginchar("Quart diamondhead", "2diamond", "diamondhead")
-	set_char_box(0, black_notehead_width#, noteheight#/2, noteheight#/2);
-	save a_b,err_y_a,tilt,superness;
-	save b_h,a_w;
-	save a,beta,ai,bi, ht, wd;
-
-	a_b:= 1.8;
-	err_y_a:=-0.044;
-	b_h:=0.90;
-	a_w:=1.1;
-	tilt:=35;
-	superness:=0.495;
-
-	ht# =noteheight#;
-	2beta#=ht#*b_h;
-	a# = beta#*a_b;
-
-	define_pixels(a,beta);
-
-	black := distorted_ellipse(.72 noteheight, .45 noteheight, -.2 noteheight ,   0, superness)
-				
-%			beta,a*err_y_a,0,superness);
-
-	black:=black rotated tilt;
-	black:=black shifted (w/2,0);
-	fill black;
+fet_beginchar("Quart diamondheadh", "2diamondh", "diamondheadh")
+	draw_outside_ellipse (1.80, 35, 0.495, -0.25);
 fet_endchar;
 
 
-save pent;
-pen_thick# = 2stafflinethickness#;
+save pen_thick;
+pen_thick# = stafflinethickness#  + .1 staff_space#;
 define_pixels(pen_thick);
 
 
diff --git a/mf/feta-macros.mf b/mf/feta-macros.mf
index 6f07c7d2c3..2fd3e72ae8 100644
--- a/mf/feta-macros.mf
+++ b/mf/feta-macros.mf
@@ -27,6 +27,21 @@ fi;
 
 enddef;
 
+% draw the outline of the stafflines. For fine tuning. 
+def draw_staff_outline(expr first, last, offset)=
+if test <> 0:
+	save p;
+	path p;
+	pickup pencircle scaled 2;
+	for i:= first step 1 until last:
+		p := (- staff_space,  (i + offset) * staff_space) .. (4 staff_space,( i+ offset)* staff_space);
+
+		draw p shifted (0, .5 stafflinethickness);
+		draw p shifted (0, -.5 stafflinethickness);
+	endfor
+fi;
+
+enddef;
 
 %
 % Transforms
diff --git a/mf/feta-params.mf b/mf/feta-params.mf
index 4029517579..928828d3fb 100644
--- a/mf/feta-params.mf
+++ b/mf/feta-params.mf
@@ -12,6 +12,15 @@ staff_space#:=staffsize#/(stafflines-1);
 % independent on staff size, and generally 0.5 pt.
 stafflinethickness#  :=0.5 pt#; 
 
+%
+% bigger puff_up_factor, relatively thicker stafflines.
+% 20 pt = puff_up_factor 0.
+% 10 pt = puff_up_factor 1
+%
+puff_up_factor =  (stafflinethickness# - 0.1 staff_space#) / (.1 staff_space#);
+
+
+
 stemthickness# := 1.3 stafflinethickness#;
 ledgerlinethickness# := 2 stafflinethickness#;
 
diff --git a/mf/feta-pendaal.mf b/mf/feta-pendaal.mf
index 9695556381..e2db728882 100644
--- a/mf/feta-pendaal.mf
+++ b/mf/feta-pendaal.mf
@@ -80,6 +80,8 @@ fet_endchar;
 
 % code := 44;  % - = 45
 
+%% ugh. rounded corners!
+
 fet_beginchar("Pedal dash", "-", "pedaldash")
 	set_char_box(0, 3penw#, 0, pedalbh#);
 	pickup pencircle scaled penh;
diff --git a/mf/feta-test-generic.mf b/mf/feta-test-generic.mf
index d48e01932c..4c656d8e59 100644
--- a/mf/feta-test-generic.mf
+++ b/mf/feta-test-generic.mf
@@ -13,6 +13,6 @@ input feta-bolletjes;
 %	input feta-schrift;
 %	input feta-haak;
 %	input feta-timesig;
-	input feta-pendaal;
+%	input feta-pendaal;
 %	input feta-accordion;
 %	input feta-solfa;