From 5631533bf3492229bb2c6bd7a528f7bfbb1ba8ce Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 9 Sep 2002 23:46:49 +0000 Subject: [PATCH] 2002-09-09 Juergen Reuter * input/test/accid.ly: updated test file to show all available accidentals styles * lily/accidental.cc, lily/key-signature-interface.cc, lily/include/accidental-interface.hh: added method get_fontcharname() to provide proper fall-back cases for missing accidentals; print warning if font char lookup fails * lily/time-signature.cc: fixed documentation bug 2002-09-07 Jeremie Lumbroso * Documentation/user/refman.itely: replaced all occurrence "staffs" with "staves". --- ChangeLog | 18 ++++++- Documentation/user/refman.itely | 20 +++---- input/test/accid.ly | 35 +++++++++++- lily/accidental.cc | 80 +++++++++++++++++++++++----- lily/include/accidental-interface.hh | 1 + lily/key-signature-interface.cc | 37 ++++++++----- lily/time-signature.cc | 15 +++--- 7 files changed, 159 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ab59b873a..1c263d0685 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ + +2002-09-09 Juergen Reuter + + * input/test/accid.ly: updated test file to show all available + accidentals styles + + * lily/accidental.cc, lily/key-signature-interface.cc, + lily/include/accidental-interface.hh: added method + get_fontcharname() to provide proper fall-back cases for missing + accidentals; print warning if font char lookup fails + + * lily/time-signature.cc: fixed documentation bug + 2002-09-09 Han-Wen Nienhuys * lily/musical-request.cc: do ADD_MUSIC for String_number_req. @@ -27,7 +40,7 @@ * lily/include/music-iterator.hh (class Music_iterator): smobify music-iterator; many changes throughout. They are now constructed - through procedures that return the smobbed iterator. + through procedures that return to the smobbed iterator. * lily/include/*.hh: all derived_mark() functions are now const. @@ -78,6 +91,9 @@ * Documentation/user/refman.itely: very minor corrections and rephrasing of the reference manual -- revision up to line #400. + * Documentation/user/refman.itely: replaced all occurrence "staffs" + with "staves". + 2002-09-07 Han-Wen Nienhuys * lily/lexer.ll: scan E_DIGIT diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index fccd9f6440..55b111f7ce 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -352,7 +352,7 @@ of a chord is not supported in a simple way. It can be achieved by moving the tie-engraver into the Thread context and turning on and off ties per Thread. -Switching staffs when a tie is active will not work. +Switching staves when a tie is active will not work. @node Automatic note splitting @subsection Automatic note splitting @@ -1014,8 +1014,8 @@ c4 You are encouraged to use @code{\repeat} for repetitions. See @ref{Repeats}. -In scores with many staffs, the barlines are automatically placed at -top level, and they are connected between different staffs of a +In scores with many staves, the barlines are automatically placed at +top level, and they are connected between different staves of a @internalsref{StaffGroup}: @lilypond[fragment, verbatim] < \context StaffGroup < @@ -1235,7 +1235,7 @@ the object property @code{auto-knee-gap}. @refbugs -Auto knee beams can not be used together with hara kiri staffs. +Auto knee beams can not be used together with hara kiri staves. [TODO from bugs] @@ -1973,7 +1973,7 @@ changes may appear halfway in between grace notes: @end lilypond The placement of these grace notes is synchronized between different -staffs, using this grace timing. +staves, using this grace timing. @lilypond[relative=2,verbatim,fragment] < \context Staff = SA { e4 \grace { c16 d e f } e4 } @@ -2024,7 +2024,7 @@ Grace notes can not be used in the smallest size (@file{paper11.ly}). Grace note synchronization can also lead to surprises. Staff notation, such as key signatures, barlines, etc. are also synchronized. Take -care when you mix staffs with grace notes and staffs without. +care when you mix staves with grace notes and staves without. @lilypond[relative=2,verbatim,fragment] < \context Staff = SA { e4 \bar "|:" \grace c16 d4 } @@ -4324,13 +4324,13 @@ are chosen whenever the page gets full. @subsection Vertical spacing @cindex vertical spacing -@cindex distance between staffs +@cindex distance between staves @cindex staff distance @cindex between staves, distance The height of each system is determined automatically by lilypond, to keep systems from bumping into each other, some minimum distances are -set. By changing these, you can put staffs closer together, and thus +set. By changing these, you can put staves closer together, and thus put more systems onto one page. Normally staves are stacked vertically. To make @@ -4352,7 +4352,7 @@ Vertical aligment of staves is handled by the @internalsref{VerticalAlignment} object, which lives at @internalsref{Score} level. -The piano staffs are handled a little differently: to make cross-staff +The piano staves are handled a little differently: to make cross-staff beaming work correctly, it necessary that the distance between staves is fixed. This is also done with a @internalsref{VerticalAlignment} object, created in @internalsref{PianoStaff}, but a forced distance is @@ -4364,7 +4364,7 @@ want to override this, use a @code{\translator} block as follows: VerticalAlignment \override #'forced-distance = #9 @} @end example -This would bring the staffs together at a distance of 9 staff spaces, +This would bring the staves together at a distance of 9 staff spaces, and again this is measured from the center line of each staff. diff --git a/input/test/accid.ly b/input/test/accid.ly index 569bd6a31b..d26f5292bf 100644 --- a/input/test/accid.ly +++ b/input/test/accid.ly @@ -3,7 +3,40 @@ \score { \context Voice \notes\relative c { \time 3/4 - cisis'' cisis! cisis? | + \property Staff.Accidental \set #'style = #'default + cisis''^"Accidental style = \#'default" cisis! cisis? | + cis cis! cis? | + c c! c? | + ces ces! ces? | + ceses ceses! ceses? | + \break + + \property Staff.Accidental \set #'style = #'hufnagel + cisis^"Accidental style = \#'hufnagel" cisis! cisis? | + cis cis! cis? | + c c! c? | + ces ces! ces? | + ceses ceses! ceses? | + \break + + \property Staff.Accidental \set #'style = #'medicaea + cisis^"Accidental style = \#'medicaea" cisis! cisis? | + cis cis! cis? | + c c! c? | + ces ces! ces? | + ceses ceses! ceses? | + \break + + \property Staff.Accidental \set #'style = #'vaticana + cisis^"Accidental style = \#'vaticana" cisis! cisis? | + cis cis! cis? | + c c! c? | + ces ces! ces? | + ceses ceses! ceses? | + \break + + \property Staff.Accidental \set #'style = #'mensural + cisis^"Accidental style = \#'mensural" cisis! cisis? | cis cis! cis? | c c! c? | ces ces! ces? | diff --git a/lily/accidental.cc b/lily/accidental.cc index 4200f3b88a..426f94fbb6 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -95,6 +95,57 @@ Accidental_interface::accurate_boxes (Grob *a,Grob**common) return boxes; } +/* + * Some styles do not provide all flavours of accidentals, e.g. there + * is currently no sharp accidental in vaticana style. In these cases + * this function falls back to one of the other styles. + */ +String +Accidental_interface::get_fontcharname(String style, int alteration) +{ + if (style == "hufnagel") + switch (alteration) + { + case -2: return "-2"; + case -1: return "hufnagel-1"; + case 0: return "vaticana0"; + case 1: return "mensural1"; + case 2: return "2"; + } + if (style == "medicaea") + switch (alteration) + { + case -2: return "-2"; + case -1: return "medicaea-1"; + case 0: return "vaticana0"; + case 1: return "mensural1"; + case 2: return "2"; + } + if (style == "vaticana") + switch (alteration) + { + case -2: return "-2"; + case -1: return "vaticana-1"; + case 0: return "vaticana0"; + case 1: return "mensural1"; + case 2: return "2"; + } + if (style == "mensural") + switch (alteration) + { + case -2: return "-2"; + case -1: return "mensural-1"; + case 0: return "vaticana0"; + case 1: return "mensural1"; + case 2: return "2"; + } + if (style == "neo_mensural") + style = ""; // currently same as default + if (style == "default") + style = ""; + return style + to_string (alteration); +} + MAKE_SCHEME_CALLBACK (Accidental_interface,brew_molecule,1); SCM Accidental_interface::brew_molecule (SCM smob) @@ -102,7 +153,7 @@ Accidental_interface::brew_molecule (SCM smob) Grob *me = unsmob_grob (smob); bool smaller = false; bool parens = false; - + bool caut = to_boolean (me->get_grob_property ("cautionary")); if (caut) { @@ -110,7 +161,7 @@ Accidental_interface::brew_molecule (SCM smob) parens = gh_equal_p (cstyle, ly_symbol2scm ("parentheses")); smaller = gh_equal_p (cstyle, ly_symbol2scm ("smaller")); } - + SCM scm_style = me->get_grob_property ("style"); String style; if (gh_symbol_p (scm_style)) @@ -121,11 +172,10 @@ Accidental_interface::brew_molecule (SCM smob) { /* preferably no name for the default style. - */ + */ style = ""; } - Font_metric *fm = 0; if (smaller) { @@ -141,16 +191,20 @@ Accidental_interface::brew_molecule (SCM smob) Molecule mol; for (SCM s = me->get_grob_property ("accidentals"); - gh_pair_p (s); s= gh_cdr (s)) + gh_pair_p (s); s = gh_cdr (s)) { - SCM entry = gh_car (s); - - - Molecule acc (fm->find_by_name (String ("accidentals-") + - style + - to_string (gh_scm2int(entry)))); - - mol.add_at_edge (X_AXIS, RIGHT, acc, 0.1); + int alteration = gh_scm2int (gh_car (s)); + String font_char = get_fontcharname (style, alteration); + Molecule acc (fm->find_by_name ("accidentals-" + font_char)); + + if (acc.empty_b()) + { + me->warning (_f ("accidental `%s' not found", font_char)); + } + else + { + mol.add_at_edge (X_AXIS, RIGHT, acc, 0.1); + } } if (parens) diff --git a/lily/include/accidental-interface.hh b/lily/include/accidental-interface.hh index c2dd022327..e906f9fcb4 100644 --- a/lily/include/accidental-interface.hh +++ b/lily/include/accidental-interface.hh @@ -19,6 +19,7 @@ public: DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); static bool has_interface (Grob*); + static String get_fontcharname(String style, int alteration); static Array Accidental_interface::accurate_boxes (Grob *me,Grob**common); }; diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 7b3c9ab3a1..81946e2769 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -17,7 +17,7 @@ #include "lookup.hh" #include "lily-guile.hh" #include "lily-proto.hh" - +#include "accidental-interface.hh" struct Key_signature_interface { @@ -99,7 +99,7 @@ Key_signature_interface::brew_molecule (SCM smob) Grob*me =unsmob_grob (smob); Real inter = Staff_symbol_referencer::staff_space (me)/2.0; - + SCM scm_style = me->get_grob_property ("style"); String style; if (gh_symbol_p (scm_style)) @@ -115,25 +115,34 @@ Key_signature_interface::brew_molecule (SCM smob) Molecule mol; SCM c0s = me->get_grob_property ("c0-position"); - int c0p=0; + int c0p = 0; if (gh_number_p (c0s)) - c0p = gh_scm2int (c0s); + c0p = gh_scm2int (c0s); /* SCM lists are stacks, so we work from right to left, ending with the cancellation signature. */ + Font_metric *fm = Font_interface::get_default_font (me); for (SCM s = newas; gh_pair_p (s); s = ly_cdr (s)) { - SCM what = ly_caar (s); - int alter = gh_scm2int (ly_cdar (s)); - int pos = alteration_pos (what, alter, c0p); - - Molecule m = Font_interface::get_default_font (me)-> - find_by_name (String ("accidentals-") + style + to_string (alter)); - m.translate_axis (pos * inter, Y_AXIS); - mol.add_at_edge (X_AXIS, LEFT, m, 0); + int alteration = gh_scm2int (ly_cdar (s)); + String font_char = + Accidental_interface::get_fontcharname (style, alteration); + Molecule acc (fm->find_by_name ("accidentals-" + font_char)); + + if (acc.empty_b()) + { + me->warning (_f ("accidental `%s' not found", font_char)); + } + else + { + SCM what = ly_caar (s); + int pos = alteration_pos (what, alteration, c0p); + acc.translate_axis (pos * inter, Y_AXIS); + mol.add_at_edge (X_AXIS, LEFT, acc, 0); + } } Item *it = dynamic_cast (me) ; @@ -163,8 +172,8 @@ Key_signature_interface::brew_molecule (SCM smob) || ly_cdr (found) != ly_cdar (old)) { SCM what = ly_caar (old); - int alter = 0; - int pos = alteration_pos (what, alter, c0p); + int alteration = 0; + int pos = alteration_pos (what, alteration, c0p); Molecule m = natural; m.translate_axis (pos* inter, Y_AXIS); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 31dbedea5b..e66adfc8d4 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -133,21 +133,20 @@ ADD_INTERFACE (Time_signature,"time-signature-interface", 4/4 and 2/2 are typeset as C and struck C, respectively. All other time signatures are written with two digits. - @item @code{old} + @item @code{neo_mensural} 2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8 and 9/8 are - typeset with old-style mensuration marks. All other time + typeset with neo-mensural style mensuration marks. All other time + signatures are written with two digits. + + @item @code{mensural} + 2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8 and 9/8 are + typeset with mensural style mensuration marks. All other time signatures are written with two digits. @item @code{1xxx} All time signatures are typeset with a single digit, e.g. 3/2 is written as 3. (Any symbol starting with the digit @code{1} will do.) - - @item @code{C}@var{M}@code{/}@var{N}, -@code{old}@var{M}@code{/}@var{N} or - @code{old6/8alt} - Tells LilyPond to use a specific symbol as time signature, - regardless of the actual time signature. @end table See also the test-file @file{input/test/time.ly}. -- 2.39.5