From 27a4d9354effb09c696925881ec4df007da8a0db Mon Sep 17 00:00:00 2001 From: Marc Hohl Date: Thu, 14 Jan 2010 09:57:55 +0100 Subject: [PATCH] Issue 659: alternate segno symbol An alternate segno symbol is included in mf/feta-scripts.mf. New arguments to the \bar command are introduced for easier use of the new sign. --- Documentation/changes.tely | 7 +++ Documentation/notation/rhythms.itely | 52 +++++++++++++++++++ input/regression/bar-line-segno.ly | 25 +++++++++ lily/bar-line.cc | 77 +++++++++++++++++++++++++-- lily/span-bar.cc | 10 +++- mf/feta-scripts.mf | 78 ++++++++++++++++++++++++++++ scm/output-lib.scm | 13 ++++- 7 files changed, 256 insertions(+), 6 deletions(-) create mode 100644 input/regression/bar-line-segno.ly diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 8569dbf56f..d680057e50 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -281,6 +281,13 @@ and to add notes to the number or fraction: FretBoards now have a chordChanges property to keep repeated FretBoard objects from being typeset. +@item +A variant of the segno sign is provided: +@lilypond[quote,relative=2] +c4 d e f \bar "S" +g4 f e d +@end lilypond + @end itemize diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index 279f1ceb9d..ac6dfa92e0 100644 --- a/Documentation/notation/rhythms.itely +++ b/Documentation/notation/rhythms.itely @@ -2155,6 +2155,26 @@ However, as such ticks are typically used in Gregorian chant, it is preferable to use @code{\divisioMinima} there instead, described in the section @ref{Divisiones} in Gregorian chant. +@cindex segno + +For in-line segno signs, there are three types of bar lines which +differ in their behavior at line breaks: + +@lilypond[quote,relative=2,verbatim] +c4 c c c +\bar "S" +c4 c c c \break +\bar "S" +c4 c c c +\bar "|S" +c4 c c c \break +\bar "|S" +c4 c c c +\bar "S|" +c4 c c c \break +\bar "S|" +c1 +@end lilypond @cindex repeats @@ -2177,6 +2197,38 @@ c4 c c c \break c4 c c c @end lilypond +For combinations of repeats with the segno sign, there are six different +variations: + +@lilypond[quote,relative=2,verbatim] +c4 c c c +\bar ":|S" +c4 c c c \break +\bar ":|S" +c4 c c c +\bar ":|S." +c4 c c c \break +\bar ":|S." +c4 c c c +\bar "S|:" +c4 c c c \break +\bar "S|:" +c4 c c c +\bar ".S|:" +c4 c c c \break +\bar ".S|:" +c4 c c c +\bar ":|S|:" +c4 c c c \break +\bar ":|S|:" +c4 c c c +\bar ":|S.|:" +c4 c c c \break +\bar ":|S.|:" +c1 +@end lilypond + + In scores with many staves, a @code{\bar} command in one staff is automatically applied to all staves. The resulting bar lines are connected between different staves of a @code{StaffGroup}, diff --git a/input/regression/bar-line-segno.ly b/input/regression/bar-line-segno.ly new file mode 100644 index 0000000000..4974326827 --- /dev/null +++ b/input/regression/bar-line-segno.ly @@ -0,0 +1,25 @@ +\version "2.13.17" + +\header { texidoc = "Segno bar lines can be used to mark + the begin and the end of a segno part." + } + +\paper { ragged-right = ##t } + +\relative \new StaffGroup << + \new Staff { + c4 \bar "S" c \bar "|S" c \bar "S|" c \bar ":|S" \break + c4 c \bar ":|S|:" c c \bar ":|S.|:" \break + c4 c c2 \bar ".S|:" \break + c1 \bar ":|S." \break + c1 \bar "S" \break + c1 } + \new Staff { + c4 c c c + c4 c c c + c4 c c c + c4 c c c + c4 c c c + c1 + } +>> diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 503420b7b3..d3f21e5350 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -116,6 +116,9 @@ Bar_line::compound_barline (Grob *me, string str, Real h, if (str == "||:") str = "|:"; + if (str == "|S" || str == "S|") + str = "S"; + if (str == "") { Stencil empty = Lookup::blank (Box (Interval (0, 0), Interval (-h / 2, h / 2))); @@ -193,9 +196,58 @@ Bar_line::compound_barline (Grob *me, string str, Real h, /* should align to other side? this never appears on the system-start? - */ m.add_at_edge (X_AXIS, RIGHT, thin, 0); m.add_at_edge (X_AXIS, RIGHT, thin, thinkern); + */ + m.add_at_edge (X_AXIS, LEFT, thin, thinkern / 2); + m.add_at_edge (X_AXIS, RIGHT, thin, thinkern / 2); + } + else if (str.find ("S") != NPOS || str == "|._.|") + { + // Handle all varsegno stuff + Stencil segno; + segno.add_at_edge (X_AXIS, LEFT, thin, thinkern / 2); + segno.add_at_edge (X_AXIS, RIGHT, thin, thinkern / 2); + segno.add_stencil (Font_interface::get_default_font (me)->find_by_name ("scripts.varsegno")); + + if (str == "S") + { + m.add_stencil (segno); + } + else if (str == "S|:" || str == ".S|:") + { + m.add_at_edge (X_AXIS, RIGHT, thick, 0); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); + m.add_at_edge (X_AXIS, LEFT, segno, thinkern); + } + else if (str == ":|S" || str == ":|S.") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + m.add_at_edge (X_AXIS, RIGHT, segno, thinkern); + } + else if (str == ":|S|:" || str == ":|S.|:") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + m.add_at_edge (X_AXIS, RIGHT, segno, thinkern); + m.add_at_edge (X_AXIS, RIGHT, thick, thinkern); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); + } + else if (str == "|._.|") // :|S|: or :|S.|: without segno and colon + { + // get the width of the segno sign + Real segno_width = segno.extent (X_AXIS).length (); + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, thick, segno_width + 2 * thinkern); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + } + // end varsegno block } else if (str == ":") { @@ -369,19 +421,36 @@ ADD_INTERFACE (Bar_line, " is a string which specifies the kind of bar line to print." " Options are @code{|}, @code{:|}, @code{|:}, @code{:|:}, @code{:|.|:}," " @code{:|.:}, @code{.}, @code{||}, @code{|.}, @code{.|}, @code{.|.}," - " @code{|.|}, @code{:}, @code{dashed} and @code{'}.\n" + " @code{|.|}, @code{:}, @code{dashed}, @code{'} and @code{S}.\n" "\n" "These produce, respectively, a normal bar line, a right repeat, a left repeat," " a thick double repeat, a thin-thick-thin double repeat," " a thin-thick double repeat, a thick bar, a double bar, a start bar," " an end bar, a thick double bar, a thin-thick-thin bar," - " a dotted bar, a dashed bar, and a tick." - " In addition, there is an option" + " a dotted bar, a dashed bar, a tick as bar line and a segno bar.\n" + "\n" + "In addition, there is an option" " @code{||:} which is equivalent to @code{|:} except at line" " breaks, where it produces a double bar (@code{||}) at the" " end of the line and a repeat sign (@code{|:}) at the" " beginning of the new line.\n" "\n" + "For segno, @code{S} produces a segno sign except at line breaks," + " where it produces a double bar (@code{||}) at the" + " end of the line and a segno sign at the beginning of the new line." + " @code{|S} is equivalent to @code{S} but produces a simple bar line" + " (@code{|}) instead of a double bar line (@code{||}) at line breaks." + " @code{S|} produces the segno sign at line breaks and starts the following" + " line without special bar lines.\n" + "\n" + "@code{S|:} and @code{:|S} are used for repeat/segno combinations that are" + " separated at line breaks. Alternatively, @code{.S|:} and @code{:|S.}" + " may be used which combine repeat signs and segno at the same line in" + " case of a line break. @code{:|S|:} is a combination of a left repeat" + " (@code{:|}), a segno (@code{S}) and a right repeat @code{|:} which" + " splits before the segno at line breaks; @code{:|S.|:} splits after" + " the segno sign.\n" + "\n" "If @var{bartype} is set to @code{empty} then nothing is" " printed, but a line break is allowed at that spot.\n" "\n" diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 3ef38ec812..36590c30a5 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -128,7 +128,7 @@ Span_bar::width (SCM smob) SCM gn = me->get_property ("glyph-name"); if (!me->is_live ()) return ly_interval2scm (Interval ()); - + string gl = ly_scm2string (gn); /* @@ -201,6 +201,14 @@ Span_bar::calc_glyph_name (SCM smob) type = "|.|"; else if (type == ":|.:") type = "|."; + else if (type == "S" || type == "S|" || type == "|S") + type = "||"; + else if (type == "S|:" || type == ".S|:") + type = ".|"; + else if (type == ":|S" || type == ":|S.") + type = "|."; + else if (type == ":|S|:" || type == ":|S.|:") + type = "|._.|"; else if (type == "'") type = ""; diff --git a/mf/feta-scripts.mf b/mf/feta-scripts.mf index dbcac4d834..6d921cb746 100644 --- a/mf/feta-scripts.mf +++ b/mf/feta-scripts.mf @@ -1151,6 +1151,84 @@ fet_beginchar ("Segno", "segno"); penlabels (range 1 thru 8); fet_endchar; +fet_beginchar ("Varied Segno", "varsegno"); + save ht, wd, loopdist, loopangle; + save thin, med, thick; + save bulbradius; + + ht# = 8 staff_space#; + wd# = 2.5 staff_space#; + + set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2); + %set_char_box (0, 0, ht# / 2, ht# / 2); + + loopdist = 4/3 staff_space; + loopangle = 35; + + thick = 1/2 staff_space; + med = 1/4 staff_space; + thin = 1/10 staff_space; + + x1 = staff_space; + y1 = 13/4 staff_space; + penpos1 (med, 210); + + z2l = (0, 4 staff_space); + penpos2 (med, 270 - loopangle); + + x3 = -x1; + y3 = y1 + 1/4 staff_space; + penpos3 (med, 270 + loopangle); + + pair center; + center = (0, 2 staff_space); + z4 = (3/4 staff_space, 2 staff_space) rotatedabout (center, 180 - loopangle); + z5 = 2[z4,center]; + x9 = x4; y9 = y4 - 2 loopdist; + x10 = x5; y10 = y5 - 2 loopdist; + penpos4 (thick, 90 - loopangle); + penpos5 (thick, 90 - loopangle); + penpos9 (thick, 90 - loopangle); + penpos10 (thick, 90 - loopangle); + + z6 = (4/3 staff_space, 4/3 staff_space) rotatedabout (2/3 center, -loopangle); + x11 = x6; y11 = y6 - 2 loopdist; + penpos6 (thin, -loopangle); + penpos11 (thin, -loopangle); + + z7 = 1/3 center; + penpos7 (thick, 270 - loopangle); + + z8 = (4/3 staff_space, 0) rotated (180 - loopangle); + penpos8 (thin, -loopangle); + + z12 = -center; + penpos12 (thick, 270 - loopangle); + + z1' = 4/3[z1l,z1r]; + bulbradius = length ( z1l - z1'); + pickup pencircle scaled 2 bulbradius; + drawdot z1'; + + penstroke z1e + .. z2e + .. z3e + .. z4e{dir (-loopangle)} + .. z5e{dir (-loopangle)} + .. z6e + .. z7e + .. z8e + .. z9e{dir (-loopangle)} + .. z10e{dir (-loopangle)} + .. z11e + .. {dir (180 - loopangle)}z12e; + addto currentpicture also currentpicture scaled -1; + + penlabels (1, 1', 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); + %draw_staff (-2, 2, 0); +fet_endchar; + + fet_beginchar ("Coda", "coda"); save stickout, thin, thick, codawidth, codaheight; diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 8e17401477..04accee665 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -218,7 +218,18 @@ and duration-log @var{log}." ("'" . ("'" . ())) ("empty" . (() . ())) ("brace" . (() . "brace")) - ("bracket" . (() . "bracket")))) + ("bracket" . (() . "bracket")) + + ;; segno bar lines + ("S" . ("||" . "S")) + ("|S" . ("|" . "S")) + ("S|" . ("S" . ())) + (":|S" . (":|" . "S")) + (":|S." . (":|S" . ())) + ("S|:" . ("S" . "|:")) + (".S|:" . ("|" . "S|:")) + (":|S|:" . (":|" . "S|:")) + (":|S.|:" . (":|S" . "|:")))) (define-public (bar-line::calc-glyph-name grob) (let* ((glyph (ly:grob-property grob 'glyph)) -- 2.39.5