From: Werner Lemberg <wl@gnu.org>
Date: Thu, 23 Dec 2004 07:32:14 +0000 (+0000)
Subject: Prepare glyph shapes for mf2pt1 conversion.
X-Git-Tag: release/2.5.14~360
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5b5a15b86fd32bcb057a8e9f58eae6507812ecde;p=lilypond.git

Prepare glyph shapes for mf2pt1 conversion.

* mf/feta-macros.mf, mf_feta-eindelijk.mf: Some formatting.

* mf/feta-toevallig.mf: Formatting.
(draw_meta_sharp): Modify path to replace `filldraw' with `fill'.
("Natural"): Fix paths to allow better postprocessing.
(draw_meta_flat): Use `z3l' as additional point in path to get
better conversion with mf2pt1.
Other minor cleanups.
("3/4 Flat"): Add auxiliary points and modify path to replace
`draw' with `fill'.
("Double Sharp"): Mirror path segments instead of picture elements
to get a single outline.
Modify path to replace `filldraw' with `fill'.
---

diff --git a/ChangeLog b/ChangeLog
index f28b1b931f..1efe2f1937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-12-22  Werner Lemberg  <wl@gnu.org>
+
+	Prepare glyph shapes for mf2pt1 conversion.
+
+	* mf/feta-macros.mf, mf_feta-eindelijk.mf: Some formatting.
+
+	* mf/feta-toevallig.mf: Formatting.
+	(draw_meta_sharp): Modify path to replace `filldraw' with `fill'.
+	("Natural"): Fix paths to allow better postprocessing.
+	(draw_meta_flat): Use `z3l' as additional point in path to get
+	better conversion with mf2pt1.
+	Other minor cleanups.
+	("3/4 Flat"): Add auxiliary points and modify path to replace
+	`draw' with `fill'.
+	("Double Sharp"): Mirror path segments instead of picture elements
+	to get a single outline.
+	Modify path to replace `filldraw' with `fill'.
+
 2004-12-22  Graham Percival  <gperlist@shaw.ca>
 
 	* input/test/unfold-all-repeats.ly: added file back.
diff --git a/mf/feta-eindelijk.mf b/mf/feta-eindelijk.mf
index 126c208869..c0eead5a92 100644
--- a/mf/feta-eindelijk.mf
+++ b/mf/feta-eindelijk.mf
@@ -20,6 +20,7 @@ block_rest_x# = 3/2 staff_space#;
 
 define_pixels (block_rest_y, block_rest_x);
 
+
 def block_rest =
 	draw_block ((0, 0), (block_rest_x, block_rest_y));
 enddef;
@@ -45,8 +46,10 @@ fet_endchar;
 fet_beginchar ("whole rest (outside staff)", "0o")
 	set_char_box (0, block_rest_x#,
 		      block_rest_y#, ledgerlinethickness# / 2);
+
 	block_rest;
 	currentpicture := currentpicture shifted (0, -block_rest_y);
+
 	pickup pencircle scaled ledgerlinethickness;
 
 	y5 = y6 = 0;
@@ -59,7 +62,9 @@ fet_endchar;
 fet_beginchar ("half rest (outside staff)", "1o");
 	set_char_box (0, block_rest_x#,
 		      ledgerlinethickness# / 2, block_rest_y#);
+
 	block_rest;
+
 	pickup pencircle scaled ledgerlinethickness;
 
 	y5 = y6 = 0;
@@ -154,24 +159,27 @@ fet_beginchar ("Quarter rest", "2");
 
 	save before, after;
 	path before, after;
-	before = z11{se} .. {se}z5l;
-	after = z5r{nw} ..tension1.4.. z6l;
+	before = z11{se}
+		 .. {se}z5l;
+	after = z5r{nw}
+		..tension1.4.. z6l;
 	(u, v) = before intersectiontimes after;
 
-	fill z1l{se} ..
-	     {se}z10 ..
-	     z3l ..
-	     subpath(0, u) of before ..
-	     subpath(v, infinity) of after ..tension1.4..
-	     {se}z7l ..
-	     z7r{nw} ..tension1.4..
-	     z6r ..tension1.4..
-	     {se}z5l ..
-	     z5r{nw} ..
-	     {nw}z12 ..
-	     z3r ..
-	     z13{nw} ..
-	     {nw}z1r .. cycle;
+	fill z1l{se}
+	     .. {se}z10
+	     .. z3l
+	     .. subpath (0, u) of before
+	     .. subpath (v, infinity) of after
+	     ..tension1.4.. {se}z7l
+	     .. z7r{nw}
+	     ..tension1.4.. z6r
+	     ..tension1.4.. {se}z5l
+	     .. z5r{nw}
+	     .. {nw}z12
+	     .. z3r
+	     .. z13{nw}
+	     .. {nw}z1r
+	     .. cycle;
 
 	penlabels (1, 2, 3, 4, 5, 6, 7);
 	penlabels (10, 11, 12, 13);
@@ -255,13 +263,13 @@ begingroup;
 	(pt, whatever) = pat intersectiontimes ((0, ycut) -- (w, ycut));
 
 	path res;
-	res = point pt of pat {-direction pt of pat} ..tension 2..
-	      z4{left} ..tension 0.9..
-	      z7 ..
-	      z5{left} ..
-	      z8 ..
-	      z3{right} ..
-	      {curl 0.2}z6;
+	res = point pt of pat {-direction pt of pat}
+	      ..tension 2.. z4{left}
+	      ..tension 0.9.. z7
+	      .. z5{left}
+	      .. z8
+	      .. z3{right}
+	      .. {curl 0.2}z6;
 
 	labels (3, 4, 5, 6, 7, 8, 10);
 res
@@ -291,18 +299,22 @@ def draw_eighth_rest =
 	z2 = z1 + whatever * dir (72);
 	z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
 
-	pat = z1l ---
-	      z2l ..
-	      z9 ..
-	      z2r ---
-	      z1r .. cycle;
+	pat = z1l
+	      --- z2l
+	      .. z9
+	      .. z2r
+	      --- z1r
+	      .. cycle;
 	bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0);
+%	remove_overlap (pat, bulb) () R;
+%	fill R1;
 
-	fill simple_serif (z1l, z1r, 40) ---
-	     z2r ..
-	     z9 ..
-	     bulb ---
-	     z1l .. cycle;
+	fill simple_serif (z1l, z1r, 40)
+	     --- z2r
+	     .. z9
+	     .. bulb
+	     --- z1l
+	     .. cycle;
 
 	penlabels (1, 2);
 	labels (9);
@@ -348,21 +360,23 @@ fet_beginchar ("16th rest", "4");
 	x2r = width;
 	z2 = z1 + whatever*dir(74);
        	z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
-	pat = z1l ---
-	      z2l ..
-	      z9 ..
-	      z2r ---
-	      z1r .. cycle;
+	pat = z1l
+	      --- z2l
+	      .. z9
+	      .. z2r
+	      --- z1r
+	      .. cycle;
 	bulb_a = draw_rest_bulb (0.5 staff_space, y2r, pat, 0.98);
 	bulb_b = draw_rest_bulb (-0.5 staff_space,
 				(-0.5 + 0.2) * staff_space, pat, 1.02);
 
-	fill simple_serif (z1l, z1r, 40) ---
-	     z2r ..
-	     z9 ..
-	     bulb_a ---
-	     bulb_b ---
-	     z1l .. cycle;
+	fill simple_serif (z1l, z1r, 40)
+	     --- z2r
+	     .. z9
+	     .. bulb_a
+	     --- bulb_b
+	     --- z1l
+	     .. cycle;
 
 	penlabels (1, 2);
 	labels (9);
@@ -392,24 +406,26 @@ fet_beginchar ("32th rest", "5");
 	x2r = width;
 	z2 = z1 + whatever * dir (76);
        	z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
-	pat = z1l ---
-	      z2l ..
-	      z9 ..
-	      z2r ---
-	      z1r .. cycle;
+	pat = z1l
+	      --- z2l
+	      .. z9
+	      .. z2r
+	      --- z1r
+	      .. cycle;
 	bulb_a = draw_rest_bulb( 1.5 staff_space, y2r, pat, 0.96);
 	bulb_b = draw_rest_bulb( 0.5 staff_space,
 				 (0.5 + 0.2) * staff_space, pat, 1.00);
 	bulb_c = draw_rest_bulb( -0.5 staff_space,
 				 (-0.5 + 0.21) * staff_space, pat, 1.04);
 
-	fill simple_serif (z1l, z1r, 40) ---
-	     z2r ..
-	     z9 ..
-	     bulb_a ---
-	     bulb_b ---
-	     bulb_c ---
-	     z1l .. cycle;
+	fill simple_serif (z1l, z1r, 40)
+	     --- z2r
+	     .. z9
+	     .. bulb_a
+	     --- bulb_b
+	     --- bulb_c
+	     --- z1l
+	     .. cycle;
 
 	penlabels (1, 2);
 	labels (9);
@@ -439,11 +455,12 @@ fet_beginchar ("64th rest", "6");
 	x2r = width;
 	z2 = z1 + whatever * dir (78);
        	z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
-	pat = z1l ---
-	      z2l ..
-	      z9 ..
-	      z2r ---
-	      z1r .. cycle;
+	pat = z1l
+	      --- z2l
+	      .. z9
+	      .. z2r
+	      --- z1r
+	      .. cycle;
 	bulb_a = draw_rest_bulb (1.5 staff_space, y2r, pat, 0.94);
 	bulb_b = draw_rest_bulb (0.5 staff_space,
 				 (0.5 + 0.20) * staff_space, pat, 0.98);
@@ -452,15 +469,15 @@ fet_beginchar ("64th rest", "6");
 	bulb_d = draw_rest_bulb (-1.5 staff_space,
 				 (-1.5 + 0.22) * staff_space, pat, 1.06);
 
-	fill simple_serif (z1l, z1r, 40) ---
-	     z2r ..
-	     z9 ..
-	     bulb_a ---
-	     bulb_b ---
-	     bulb_c ---
-	     bulb_d ---
-	     z1l .. cycle;
-
+	fill simple_serif (z1l, z1r, 40)
+	     --- z2r
+	     .. z9
+	     .. bulb_a
+	     --- bulb_b
+	     --- bulb_c
+	     --- bulb_d
+	     --- z1l
+	     .. cycle;
 
 	penlabels (1, 2);
 	labels (9);
@@ -490,11 +507,12 @@ fet_beginchar ("128th rest", "7");
 	x2r = width;
 	z2 = z1 + whatever * dir (80);
        	z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
-	pat = z1l ---
-	      z2l ..
-	      z9 ..
-	      z2r ---
-	      z1r .. cycle;
+	pat = z1l
+	      --- z2l
+	      .. z9
+	      .. z2r
+	      --- z1r
+	      .. cycle;
 	bulb_a = draw_rest_bulb (2.5 staff_space, y2r, pat, 0.92);
 	bulb_b = draw_rest_bulb (1.5 staff_space,
 				 (1.5 + 0.20) * staff_space, pat, 0.96);
@@ -505,15 +523,16 @@ fet_beginchar ("128th rest", "7");
 	bulb_e = draw_rest_bulb (-1.5 staff_space,
 				 (-1.5 + 0.23) * staff_space, pat, 1.08);
 
-	fill simple_serif (z1l, z1r, 40) ---
-	     z2r ..
-	     z9 ..
-	     bulb_a ---
-	     bulb_b ---
-	     bulb_c ---
-	     bulb_d ---
-	     bulb_e ---
-	     z1l .. cycle;
+	fill simple_serif (z1l, z1r, 40)
+	     --- z2r
+	     .. z9
+	     .. bulb_a
+	     --- bulb_b
+	     --- bulb_c
+	     --- bulb_d
+	     --- bulb_e
+	     --- z1l
+	     .. cycle;
 
 	penlabels (1, 2);
 	labels (9);
@@ -524,4 +543,4 @@ fet_endchar;
 
 endgroup;
 
-fet_endgroup("rests")
+fet_endgroup ("rests")
diff --git a/mf/feta-macros.mf b/mf/feta-macros.mf
index 2fd3e72ae8..3140d6c6c8 100644
--- a/mf/feta-macros.mf
+++ b/mf/feta-macros.mf
@@ -138,49 +138,56 @@ enddef;
 %
 
 def draw_rounded_block (expr bottom_left, top_right, roundness) =
-       save round;
-       round = floor min(roundness,xpart (top_right-bottom_left),
-                                   ypart (top_right-bottom_left));
- 
- 
-       pickup pencircle scaled round;
-  
-        begingroup;
-        save x,y;
-       z2+(round/2,round/2) = top_right;
-       z4-(round/2,round/2) = bottom_left;
-        y3 = y2;
-        y4 = y1;
-        x2 = x1;
-        x4 = x3;
-       fill bot z1 .. rt z1 --- rt z2 .. top z2 ---
-            top z3 .. lft z3 --- lft z4 .. bot z4 --- cycle;
-        endgroup;
-        enddef;
+begingroup;
+	save round;
+	round = floor min (roundness,
+			   xpart (top_right-bottom_left),
+			   ypart (top_right-bottom_left));
+
+	pickup pencircle scaled round;
+
+	save x, y;
+	z2 + (round / 2, round / 2) = top_right;
+	z4 - (round / 2, round / 2) = bottom_left;
+	y3 = y2;
+	y4 = y1;
+	x2 = x1;
+	x4 = x3;
+
+	fill bot z1
+	     .. rt z1
+	     --- rt z2
+	     .. top z2
+	     --- top z3
+	     .. lft z3
+	     --- lft z4
+	     .. bot z4
+	     --- cycle;
+endgroup;
+enddef;
   
 
+def draw_block (expr bottom_left, top_right) =
+	draw_rounded_block (bottom_left, top_right, blot_diameter);
+enddef;
 
- def draw_block (expr bottom_left, top_right) =
-       draw_rounded_block (bottom_left, top_right, blot_diameter);
-       enddef;
 
- def draw_square_block (expr bottom_left, top_right) =
+def draw_square_block (expr bottom_left, top_right) =
     	save x,y;
 	x1 = xpart bottom_left;
 	y1 = ypart bottom_left;
 	x2 = xpart top_right;
 	y2 = ypart top_right;
 
-
 	fill (x1,y1) --- (x2,y1) --- (x2,y2) --- (x1,y2) --- cycle; 
-       enddef;
+enddef;
 
 
- def draw_gridline (expr bottom_left,top_right,thickness) =
-       draw_rounded_block (bottom_left-(thickness/2,thickness/2),
-                           top_right+(thickness/2,thickness/2),
-                           thickness);
-       enddef;
+def draw_gridline (expr bottom_left, top_right, thickness) =
+	draw_rounded_block (bottom_left - (thickness / 2, thickness / 2),
+			    top_right + (thickness / 2, thickness / 2),
+			    thickness);
+enddef;
        
 
 def draw_brush(expr a,w,b,v) =
diff --git a/mf/feta-toevallig.mf b/mf/feta-toevallig.mf
index 3c20b934c6..b7fcbb05bc 100644
--- a/mf/feta-toevallig.mf
+++ b/mf/feta-toevallig.mf
@@ -1,10 +1,10 @@
-% 
-% feta-toevallig.mf --  implement Accidentals
-% 
+%
+% feta-toevallig.mf -- implement Accidentals
+%
 % source file of the Feta (Font-En-Tja) music font
-% 
+%
 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-% 
+%
 
 
 %
@@ -19,155 +19,164 @@
 %proofing := 2;
 %\tracingequations:= tracingonline := 1;
 
-fet_begingroup("accidentals");
+fet_begingroup ("accidentals");
 
 %
-% The beams of most sharps have horizontal endings (as if drawn with 
-% a square pen).  [Wanske] does not mention this, so we'll just ignore 
-% this fact
+% The beams of most sharps have horizontal endings (as if drawn with
+% a square pen).  [Wanske] does not mention this, so we'll just ignore
+% this fact.
 %
 
 def draw_meta_sharp (expr width) =
-	save interbeam, interstem, beamheight, beamwidth, 
-		stemwidth, beamslope;
-	save spanwidth, spanheight;
-	
+	save interbeam, interstem;
+	save beamheight, beamwidth, beamslope;
+	save spanheight, spanwidth;
+	save stemwidth;
+
 	save center;
 	pair center;
 
 	interbeam := 1.05 staff_space;
 	beamheight := 0.3 staff_space + stafflinethickness;
 	beamwidth := width;
-	stemwidth := 1.0 stafflinethickness + .05 staff_space;
+	stemwidth := stafflinethickness + .05 staff_space;
 	roundness := 2 blot_diameter;
 
 	center := (.5 w, 0);
-	
+
 	roundness + 2 spanwidth = beamwidth;
 	roundness + 2 spanheight = beamheight;
 
 	z2 - z1 = (beamwidth - roundness, beamheight);
-	z1 + z2 = 2*center;
-	beamslope = (y2-y1)/(x2-x1);
+	z1 + z2 = 2 * center;
+	beamslope = (y2 - y1) / (x2 - x1);
 
 	pair hspan, vspan;
 	hspan = (spanwidth, beamslope * spanwidth);
 	vspan = (0, spanheight);
-	
-	path beam;
-	beam := (hspan + vspan -- -hspan 
-		+  vspan -- -hspan -vspan -- hspan - vspan -- cycle )
-		shifted center;
 
 	pickup pencircle scaled roundness;
-	filldraw (beam shifted (0,-interbeam/2));
+	path beam;
+	beam := (rt (hspan + vspan)
+		 .. top (hspan + vspan)
+		 --- top (-hspan + vspan)
+		 .. lft (-hspan + vspan)
+		 --- lft (-hspan - vspan)
+		 .. bot (-hspan - vspan)
+		 --- bot (hspan - vspan)
+		 .. rt (hspan - vspan)
+		 --- cycle) shifted center;
+	fill (beam shifted (0, -interbeam / 2));
 
 	pickup pencircle scaled stemwidth;
 	x3 = x4 = xpart center;
+enddef;
 
 
-	enddef;
-
-fet_beginchar("Sharp" , "2");
-	set_char_box(0, 1.1 staff_space#, 1.5 staff_space#, 
-		1.5 staff_space#);
+fet_beginchar ("Sharp" , "2");
+	set_char_box (0, 1.1 staff_space#,
+		      1.5 staff_space#, 1.5 staff_space#);
 	draw_meta_sharp (w);
 
 	save stemx;
 	stemx := 7 / 32 * w;
 
-	(bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
-	top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
+	(bot y3) + -stemx * beamslope = -1.5 staff_space + ypart center;
+	(top y4) + stemx * beamslope = 1.5 staff_space + ypart center;
 
-	labels(1,2,3,4);
+	labels (1, 2, 3, 4);
 
-	draw_gridline (z3-(stemx,stemx* beamslope),z4-(stemx, stemx*beamslope), stemwidth);
-	addto currentpicture also currentpicture rotated 180 shifted (w,0);
+	draw_gridline (z3 - (stemx, stemx * beamslope),
+		       z4 - (stemx, stemx * beamslope),
+		       stemwidth);
+	addto currentpicture also currentpicture rotated 180 shifted (w, 0);
+fet_endchar;
 
-	fet_endchar;
 
-fet_beginchar("1/2 Sharp" , "1");
-	set_char_box(0, 0.7 staff_space#, 1.5 staff_space#, 
-		1.5 staff_space#);
+fet_beginchar ("1/2 Sharp" , "1");
+	set_char_box (0, 0.7 staff_space#,
+		      1.5 staff_space#, 1.5 staff_space#);
 
 	draw_meta_sharp (w);
 	stemx := 7 / 32 * w;
 
-	(bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
-	top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
+	(bot y3) + -stemx * beamslope = -1.5 staff_space + ypart center;
+	(top y4) + stemx * beamslope = 1.5 staff_space + ypart center;
 
-	labels(1,2,3,4);
+	labels (1, 2, 3, 4);
 
 	draw_gridline (z3, z4, stemwidth);
-	addto currentpicture also currentpicture rotated 180 shifted (w,0);
-
-	fet_endchar;
+	addto currentpicture also currentpicture rotated 180 shifted (w, 0);
+fet_endchar;
 
 
-fet_beginchar("3/4 Sharp" , "3");
-	set_char_box(0, 1.6 staff_space#, 1.5 staff_space#, 
-		1.5 staff_space#);
+fet_beginchar ("3/4 Sharp", "3");
+	set_char_box (0, 1.6 staff_space#,
+		      1.5 staff_space#, 1.5 staff_space#);
 
 	draw_meta_sharp (w);
 	stemx := 9 / 32 * w;
 
-	(bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
-	top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
+	(bot y3) + -stemx * beamslope = -1.5 staff_space + ypart center;
+	(top y4) + stemx * beamslope = 1.5 staff_space + ypart center;
 
-	labels(1,2,3,4);
+	labels (1, 2, 3, 4);
 
-	draw_gridline (z3-(stemx,stemx* beamslope),z4-(stemx, stemx*beamslope), stemwidth);
+	draw_gridline (z3 - (stemx, stemx * beamslope),
+		       z4 - (stemx, stemx * beamslope),
+		       stemwidth);
 	draw_gridline (z3, z4, stemwidth);
 	addto currentpicture also currentpicture rotated 180 shifted (w,0);
+fet_endchar;
 
-	fet_endchar;
 
 %
-% The stems of the natural are brushed (at least, in Barenreiter SCS )
-%
+% The stems of the natural are brushed (at least, in Barenreiter SCS)
 %
 
-fet_beginchar("Natural", "0")
+fet_beginchar ("Natural", "0")
 	save height, xcenter;
-	save interbeam, interstem, beamheight, beamwidth, 
-	stemwidth;
-	save top_stem_thick;
+	save interbeam, interstem;
+	save beamheight, beamwidth;
+	save stemwidth, top_stem_thick;
 
 	beamheight# = 0.35 staff_space# + .5 stafflinethickness#;
 	height# = 1.5 staff_space#;
-	set_char_box(0, 2/3 staff_space#, height#, height#);
 
-	define_pixels(height);
-	define_blacker_pixels(beamheight);
+	set_char_box (0, 2/3 staff_space#, height#, height#);
 
-	top_stem_thick = round (1 stafflinethickness + .09staff_space ) + 0.4;
-	stemwidth = 0.08 staff_space + .5 stafflinethickness;
-	
+	define_pixels (height);
+	define_blacker_pixels (beamheight);
 
-	interstem + stemwidth =  w;
+	top_stem_thick = round (stafflinethickness + .09 staff_space) + 0.4;
+	stemwidth = 0.08 staff_space + .5 stafflinethickness;
 
-	z2 -z1 = (interstem, slope * interstem);
-	xpart .5 [z2,z1] = xcenter ;
-	xcenter = w/2;
+	interstem + stemwidth = w;
 
+	z2 - z1 = (interstem, slope * interstem);
+	xpart .5 [z2, z1] = xcenter;
+	xcenter = w / 2;
 
 	pickup penrazor scaled beamheight rotated 90;
-	top y2 = staff_space - 3/2 stafflinethickness ;
+	top y2 = staff_space - 3/2 stafflinethickness;
 	slope = stafflinethickness / interstem;
-	
-	draw z1 .. z2;
-	draw (xpart z1, -y2) .. (xpart z2, -y1);
+
+	draw z1
+	     .. z2;
+	draw (xpart z1, -y2)
+	     .. (xpart z2, -y1);
+
 	beamtop = top y2;
 
 	pickup pencircle scaled stemwidth;
 	x3 := round (xpart z1);
 	x4 := round (xpart z2);
 
-	penpos3(top_stem_thick, 0);
-	penpos5(top_stem_thick, 0);	
-	penpos4(stemwidth, 0);
-	penpos6(stemwidth, 0);	
-	
+	penpos3 (top_stem_thick, 0);
+	penpos5 (top_stem_thick, 0);
+	penpos4 (stemwidth, 0);
+	penpos6 (stemwidth, 0);
+
 	y3 = height;
 	top y4 = beamtop;
 
@@ -176,45 +185,51 @@ fet_beginchar("Natural", "0")
 	bot y6 = -beamtop;
 	y5 = - height;
 
-	fill simple_serif (z3l, z3r, -30) -- simple_serif(z6r, z6l, -90) -- cycle;
-	fill simple_serif (z5l, z5r, 30) -- simple_serif(z4r, z4l, 90) -- cycle;
-
-
-
-	penlabels(3,4,5,6);
-
-	labels(1,2);
-	fet_endchar;
+	fill simple_serif (z3l, z3r, -30)
+	     -- z6r
+	     .. bot z6
+	     .. z6l
+	     -- cycle;
+	fill simple_serif (z5l, z5r, 30)
+	     -- z4r
+	     .. top z4
+	     .. z4l
+	     -- cycle;
+
+	penlabels (3, 4, 5, 6);
+	labels (1, 2);
+fet_endchar;
 
 
 %
 % Dedicated to my mom.    (3/10/97)
 %
-% Mamma, ik hou van je; kom je alsjeblieft terug? 
+% Mamma, ik hou van je; kom je alsjeblieft terug?
 %    -- HW
 %
 
 % TODO: remove crook_fatness
 % TODO: document, simplify!
 %
-def draw_meta_flat(expr xcenter, w, crook_fatness) =
+def draw_meta_flat (expr xcenter, w, crook_fatness) =
 	clearxy;
 	save crook_thinness;
 	save bottom_overshoot;
 	save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
 	save top_crook_thinness;
-	save zwiep; 
+	save zwiep;
 	save center;
 	pair center;
 	save clearing;
+
 	center = (xcenter, 0);
 
 % the shouldn't reach to the top staff line.
 %% TODO: should take from height.
-	clearing = 1.2 stafflinethickness; 
+	clearing = 1.2 stafflinethickness;
 
 %
-%  TODO: parameterize  this
+%  TODO: parameterize this
 %
 	if w >= 0.75 staff_space:
 		smaller_hole = 0.35 stafflinethickness;
@@ -222,183 +237,235 @@ def draw_meta_flat(expr xcenter, w, crook_fatness) =
 		smaller_hole = 0.0 stafflinethickness;
 	fi
 	crook_thinness = .7 stafflinethickness + .06 staff_space;
-	top_crook_thinness = 1 stafflinethickness + .065 staff_space ;
+	top_crook_thinness = 1 stafflinethickness + .065 staff_space;
 
-	% this is a somewhat heuristic.  We should  probably make it
+	% this is a somewhat heuristic.  We should probably make it
 	% straight for low resolution (300 dpi and less).
-	top_stem_thick = round (0.1 staff_space + 1.2 stafflinethickness) + 0.74;
+	top_stem_thick =
+	  round (0.1 staff_space + 1.2 stafflinethickness) + 0.74;
 
 	bottom_overshoot = stafflinethickness;
-	bottom_stem_thick = 0.06 staff_space +  0.6 stafflinethickness;
-
-	z1 = (0, 2 staff_space) + center - (0, stafflinethickness/2
-		+ clearing);
-	z2 =  (0, - 1/2 staff_space - stafflinethickness/2 )+  center;
+	bottom_stem_thick = 0.06 staff_space + 0.6 stafflinethickness;
 
-	penpos1(top_stem_thick, 0);
-	penpos2(bottom_stem_thick, 0); 
-
-	fill simple_serif(z1r, z1l, 30) -- z2l -- z2r -- cycle;
+	z1 = (0, 2 staff_space)
+	     + center
+	     - (0, stafflinethickness / 2 + clearing);
+	z2 = (0, -1/2 staff_space - stafflinethickness / 2)
+	     + center;
 
+	penpos1 (top_stem_thick, 0);
+	penpos2 (bottom_stem_thick, 0);
 
 	y3l = (staff_space - stafflinethickness) / 2 + ypart center;
-	z3l = whatever [z2r,z1r];
-
+	z3l = whatever [z2r, z1r];
 	z3r = .3 [z2r, z1r] + (smaller_hole, 0);
 
-	z10 = whatever [z2r, z1r] + (smaller_hole , 0);
-	z11 = center + (bottom_overshoot/3,
-		-staff_space/2 - stafflinethickness/2) - (0,bottom_overshoot);
+	% we insert z3l to get better conversion with mf2pt1
+	fill simple_serif (z1r, z1l, 30)
+	     -- z2l
+	     -- z2r
+	     -- z3l
+	     -- cycle;
 
-	penpos4(whatever, 53);
+	z10 = whatever [z2r, z1r] + (smaller_hole, 0);
+	z11 = center
+	      + (bottom_overshoot / 3,
+		 -staff_space / 2 - stafflinethickness / 2)
+	      - (0, bottom_overshoot);
 
-	y4l - y4r =  top_crook_thinness ;
+	penpos4 (whatever, 53);
 
+	y4l - y4r = top_crook_thinness;
 	y5r = .15 staff_space + ypart center;
 	x5l = w + xpart center;
-	y4 = ypart center + staff_space/2;
+	y4 = ypart center + staff_space / 2;
 	x4r = .45 [x5r, x3r];
 
-	penpos5(crook_fatness, -175);
+	penpos5 (crook_fatness, -175);
 
-	save bot_crook_dir ;
-	pair bot_crook_dir ;
-	bot_crook_dir =  unitvector ((x5l,0) - z11);
-	z8 = z11 +  whatever * bot_crook_dir;
-	y8 = - staff_space /2  +0.0* stafflinethickness;
-
-	z7 = z8 + whatever * bot_crook_dir + crook_thinness  * (bot_crook_dir rotated 90);
+	save bot_crook_dir;
+	pair bot_crook_dir;
+	bot_crook_dir = unitvector ((x5l, 0) - z11);
+	z8 = z11 + whatever * bot_crook_dir;
+	y8 = -staff_space / 2 + 0.0 * stafflinethickness;
 
+	z7 = z8
+	     + whatever * bot_crook_dir
+	     + crook_thinness * (bot_crook_dir rotated 90);
 	x7 = .1 [x3r, x8];
 
-	penlabels(range 0 thru 10);
+	penlabels (range 0 thru 11);
 
 	y10 = -1/10 staff_space;
 %	draw_staff (-2, 2, 0.5);
 %	draw_staff (-2, 2, 0.0);
 
-	unfill z3r{z3r-z10} .. z4r{right} .. z5r{down}
-		..  z7{- bot_crook_dir}
-		& z7 % .. tension 1.3
-		.. z10{z3r-z10}
+	unfill z3r{z3r - z10}
+	       .. z4r{right}
+	       .. z5r{down}
+	       .. z7{-bot_crook_dir}
+	       & z7
+	       .. z10{z3r - z10}
+	       -- cycle;
 
-		-- cycle;
 	fill z2l{down}
-		
-		.. z11{right}
-		.. z8{bot_crook_dir}
-		.. z5l{up}
-		.. z4l{left} .. z3l -- cycle;
-		
-	labels(10);
+	     .. z11{right}
+	     .. z8{bot_crook_dir}
+	     .. z5l{up}
+	     .. z4l{left}
+	     .. z3l
+	     -- cycle;
 enddef;
 
-	
+
 %
 % unfortunately, 600dpi is not enough to show the brush of the stem.
 %
-fet_beginchar("Flat", "-2")
-	set_char_box(1.2 stafflinethickness#, .8 staff_space#, 0.6 staff_space#, 1.9 staff_space#);
-	draw_meta_flat(0, w, 0.31 staff_space);
-	fet_endchar;
 
-fet_beginchar("Semi flat", "-1")
-	set_char_box(1.2 stafflinethickness#, .8 staff_space#, 0.6 staff_space#, 1.9 staff_space#);
+fet_beginchar ("Flat", "-2")
+	set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+		      0.6 staff_space#, 1.9 staff_space#);
+	draw_meta_flat (0, w, 0.31 staff_space);
+fet_endchar;
+
+
+fet_beginchar ("Semi flat", "-1")
+	set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+		      0.6 staff_space#, 1.9 staff_space#);
 	draw_meta_flat(0, w, 0.31 staff_space);
-	currentpicture := currentpicture xscaled -1 shifted (w - b, 0);  
-	fet_endchar;
+	currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
+fet_endchar;
 
 
-fet_beginchar("Double Flat", "-4")
+fet_beginchar ("Double Flat", "-4")
 	save left_wid, overlap, right_wid;
 	left_wid = .7;
 	right_wid = .8;
 	overlap = .05;
-	set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .6 staff_space#, 1.9 staff_space#);
-	draw_meta_flat(0, left_wid*  staff_space, 1/3 staff_space);
-	draw_meta_flat(round ((left_wid - overlap) *staff_space),
-		right_wid *staff_space, 0.33 staff_space);
-	fet_endchar;
 
-fet_beginchar("3/4 Flat", "-3")
+	set_char_box (1.2 stafflinethickness#,
+		      (left_wid + right_wid -overlap) * staff_space#,
+		      .6 staff_space#, 1.9 staff_space#);
+	draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
+	draw_meta_flat (round ((left_wid - overlap) * staff_space),
+			right_wid * staff_space, 0.33 staff_space);
+fet_endchar;
+
+
+fet_beginchar ("3/4 Flat", "-3")
 	save left_wid, overlap, right_wid;
 	left_wid = .7;
 	right_wid = .8;
 	overlap = .05;
-	set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .6 staff_space#, 1.9 staff_space#);
-	draw_meta_flat(0, left_wid*  staff_space, 1/3 staff_space);
-	draw_meta_flat(round ((left_wid - overlap) *staff_space),
-		right_wid *staff_space, 0.33 staff_space);
+
+	set_char_box (1.2 stafflinethickness#,
+		      (left_wid + right_wid - overlap) * staff_space#,
+		      .6 staff_space#, 1.9 staff_space#);
+	draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
+	draw_meta_flat (round ((left_wid - overlap) * staff_space),
+			right_wid * staff_space, 0.33 staff_space);
 
 	%% maybe we should clip part of the stems?
 	%% or make the 1st flat smaller?
-	%% or reverse it? 
+	%% or reverse it?
 	pickup pencircle scaled 2 stafflinethickness;
-	z12 = ( - .25 w - b, .55 staff_space);
-	z13 = (  .75 w , 1.45 staff_space);
-	draw z12 -- z13;
-	fet_endchar;
+	z12 = (-.25 w - b, .55 staff_space);
+	z13 = (.75 w, 1.45 staff_space);
+	penpos12 (2 stafflinethickness, angle (z13 - z12) - 90);
+	penpos13 (2 stafflinethickness, angle (z13 - z12) - 90);
+	z14 = z12 - stafflinethickness * unitvector (z13 - z12);
+	z15 = z13 + stafflinethickness * unitvector (z13 - z12);
+
+	fill z13r
+	     .. z15
+	     .. z13l
+	     --- z12l
+	     .. z14
+	     .. z12 r
+	     --- z13r
+	     .. cycle;
+
+	penlabels (12, 13);
+	labels (14, 15);
+fet_endchar;
 
 
-fet_beginchar("Double Sharp", "4")
-	set_char_box(0, staff_space#, .5 staff_space#, .5 staff_space#);
+fet_beginchar ("Double Sharp", "4")
+	set_char_box (0, staff_space#, .5 staff_space#, .5 staff_space#);
 	save klaverblad, klaversteel;
 
 	klaversteel = 1/15 staff_space;
 	klaverblad = .40 staff_space - .5 stafflinethickness;
 
 	z1 = (klaversteel, 0);
-	z2 = (w/2 - klaverblad / 10, h - klaverblad);
-	z3 = (w/2, h);
-	z4 = z2 reflectedabout((0,0), (1,1));
-	z5 = z1 reflectedabout((0,0), (1,1));
+	z2 = (w / 2 - klaverblad / 10, h - klaverblad);
+	z3 = (w / 2, h);
+	z4 = z2 reflectedabout ((0, 0), (1, 1));
+	z5 = z1 reflectedabout ((0, 0), (1, 1));
 
-	labels(1,2,3,4,5);
-	pickup pencircle scaled blot_diameter;
-	filldraw  
-		z1{dir 45} .. {right}z2 -- z3 -- 
-		z4{down} .. {dir 225}z5 .. cycle;
-	
-
-	addto currentpicture also currentpicture yscaled (-d/h);
-	addto currentpicture also currentpicture xscaled (-1);
-
-	% ugh
-	currentpicture := currentpicture  shifted (w/2,0);
+	labels (1, 2, 3, 4, 5);
 
+	save pat;
+	path pat;
 
+	pickup pencircle scaled blot_diameter;
+	pat = (rt z1){dir45}
+	      .. {right}(bot z2)
+	      .. rt z2
+	      --- rt z3
+	      .. top z3
+	      --- top z4
+	      .. (lft z4){down}
+	      .. {dir 225}(top z5);
+	pat := pat
+	       & reverse pat xscaled (-1);
+	pat := pat
+	       & reverse pat yscaled (-d / h)
+	       -- cycle;
+	fill pat;
 
+	% ugh
+	currentpicture := currentpicture shifted (w / 2, 0);
 fet_endchar;
 
 
 def draw_paren =
-  	save leftindent;
+	save leftindent;
 	leftindent# := .2 staff_space#;
-	define_pixels(leftindent);
-  	set_char_box(0, .5 staff_space#+stafflinethickness#,
-	  staff_space#, staff_space#);
-	z1 = (leftindent,h);
-	z2 = (w-stafflinethickness,0);
-	z3 = (leftindent,-d);
-
-	penpos1(stafflinethickness, 35);
-	penpos2(.1 staff_space + stafflinethickness, 0);
-	penpos3(stafflinethickness, -35);
-
-	penlabels(1,2,3);
-	fill z2l{down} .. simple_serif(z3l, z3r, 90) ..	z2r{up}
-	.. simple_serif(z1r, z1l, 90) .. z2l{down} -- cycle;
+	define_pixels (leftindent);
+
+	set_char_box (0, .5 staff_space# + stafflinethickness#,
+		      staff_space#, staff_space#);
+
+	z1 = (leftindent, h);
+	z2 = (w - stafflinethickness, 0);
+	z3 = (leftindent, -d);
+
+	penpos1 (stafflinethickness, 35);
+	penpos2 (.1 staff_space + stafflinethickness, 0);
+	penpos3 (stafflinethickness, -35);
+
+	penlabels (1, 2, 3);
+
+	fill z2l{down}
+	     .. simple_serif (z3l, z3r, 90)
+	     .. z2r{up}
+	     .. simple_serif (z1r, z1l, 90)
+	     .. z2l{down}
+	     -- cycle;
 enddef;
-  
-fet_beginchar("Right Parenthesis", "rightparen")
+
+
+fet_beginchar ("Right Parenthesis", "rightparen")
 	draw_paren;
 fet_endchar;
 
-fet_beginchar("Left Parenthesis", "leftparen")
+
+fet_beginchar ("Left Parenthesis", "leftparen")
 	draw_paren;
-        currentpicture := currentpicture xscaled -1;
-        set_char_box(charwd, charbp, chardp, charht);
+	currentpicture := currentpicture xscaled -1;
+	set_char_box (charwd, charbp, chardp, charht);
 fet_endchar;
 
-fet_endgroup("accidentals");
 
+fet_endgroup ("accidentals");