lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for yet again new noteheads (triangle-shaped)


From: Maximilian Albert
Subject: Patch for yet again new noteheads (triangle-shaped)
Date: Tue, 03 Apr 2007 21:37:40 +0200
User-agent: IceDove 1.5.0.10 (X11/20070329)

Hi everyone,

here are patches (contain metafont source and doc additions) for the
other kind of notehead requested by Trevor and Jamie some time ago. They
implement two slightly differing styles, namely 'outward-pointing' and
'inward-pointing' triangles. This means that the tips of the triangles
either point away from the stem or towards the stem. See the attached
*.pdf file for illustration.

Comments are welcome. If there is no objection it would be great if they
could be included in the next development release.

Thanks a lot,
Max
>From a173abd5a73de8b97f8aea6fc8342857dda993ac Mon Sep 17 00:00:00 2001
From: Maximilian Albert <address@hidden>
Date: Tue, 3 Apr 2007 21:27:55 +0200
Subject: [PATCH] New noteheads: Two styles of triangles ('outward'-pointing and 
'inward'-pointing) with centered stem

---
 mf/feta-bolletjes.mf |  107 ++++++++++++++++++++++++++++++++++++++++++++++++++
 scm/output-lib.scm   |    2 +
 2 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf
index 36abfcf..7bee94a 100644
--- a/mf/feta-bolletjes.mf
+++ b/mf/feta-bolletjes.mf
@@ -1484,6 +1484,113 @@ fet_beginchar ("Quart down tihead", "d2ti");
 fet_endchar;
 
 
+%%%%%%%%
+%
+% Downward pointing triangle with centered stem (the shape is 
+% the same as for the 'do' notehead in the solfa section, albeit 
+% a bit smaller; for drawing we use an adapted version of the 
+% function draw_do_head).
+%
+
+def draw_dreieck (expr width_factor, dir, outward_inward) =
+       save p_down, p_up;
+       save left_dist_up, right_dist_up;
+       save left_dist_down, right_dist_down;
+       save clearing_factor;
+       path p_down, p_up;
+       pair left_dist_up, right_dist_up;
+       pair left_dist_down, right_dist_down;
+
+       clearing_factor := 0.5 stafflinethickness# / solfa_noteheight#;
+       
+       set_char_box (0, width_factor * solfa_base_notewidth#,
+                     0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+
+       pickup pencircle scaled solfa_pen_thick;
+
+       bot y1 = -d + 1.5 clearing_factor * (h + d);
+       y1 = y2;
+       lft x1 = 0 + clearing_factor * w;
+       rt  x2 = w - clearing_factor * w;
+       top y3 = h - 0.5 clearing_factor * (h + d);
+       x3 =.5 [x1, x2];
+
+       left_dist_up = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
+       right_dist_up = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
+
+       p_up := bot z1
+               -- bot z2{right}
+               .. rt z2{up}
+               .. (z2 + right_dist_up){z3 - z2}
+               -- (z3 + right_dist_up){z3 - z2}
+               .. top z3{left}
+               .. (z3 + left_dist_up){z1 - z3}
+               -- (z1 + left_dist_up){z1 - z3}
+               .. lft z1{down}
+               .. {right}cycle;
+
+       z4 = (0, (h - d)/2);
+       z5 = (w, (h - d)/2);
+
+       z6 = z1 reflectedabout (z4, z5);
+       z7 = z2 reflectedabout (z4, z5);
+       z8 = z3 reflectedabout (z4, z5);
+
+       right_dist_down = (unitvector (z8 - z7) rotated 90) * 0.5 
solfa_pen_thick;
+       left_dist_down  = (unitvector (z6 - z8) rotated 90) * 0.5 
solfa_pen_thick;
+
+       p_down := top z6
+                 -- top z7{right}
+                 .. rt z7{down}
+                 .. (z7 + right_dist_down){z8 - z7}
+                 -- (z8 + right_dist_down){z8 - z7}
+                 .. bot z8{left}
+                 .. (z8 + left_dist_down){z6 - z8}
+                 -- (z6 + left_dist_down){z6 - z8}
+                 .. lft z6{up}
+                 .. {right}cycle;
+
+       if dir = outward_inward:
+               fill p_down;
+               labels (6, 7, 8);
+       else:
+               fill p_up;
+               labels (1, 2, 3);
+       fi;
+       labels (4, 5);
+
+       if     (dir = +1) and (outward_inward = +1):
+               z9 = top 0.5[z6, z7] shifted (stemthickness/2 , 
-stemthickness/2);
+       elseif (dir = +1) and (outward_inward = -1):
+               z9 = z3 shifted (stemthickness/2, 0 - stemthickness/2);
+       elseif (dir = -1) and (outward_inward = +1):
+               z9 = z3 shifted (stemthickness/2, 0 - stemthickness/2);
+       elseif (dir = -1) and (outward_inward = -1):
+               z9 = bot 0.5[z6, z7] shifted (stemthickness/2 , 
+stemthickness/2);
+       fi;
+       charwx := x9/hppp;
+       charwy := y9/hppp;
+
+       labels (9);
+enddef;
+
+fet_beginchar ("Outward pointing triangle (upstem)", "u2dreieckout");
+       draw_dreieck (solfa_quarter_width, +1, +1);
+fet_endchar;
+
+fet_beginchar ("Outward pointing triangle (downstem)", "d2dreieckout");
+       draw_dreieck (solfa_quarter_width, -1, +1);
+fet_endchar;
+
+fet_beginchar ("Inward pointing triangle (upstem)", "u2dreieckin");
+       draw_dreieck (solfa_quarter_width, +1, -1);
+fet_endchar;
+
+fet_beginchar ("Inward pointing triangle (downstem)", "d2dreieckin");
+       draw_dreieck (solfa_quarter_width, -1, -1);
+fet_endchar;
+
+
 fet_endgroup ("noteheads");
 
 
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 3cfefc8..e397373 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -154,6 +154,8 @@
       ;; Therefore, style "default" does not appear in this case
       ;; statement.  -- jr
       ((xcircle) "2xcircle")
+      ((triangle-out) "2dreieckout")
+      ((triangle-in) "2dreieckin")
       ((harmonic) "0harmonic")
       ((harmonic-black) "2harmonic")
       ((harmonic-mixed) (if (<= log 1) "0harmonic"
-- 
1.4.4.4

>From c80500e984668fa2e0000f071686a55ec72a6982 Mon Sep 17 00:00:00 2001
From: Maximilian Albert <address@hidden>
Date: Tue, 3 Apr 2007 21:28:51 +0200
Subject: [PATCH] Add new triangle-shaped noteheads to docs

---
 input/manual/note-head-style.ly     |   14 ++++++++++++++
 input/regression/note-head-style.ly |   14 ++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/input/manual/note-head-style.ly b/input/manual/note-head-style.ly
index c561eec..2a2fa03 100644
--- a/input/manual/note-head-style.ly
+++ b/input/manual/note-head-style.ly
@@ -91,6 +91,20 @@ pattern = <<
 
   \break
 
+  \override Staff.NoteHead  #'style = #'triangle-out
+  s1*0^\markup { "triangle-out" }
+  \pattern
+
+  \override Staff.NoteHead  #'style = #'triangle-in
+  s1*0^\markup { "triangle-in" }
+  \pattern
+
+  \break
+
+  \override Staff.NoteHead  #'style = #'accent
+  s1*0^\markup { "accent" }
+  \pattern
+
   \override Staff.NoteHead  #'style = #'slash
   s1*0^\markup { "slash" }
   \pattern
diff --git a/input/regression/note-head-style.ly 
b/input/regression/note-head-style.ly
index c561eec..2a2fa03 100644
--- a/input/regression/note-head-style.ly
+++ b/input/regression/note-head-style.ly
@@ -91,6 +91,20 @@ pattern = <<
 
   \break
 
+  \override Staff.NoteHead  #'style = #'triangle-out
+  s1*0^\markup { "triangle-out" }
+  \pattern
+
+  \override Staff.NoteHead  #'style = #'triangle-in
+  s1*0^\markup { "triangle-in" }
+  \pattern
+
+  \break
+
+  \override Staff.NoteHead  #'style = #'accent
+  s1*0^\markup { "accent" }
+  \pattern
+
   \override Staff.NoteHead  #'style = #'slash
   s1*0^\markup { "slash" }
   \pattern
-- 
1.4.4.4

Attachment: triangles.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]