From: Han-Wen Nienhuys Date: Thu, 18 Mar 2004 23:27:22 +0000 (+0000) Subject: * lily/note-head.cc (brew_ez_stencil): read vector note-names to X-Git-Tag: release/2.1.32~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=05d9cd1cc17b47ec7852ecc260b69271cc1e146e;p=lilypond.git * lily/note-head.cc (brew_ez_stencil): read vector note-names to determine ez-notation letter. * lily/system.cc (get_line): start with dumping layer 3. This fixes ez notation. --- diff --git a/ChangeLog b/ChangeLog index 10c38f33ce..f6f898137c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-03-19 Han-Wen Nienhuys + + * lily/note-head.cc (brew_ez_stencil): read vector note-names to + determine ez-notation letter. + + * lily/system.cc (get_line): start with dumping layer 3. This + fixes ez notation. + 2004-03-19 Jan Nieuwenhuizen * lily/paper-book.cc (pages): Bugfix: copy_height and tag_height @@ -23,6 +31,9 @@ 2004-03-18 Han-Wen Nienhuys + * lily/note-head.cc (brew_ez_stencil): add note-names + property. Provides internationalization for note names. + * Documentation/user/changing-defaults.itely (Creating contexts): new node. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index e01217dc63..87dbecafb6 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -243,14 +243,15 @@ clef and time signature are added. LilyPond @emph{interprets} the input. During this step, the musical information is inspected in time order, similar to reading a score from left to right. While reading, the program remembers where measure boundaries are, and what pitches -need explicit accidentals. +need explicit accidentals. -This information can be present on several levels. For example, the -effect of an accidental is limited to a single stave, while a bar line -must be synchronized across the entire score. To match this -hierarchy, LilyPond's interpretation step is hierarchical. There are -interpretation contexts, like @context{Voice}, Staff and Score, and each level -can maintain its own properties. +This is contextual information. and it can be present on several +levels. For example, the effect of an accidental is limited to a +single stave, while a bar line must be synchronized across the entire +score. To match this hierarchy, LilyPond's interpretation step is +hierarchical. There are interpretation contexts, like +@context{Voice}, Staff and Score, and each level can maintain its own +properties. Full description of all available contexts is in the program reference, see @@ -344,7 +345,7 @@ They are combined by sending both to the same @context{Voice} context, music = \notes { c4 c4 } arts = \notes { s4-. s4-> } \score { - << \new Staff \context Voice = "A" \music + \notes \relative c'' << \new Staff \context Voice = "A" \music \context Voice = "A" \arts >> } @@ -450,7 +451,7 @@ easily with @code{\once}, for example in c4 @end lilypond -the property @code{fontSize} is unset automatically after the third +the property @code{fontSize} is unset automatically after the second note. A full description of all available context properties is in the diff --git a/Documentation/user/macros.itexi b/Documentation/user/macros.itexi index 64125bb81d..6a8b7c7bb8 100644 --- a/Documentation/user/macros.itexi +++ b/Documentation/user/macros.itexi @@ -161,7 +161,7 @@ internals document, @internalsref{\NAME\} @end macro @macro context{NAME} -@code{NAME}@c should use internalsref +@code{\NAME\}@c should use internalsref @cindex \NAME\@c @end macro diff --git a/input/regression/easy-notation.ly b/input/regression/easy-notation.ly index 8b3b43b8d9..35458dff68 100644 --- a/input/regression/easy-notation.ly +++ b/input/regression/easy-notation.ly @@ -1,14 +1,19 @@ \version "2.1.30" \header { -texidoc = " Easy-notation (or Ez-notation) prints names in note heads. + texidoc = " Easy-notation (or Ez-notation) prints names in note heads. You also get ledger lines, of course." } \score { - \notes { c'2 e'4 f' | g'1 b8 } - \paper { \context { \EasyNotation } - raggedright = ##t - } + \notes { + \setEasyHeads + c'2 g'2 | g'1 + \override NoteHead #'note-names = ##("U" "V" "W" "X" "Y" "Z" "z") + c'2 e'4 f' | b'1 + } + \paper { + raggedright = ##t + } } diff --git a/lily/note-head.cc b/lily/note-head.cc index 9c06332658..4b35133227 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -248,11 +248,18 @@ Note_head::brew_ez_stencil (SCM smob) SCM spitch = unsmob_music (cause)->get_property ("pitch"); Pitch* pit = unsmob_pitch (spitch); - char s[2] = "a"; - s[0] = (pit->get_notename () + 2)%7 + 'a'; - s[0] = toupper (s[0]); - - SCM charstr = scm_makfrom0str (s); + SCM idx = gh_int2scm (pit->get_notename ()); + SCM names = me->get_property ("note-names"); + SCM charstr = SCM_EOL; + if (gh_vector_p (names)) + charstr = scm_vector_ref (names, idx); + else + { + char s[2] = "a"; + s[0] = (pit->get_notename () + 2)%7 + 'a'; + s[0] = toupper (s[0]); + charstr = scm_makfrom0str (s); + } SCM at = scm_list_n (ly_symbol2scm ("ez-ball"), charstr, @@ -331,5 +338,5 @@ Note_head::get_balltype (Grob*me) ADD_INTERFACE (Note_head,"note-head-interface", "Note head", - "glyph-name-procedure accidental-grob style stem-attachment-function"); + "note-names glyph-name-procedure accidental-grob style stem-attachment-function"); diff --git a/lily/system.cc b/lily/system.cc index a03ed8cf9f..e11505700f 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -56,15 +56,17 @@ scm_default_compare (const void * a, const void *b) SCM pa = *(SCM *)a; SCM pb = *(SCM *)b; - if (pa < pb) return -1 ; - else if (pa > pb) return 1; - else return 0; + if (pa < pb) + return -1; + else if (pa > pb) + return 1; + else + return 0; } /* modify L in place: sort it */ - SCM uniquify_list (SCM l) { @@ -389,13 +391,18 @@ SCM System::get_line () { static int const LAYER_COUNT = 3; + SCM stencils = SCM_EOL; if (Stencil *me = get_stencil ()) stencils = scm_cons (me->smobbed_copy (), stencils); /* Output stencils in three layers: 0, 1, 2. The default layer is - 1. */ - for (int i = 0; i < LAYER_COUNT; i++) + 1. + + Start with layer 3, since scm_cons prepends to list. + + */ + for (int i = LAYER_COUNT; i--;) for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s)) { Grob *g = unsmob_grob (ly_car (s)); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 78b1b33603..3461bf407f 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -316,6 +316,8 @@ should move (after padding).") returning a @code{Stencil} object.") (new-accidentals ,list? "List of @code{(@var{pitch} . @var{accidental})} pairs.") + (note-names ,vector? "Vector of strings containing names for +easy-notation note heads.") (no-spacing-rods ,boolean? "Items with this property do not cause spacing constraints.") (no-stem-extend ,boolean? "If set, notes with ledger lines do not diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 5d27dc56bc..1fcac56145 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -919,13 +919,12 @@ (Stem . ( - ;; this list is rather long. Trim --hwn (before-line-breaking-callback . ,Stem::before_line_breaking) (print-function . ,Stem::print) (thickness . 1.3) - ;; 3.5 (or 3 measured from note head) is standar length + ;; 3.5 (or 3 measured from note head) is standard length ;; 32nd, 64th flagged stems should be longer (lengths . (3.5 3.5 3.5 4.5 5.0))