From cced43289cf170305e6e6517180659a1c4fa91db Mon Sep 17 00:00:00 2001 From: Marc Hohl Date: Wed, 1 Aug 2012 21:15:46 +0200 Subject: [PATCH] New bar line interface * the input string of a bar line called by \bar "" resembles the output one-by-one; a repeat sign is called by ":|." * (define-bar-line ...) or \defineBarLine allows for new definitions. These functions have four arguments, namely the bar line itself, the bar line used at the end of line, the bar line used at the begin of a new line and the span bar line. * Annotations for barlines can be added to distinguish between two identical barlines with different break apperance or span bar lines. * To align span bars properly, the space character " " has a special meaning. When it occurs, the width of the resembling glyph in the bar line definition is used. * New glyphs can be added easily. * Volta brackets take the bar line dimensions into account. --- Documentation/changes.tely | 6 + Documentation/de/notation/ancient.itely | 8 +- Documentation/de/notation/rhythms.itely | 60 +- Documentation/de/notation/vocal.itely | 6 +- Documentation/es/notation/ancient.itely | 14 +- Documentation/es/notation/rhythms.itely | 58 +- Documentation/es/notation/vocal.itely | 6 +- Documentation/fr/notation/ancient.itely | 14 +- Documentation/fr/notation/rhythms.itely | 58 +- Documentation/fr/notation/vocal.itely | 6 +- Documentation/ja/notation/rhythms.itely | 58 +- Documentation/ja/notation/vocal.itely | 6 +- Documentation/notation/ancient.itely | 14 +- Documentation/notation/rhythms.itely | 58 +- Documentation/notation/vocal.itely | 6 +- ...y-customized-polymetric-time-signatures.ly | 6 +- ...repeat-sign-at-the-beginning-of-a-piece.ly | 36 + ...repeat-sign-at-the-beginning-of-a-piece.ly | 19 +- Documentation/snippets/repeats-headword.ly | 6 +- ...ing-the-double-repeat-default-for-volte.ly | 4 +- Documentation/snippets/unfretted-headword.ly | 4 +- input/regression/auto-beam-bar.ly | 4 +- input/regression/bar-line-define-bar-glyph.ly | 28 + input/regression/bar-line-define-bar-line.ly | 21 + input/regression/bar-line-segno.ly | 10 +- input/regression/bar-lines.ly | 6 +- input/regression/double-repeat.ly | 4 +- input/regression/grace-volta-repeat-2.ly | 6 +- input/regression/lyrics-bar.ly | 4 +- input/regression/music-function.ly | 6 +- input/regression/non-centered-bar-lines.ly | 4 +- input/regression/number-staff-lines.ly | 4 +- input/regression/prefatory-spacing-matter.ly | 6 +- .../regression/repeat-sign-global-size-10.ly | 14 +- .../regression/repeat-sign-global-size-30.ly | 14 +- input/regression/repeat-sign-global-size-5.ly | 14 +- input/regression/repeat-sign-layout-size.ly | 14 +- input/regression/repeat-sign.ly | 4 +- input/regression/span-bar-break.ly | 10 +- input/regression/tuplet-broken.ly | 6 +- input/regression/tuplet-full-length.ly | 6 +- input/regression/zero-staff-space.ly | 4 +- lily/grob-scheme.cc | 12 + lily/repeat-acknowledge-engraver.cc | 12 +- lily/volta-bracket.cc | 14 +- ly/engraver-init.ly | 6 +- ly/property-init.ly | 23 + python/convertrules.py | 25 + scm/bar-line.scm | 1123 +++++++++++------ scm/define-context-properties.scm | 6 +- scm/define-grob-interfaces.scm | 39 +- scm/define-grob-properties.scm | 12 +- scm/define-grobs.scm | 12 +- scripts/abc2ly.py | 8 +- scripts/etf2ly.py | 4 +- 55 files changed, 1215 insertions(+), 723 deletions(-) create mode 100644 Documentation/snippets/new/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly create mode 100644 input/regression/bar-line-define-bar-glyph.ly create mode 100644 input/regression/bar-line-define-bar-line.ly diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 06a1378b69..6079329d65 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -61,6 +61,12 @@ which scares away people. @end ignore +@item +The bar line user interface has changed. Bar glyphs now resemble the +appearance of the bar line, so a left repeat sign has to be coded +as @code{.|:}. The command @code{\defineBarLine} provides an easy way +to define additional bar line styles. + @item Accidentals in the key signature may be printed in octaves other than their traditional positions, or in multiple octaves. diff --git a/Documentation/de/notation/ancient.itely b/Documentation/de/notation/ancient.itely index 1181fb586f..9e3ca5a0b3 100644 --- a/Documentation/de/notation/ancient.itely +++ b/Documentation/de/notation/ancient.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Till Paala @@ -988,7 +988,7 @@ Eine Datei kann zum Beispiel so aussehen: @c @example @c \set Score.timing = ##f -@c \set Score.defaultBarType = "empty" +@c \set Score.defaultBarType = "-" @c \override NoteHead #'style = #'neomensural @c \override Staff.TimeSignature #'style = #'neomensural @c \clef "petrucci-g" @@ -1001,7 +1001,7 @@ Eine Datei kann zum Beispiel so aussehen: \score { \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -1030,7 +1030,7 @@ wie folgt ausgegeben: @lilypond[quote,ragged-right] \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'neomensural \override Staff.TimeSignature #'style = #'neomensural \clef "petrucci-g" diff --git a/Documentation/de/notation/rhythms.itely b/Documentation/de/notation/rhythms.itely index 7caa63827e..ec49e8cf92 100644 --- a/Documentation/de/notation/rhythms.itely +++ b/Documentation/de/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Till Paala @@ -2691,7 +2691,7 @@ f1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" -b1 \bar ".|." +b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 @@ -2700,8 +2700,8 @@ e1 Zusätzlich gibt es noch punktierte und gestrichelte Taktstriche: @lilypond[quote,relative=1,verbatim] -f1 \bar ":" -g1 \bar "dashed" +f1 \bar ";" +g1 \bar "!" a1 @end lilypond @@ -2709,17 +2709,17 @@ a1 und fünf unterschiedliche Wiederholungstaktstriche: @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d +f1 \bar ".|:" g \bar ":..:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|." d @end lilypond Zusätzlich kann eine Taktlinie mit einem einfachen Apostroph gesetzt werden: @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" -g1 \bar ":|:" +f1 \bar ".|:" +g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" -c1 \bar ":|" +c1 \bar ":|." e1 @end lilypond @@ -2747,13 +2747,13 @@ c4 c c c c4 c c c \break \bar "S" c4 c c c -\bar "|S" +\bar "S-|" c4 c c c \break -\bar "|S" +\bar "S-|" c4 c c c -\bar "S|" +\bar "S-S" c4 c c c \break -\bar "S|" +\bar "S-S" c1 @end lilypond @@ -2772,9 +2772,9 @@ doppelter Taktstrich am Ende der Zeile ausgegeben wird und ein @lilypond[quote,relative=2,verbatim] c4 c c c -\bar "||:" +\bar ".|:-||" c4 c c c \break -\bar "||:" +\bar ".|:-||" c4 c c c @end lilypond @@ -2783,29 +2783,29 @@ es sechs verschiedene Variationen: @lilypond[quote,relative=2,verbatim] c4 c c c -\bar ":|S" +\bar ":|.S" c4 c c c \break -\bar ":|S" +\bar ":|.S" c4 c c c -\bar ":|S." +\bar ":|.S-S" c4 c c c \break -\bar ":|S." +\bar ":|.S-S" c4 c c c -\bar "S|:" +\bar "S.|:-S" c4 c c c \break -\bar "S|:" +\bar "S.|:-S" c4 c c c -\bar ".S|:" +\bar "S.|:" c4 c c c \break -\bar ".S|:" +\bar "S.|:" c4 c c c -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c \break -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c -\bar ":|S.|:" +\bar ":|.S.|:-S" c4 c c c \break -\bar ":|S.|:" +\bar ":|.S.|:-S" c1 @end lilypond @@ -3415,8 +3415,8 @@ Verzierungen vorkommen: @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" d2. } >> @end lilypond @@ -3427,8 +3427,8 @@ also @lilypond[quote,ragged-right,relative=2,verbatim,fragment] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" \grace s16 d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" \grace s16 d2. } >> @end lilypond diff --git a/Documentation/de/notation/vocal.itely b/Documentation/de/notation/vocal.itely index a767c7cff8..4bc8271777 100644 --- a/Documentation/de/notation/vocal.itely +++ b/Documentation/de/notation/vocal.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Till Paala @@ -2930,9 +2930,9 @@ a4 b c2 \bar "'" a4 b c2 a4 b c2 -\bar ":" +\bar ";" a4 b c2 -\bar "dashed" +\bar "!" a4 b c2 \bar "||" @end lilypond diff --git a/Documentation/es/notation/ancient.itely b/Documentation/es/notation/ancient.itely index e0bd1a2c9f..7ba6865250 100644 --- a/Documentation/es/notation/ancient.itely +++ b/Documentation/es/notation/ancient.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Notación antigua @section Notación antigua @@ -984,7 +984,7 @@ Por ejemplo: @c @example @c \set Score.timing = ##f -@c \set Score.defaultBarType = "empty" +@c \set Score.defaultBarType = "-" @c \override NoteHead #'style = #'neomensural @c \override Staff.TimeSignature #'style = #'neomensural @c \clef "petrucci-g" @@ -997,7 +997,7 @@ Por ejemplo: \score { \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -1026,7 +1026,7 @@ transcribe de la siguiente manera: @lilypond[quote,ragged-right] \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -2486,7 +2486,7 @@ inmediatamente con la introducción del propio canto: \new KievanVoice = "melody" \transpose c c' { \cadenzaOn c4 c c c c2 b,\longa - \bar "kievan" + \bar "k" } \new Lyrics \lyricsto "melody" { Го -- спо -- ди по -- ми -- луй. @@ -2609,12 +2609,12 @@ Referencia de la notación: Normalmente se coloca una figura decorativa al final de una pieza de notación kievana, que puede denominarse como «doble barra final del -canto kievano». Se puede invocar como @code{\bar "kievan"}. +canto kievano». Se puede invocar como @code{\bar "k"}. @lilypond[quote,relative=1,notime,verbatim] \clef "kievan-do" \override NoteHead #'style = #'kievan - c \bar "kievan" + c \bar "k" @end lilypond @seealso diff --git a/Documentation/es/notation/rhythms.itely b/Documentation/es/notation/rhythms.itely index 024db45c37..407db3cc81 100644 --- a/Documentation/es/notation/rhythms.itely +++ b/Documentation/es/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Duraciones @section Duraciones @@ -2684,7 +2684,7 @@ f1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" -b1 \bar ".|." +b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 @@ -2694,8 +2694,8 @@ e1 así como la barra de puntos y la discontinua: @lilypond[quote,relative=1,verbatim] -f1 \bar ":" -g1 \bar "dashed" +f1 \bar ";" +g1 \bar "!" a1 @end lilypond @@ -2703,11 +2703,11 @@ a1 y cinco tipos de barra de repetición: @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" -g1 \bar ":|:" +f1 \bar ".|:" +g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" -c1 \bar ":|" +c1 \bar ":|." e1 @end lilypond @@ -2732,13 +2732,13 @@ c4 c c c c4 c c c \break \bar "S" c4 c c c -\bar "|S" +\bar "S-|" c4 c c c \break -\bar "|S" +\bar "S-|" c4 c c c -\bar "S|" +\bar "S-S" c4 c c c \break -\bar "S|" +\bar "S-S" c1 @end lilypond @@ -2757,9 +2757,9 @@ principio de la línea siguiente. @lilypond[quote,relative=2,verbatim] c4 c c c -\bar "||:" +\bar ".|:-||" c4 c c c \break -\bar "||:" +\bar ".|:-||" c4 c c c @end lilypond @@ -2768,29 +2768,29 @@ existen seis variantes diferentes: @lilypond[quote,relative=2,verbatim] c4 c c c -\bar ":|S" +\bar ":|.S" c4 c c c \break -\bar ":|S" +\bar ":|.S" c4 c c c -\bar ":|S." +\bar ":|.S-S" c4 c c c \break -\bar ":|S." +\bar ":|.S-S" c4 c c c -\bar "S|:" +\bar "S.|:-S" c4 c c c \break -\bar "S|:" +\bar "S.|:-S" c4 c c c -\bar ".S|:" +\bar "S.|:" c4 c c c \break -\bar ".S|:" +\bar "S.|:" c4 c c c -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c \break -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c -\bar ":|S.|:" +\bar ":|.S.|:-S" c4 c c c \break -\bar ":|S.|:" +\bar ":|.S.|:-S" c1 @end lilypond @@ -3394,8 +3394,8 @@ pentagramas con adornos y sin adornos, por ejemplo @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" d2. } >> @end lilypond @@ -3406,8 +3406,8 @@ anterior @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" \grace s16 d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" \grace s16 d2. } >> @end lilypond diff --git a/Documentation/es/notation/vocal.itely b/Documentation/es/notation/vocal.itely index 6e9afa58d3..68c141f0c5 100644 --- a/Documentation/es/notation/vocal.itely +++ b/Documentation/es/notation/vocal.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Música vocal @section Música vocal @@ -3009,9 +3009,9 @@ a4 b c2 \bar "'" a4 b c2 a4 b c2 -\bar ":" +\bar ";" a4 b c2 -\bar "dashed" +\bar "!" a4 b c2 \bar "||" @end lilypond diff --git a/Documentation/fr/notation/ancient.itely b/Documentation/fr/notation/ancient.itely index 3e174bdb7b..7609193ed8 100644 --- a/Documentation/fr/notation/ancient.itely +++ b/Documentation/fr/notation/ancient.itely @@ -8,7 +8,7 @@ @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Jean-Charles Malahieude @@ -993,7 +993,7 @@ Par exemple, @c @example @c \set Score.timing = ##f -@c \set Score.defaultBarType = "empty" +@c \set Score.defaultBarType = "-" @c \override NoteHead #'style = #'neomensural @c \override Staff.TimeSignature #'style = #'neomensural @c \clef "petrucci-g" @@ -1006,7 +1006,7 @@ Par exemple, \score { \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -1034,7 +1034,7 @@ par le @code{Mensural_ligature_engraver}, on obtient @lilypond[quote,ragged-right] \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -2489,7 +2489,7 @@ lancer dans la saisie de votre chant, comme ci-dessous : \new KievanVoice = "melody" \transpose c c' { \cadenzaOn c4 c c c c2 b,\longa - \bar "kievan" + \bar "k" } \new Lyrics \lyricsto "melody" { Го -- спо -- ди по -- ми -- луй. @@ -2612,12 +2612,12 @@ Manuel de notation : Les pièces en notation kiévienne sont habituellement terminées par une décoration qui fait office de barre finale. Elle s'obtient à l'aide -d'un @code{\bar "kievan"}. +d'un @code{\bar "k"}. @lilypond[quote,relative=1,notime,verbatim] \clef "kievan-do" \override NoteHead #'style = #'kievan - c \bar "kievan" + c \bar "k" @end lilypond @seealso diff --git a/Documentation/fr/notation/rhythms.itely b/Documentation/fr/notation/rhythms.itely index ff9014d5f5..771792a183 100644 --- a/Documentation/fr/notation/rhythms.itely +++ b/Documentation/fr/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Frédéric Chiasson, Jean-Charles Malahieude @c Translation checkers: Valentin Villenave, François Martin, Xavier Scheuer @@ -2632,7 +2632,7 @@ f1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" -b1 \bar ".|." +b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 @@ -2642,8 +2642,8 @@ e1 ainsi que d'une barre en pointillé et d'une discontinue : @lilypond[quote,relative=1,verbatim] -f1 \bar ":" -g1 \bar "dashed" +f1 \bar ";" +g1 \bar "!" a1 @end lilypond @@ -2651,11 +2651,11 @@ a1 et de cinq types de barre de reprise : @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" -g1 \bar ":|:" +f1 \bar ".|:" +g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" -c1 \bar ":|" +c1 \bar ":|." e1 @end lilypond @@ -2681,13 +2681,13 @@ c4 c c c c4 c c c \break \bar "S" c4 c c c -\bar "|S" +\bar "S-|" c4 c c c \break -\bar "|S" +\bar "S-|" c4 c c c -\bar "S|" +\bar "S-S" c4 c c c \break -\bar "S|" +\bar "S-S" c1 @end lilypond @@ -2707,9 +2707,9 @@ nouvelle. @lilypond[quote,relative=2,verbatim] c4 c c c -\bar "||:" +\bar ".|:-||" c4 c c c \break -\bar "||:" +\bar ".|:-||" c4 c c c @end lilypond @@ -2718,29 +2718,29 @@ reprise avec un signe @emph{segno} : @lilypond[quote,relative=2,verbatim] c4 c c c -\bar ":|S" +\bar ":|.S" c4 c c c \break -\bar ":|S" +\bar ":|.S" c4 c c c -\bar ":|S." +\bar ":|.S-S" c4 c c c \break -\bar ":|S." +\bar ":|.S-S" c4 c c c -\bar "S|:" +\bar "S.|:-S" c4 c c c \break -\bar "S|:" +\bar "S.|:-S" c4 c c c -\bar ".S|:" +\bar "S.|:" c4 c c c \break -\bar ".S|:" +\bar "S.|:" c4 c c c -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c \break -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c -\bar ":|S.|:" +\bar ":|.S.|:-S" c4 c c c \break -\bar ":|S.|:" +\bar ":|.S.|:-S" c1 @end lilypond @@ -3318,8 +3318,8 @@ mêlez des portées comprenant des petites notes et d'autres sans : @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" d2. } >> @end lilypond @@ -3330,8 +3330,8 @@ correspondant à la durée des petites notes : @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" \grace s16 d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" \grace s16 d2. } >> @end lilypond diff --git a/Documentation/fr/notation/vocal.itely b/Documentation/fr/notation/vocal.itely index 06a0dd2701..f525842211 100644 --- a/Documentation/fr/notation/vocal.itely +++ b/Documentation/fr/notation/vocal.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Valentin Villenave, Jean-Charles Malahieude @c Translation checkers: Jean-Jacques Gerbaud @@ -3020,9 +3020,9 @@ a4 b c2 \bar "'" a4 b c2 a4 b c2 -\bar ":" +\bar ";" a4 b c2 -\bar "dashed" +\bar "!" a4 b c2 \bar "||" @end lilypond diff --git a/Documentation/ja/notation/rhythms.itely b/Documentation/ja/notation/rhythms.itely index 38843909c2..6313d520ea 100644 --- a/Documentation/ja/notation/rhythms.itely +++ b/Documentation/ja/notation/rhythms.itely @@ -6,7 +6,7 @@ version that you are working on. See TRANSLATION for details. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Yoshiki Sawada @c Translation status: post-GDP @@ -2634,7 +2634,7 @@ f1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" -b1 \bar ".|." +b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 @@ -2644,8 +2644,8 @@ e1 さらに、点線と破線の小節線があります: @lilypond[quote,relative=1,verbatim] -f1 \bar ":" -g1 \bar "dashed" +f1 \bar ";" +g1 \bar "!" a1 @end lilypond @@ -2653,11 +2653,11 @@ a1 さらに、繰り返しの小節線が 5 種類あります: @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" -g1 \bar ":|:" +f1 \bar ".|:" +g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" -c1 \bar ":|" +c1 \bar ":|." e1 @end lilypond @@ -2681,13 +2681,13 @@ c4 c c c c4 c c c \break \bar "S" c4 c c c -\bar "|S" +\bar "S-|" c4 c c c \break -\bar "|S" +\bar "S-|" c4 c c c -\bar "S|" +\bar "S-S" c4 c c c \break -\bar "S|" +\bar "S-S" c1 @end lilypond @@ -2708,9 +2708,9 @@ c1 @lilypond[quote,relative=2,verbatim] c4 c c c -\bar "||:" +\bar ".|:-||" c4 c c c \break -\bar "||:" +\bar ".|:-||" c4 c c c @end lilypond @@ -2718,29 +2718,29 @@ c4 c c c @lilypond[quote,relative=2,verbatim] c4 c c c -\bar ":|S" +\bar ":|.S" c4 c c c \break -\bar ":|S" +\bar ":|.S" c4 c c c -\bar ":|S." +\bar ":|.S-S" c4 c c c \break -\bar ":|S." +\bar ":|.S-S" c4 c c c -\bar "S|:" +\bar "S.|:-S" c4 c c c \break -\bar "S|:" +\bar "S.|:-S" c4 c c c -\bar ".S|:" +\bar "S.|:" c4 c c c \break -\bar ".S|:" +\bar "S.|:" c4 c c c -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c \break -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c -\bar ":|S.|:" +\bar ":|.S.|:-S" c4 c c c \break -\bar ":|S.|:" +\bar ":|.S.|:-S" c1 @end lilypond @@ -3347,8 +3347,8 @@ c1 \afterGrace d1 { c16[ d] } c1 @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" d2. } >> @end lilypond @@ -3359,8 +3359,8 @@ c1 \afterGrace d1 { c16[ d] } c1 @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" \grace s16 d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" \grace s16 d2. } >> @end lilypond diff --git a/Documentation/ja/notation/vocal.itely b/Documentation/ja/notation/vocal.itely index 6926442e3c..9eb64a05a2 100644 --- a/Documentation/ja/notation/vocal.itely +++ b/Documentation/ja/notation/vocal.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @c Translators: Yoshiki Sawada @c Translation status: post-GDP @@ -2953,9 +2953,9 @@ a4 b c2 \bar "'" a4 b c2 a4 b c2 -\bar ":" +\bar ";" a4 b c2 -\bar "dashed" +\bar "!" a4 b c2 \bar "||" @end lilypond diff --git a/Documentation/notation/ancient.itely b/Documentation/notation/ancient.itely index 7ef446ee62..af466ce635 100644 --- a/Documentation/notation/ancient.itely +++ b/Documentation/notation/ancient.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Ancient notation @@ -943,7 +943,7 @@ For example, @c @example @c \set Score.timing = ##f -@c \set Score.defaultBarType = "empty" +@c \set Score.defaultBarType = "-" @c \override NoteHead #'style = #'neomensural @c \override Staff.TimeSignature #'style = #'neomensural @c \clef "petrucci-g" @@ -956,7 +956,7 @@ For example, \score { \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -985,7 +985,7 @@ to the following @lilypond[quote,ragged-right] \transpose c c' { \set Score.timing = ##f - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" \override NoteHead #'style = #'petrucci \override Staff.TimeSignature #'style = #'mensural \clef "petrucci-g" @@ -2438,7 +2438,7 @@ values, so you can immediately go ahead entering the chant: \new KievanVoice = "melody" \transpose c c' { \cadenzaOn c4 c c c c2 b,\longa - \bar "kievan" + \bar "k" } \new Lyrics \lyricsto "melody" { Го -- спо -- ди по -- ми -- луй. @@ -2554,12 +2554,12 @@ Notation Reference: A decorative figure is commonly placed at the end of a piece of Kievan notation, which may be called the Kievan final bar line. -It can be invoked as @code{\bar "kievan"}. +It can be invoked as @code{\bar "k"}. @lilypond[quote,relative=1,notime,verbatim] \clef "kievan-do" \override NoteHead #'style = #'kievan - c \bar "kievan" + c \bar "k" @end lilypond @seealso diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index c2a06b4202..975017057c 100644 --- a/Documentation/notation/rhythms.itely +++ b/Documentation/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Rhythms @section Rhythms @@ -2646,7 +2646,7 @@ f1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" -b1 \bar ".|." +b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 @@ -2656,8 +2656,8 @@ e1 together with dotted and dashed bar lines: @lilypond[quote,relative=1,verbatim] -f1 \bar ":" -g1 \bar "dashed" +f1 \bar ";" +g1 \bar "!" a1 @end lilypond @@ -2665,11 +2665,11 @@ a1 and five types of repeat bar line: @lilypond[quote,relative=1,verbatim] -f1 \bar "|:" -g1 \bar ":|:" +f1 \bar ".|:" +g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" -c1 \bar ":|" +c1 \bar ":|." e1 @end lilypond @@ -2692,13 +2692,13 @@ c4 c c c c4 c c c \break \bar "S" c4 c c c -\bar "|S" +\bar "S-|" c4 c c c \break -\bar "|S" +\bar "S-|" c4 c c c -\bar "S|" +\bar "S-S" c4 c c c \break -\bar "S|" +\bar "S-S" c1 @end lilypond @@ -2717,9 +2717,9 @@ the next line. @lilypond[quote,relative=2,verbatim] c4 c c c -\bar "||:" +\bar ".|:-||" c4 c c c \break -\bar "||:" +\bar ".|:-||" c4 c c c @end lilypond @@ -2728,29 +2728,29 @@ variations: @lilypond[quote,relative=2,verbatim] c4 c c c -\bar ":|S" +\bar ":|.S" c4 c c c \break -\bar ":|S" +\bar ":|.S" c4 c c c -\bar ":|S." +\bar ":|.S-S" c4 c c c \break -\bar ":|S." +\bar ":|.S-S" c4 c c c -\bar "S|:" +\bar "S.|:-S" c4 c c c \break -\bar "S|:" +\bar "S.|:-S" c4 c c c -\bar ".S|:" +\bar "S.|:" c4 c c c \break -\bar ".S|:" +\bar "S.|:" c4 c c c -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c \break -\bar ":|S|:" +\bar ":|.S.|:" c4 c c c -\bar ":|S.|:" +\bar ":|.S.|:-S" c4 c c c \break -\bar ":|S.|:" +\bar ":|.S.|:-S" c1 @end lilypond @@ -3341,8 +3341,8 @@ staves without, for example, @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" d2. } >> @end lilypond @@ -3352,8 +3352,8 @@ durations in the other staves. For the above example @lilypond[quote,relative=2,verbatim] << - \new Staff { e4 \bar "|:" \grace c16 d2. } - \new Staff { c4 \bar "|:" \grace s16 d2. } + \new Staff { e4 \bar ".|:" \grace c16 d2. } + \new Staff { c4 \bar ".|:" \grace s16 d2. } >> @end lilypond diff --git a/Documentation/notation/vocal.itely b/Documentation/notation/vocal.itely index 0dc82ee2f5..0fe84ae203 100644 --- a/Documentation/notation/vocal.itely +++ b/Documentation/notation/vocal.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.16.0" +@c \version "2.17.5" @node Vocal music @section Vocal music @@ -2903,9 +2903,9 @@ a4 b c2 \bar "'" a4 b c2 a4 b c2 -\bar ":" +\bar ";" a4 b c2 -\bar "dashed" +\bar "!" a4 b c2 \bar "||" @end lilypond diff --git a/Documentation/snippets/heavily-customized-polymetric-time-signatures.ly b/Documentation/snippets/heavily-customized-polymetric-time-signatures.ly index 795a27de58..fafe1cb999 100644 --- a/Documentation/snippets/heavily-customized-polymetric-time-signatures.ly +++ b/Documentation/snippets/heavily-customized-polymetric-time-signatures.ly @@ -4,7 +4,7 @@ %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. -\version "2.17.0" +\version "2.17.5" \header { lsrtags = "contemporary-notation, percussion, real-music, rhythms" @@ -50,8 +50,8 @@ melody = \relative c'' { } drum = \new DrumStaff \drummode { - \bar "|:" bd4.^\markup { Drums } sn4 bd \bar ":" sn4. - bd4 sn \bar ":" bd sn bd4. sn4 bd \bar ":|" + \bar ".|:" bd4.^\markup { Drums } sn4 bd \bar ";" sn4. + bd4 sn \bar ";" bd sn bd4. sn4 bd \bar ":|." } { diff --git a/Documentation/snippets/new/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly b/Documentation/snippets/new/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly new file mode 100644 index 0000000000..7e5f130455 --- /dev/null +++ b/Documentation/snippets/new/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly @@ -0,0 +1,36 @@ +\version "2.17.5" + +\header { + lsrtags = "repeats, tweaks-and-overrides" + + texidoc = " +A @code{.|:} bar line can be printed at the beginning of a piece, by +overriding the relevant property: + +" + doctitle = "Printing a repeat sign at the beginning of a piece" +} + + +\relative c'' { + \once \override Score.BreakAlignment #'break-align-orders = + #(make-vector 3 '(instrument-name + left-edge + ambitus + breathing-sign + clef + key-signature + time-signature + staff-bar + custos)) + \once \override Staff.TimeSignature #'space-alist = + #'((first-note . (fixed-space . 2.0)) + (right-edge . (extra-space . 0.5)) + ;; free up some space between time signature + ;; and repeat bar line + (staff-bar . (extra-space . 1))) + \bar ".|:" + c1 + d1 + d4 e f g +} diff --git a/Documentation/snippets/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly b/Documentation/snippets/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly index f2d620be9e..c7ad9c3550 100644 --- a/Documentation/snippets/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly +++ b/Documentation/snippets/printing-a-repeat-sign-at-the-beginning-of-a-piece.ly @@ -1,16 +1,17 @@ -%% DO NOT EDIT this file manually; it is automatically -%% generated from LSR http://lsr.dsi.unimi.it -%% Make any changes in LSR itself, or in Documentation/snippets/new/ , -%% and then run scripts/auxiliar/makelsr.py -%% -%% This file is in the public domain. -\version "2.16.0" +% DO NOT EDIT this file manually; it is automatically +% generated from Documentation/snippets/new +% Make any changes in Documentation/snippets/new/ +% and then run scripts/auxiliar/makelsr.py +% +% This file is in the public domain. +%% Note: this file works from version 2.17.5 +\version "2.17.5" \header { lsrtags = "repeats, tweaks-and-overrides" texidoc = " -A @code{|:} bar line can be printed at the beginning of a piece, by +A @code{.|:} bar line can be printed at the beginning of a piece, by overriding the relevant property: " @@ -35,7 +36,7 @@ overriding the relevant property: ;; free up some space between time signature ;; and repeat bar line (staff-bar . (extra-space . 1))) - \bar "|:" + \bar ".|:" c1 d1 d4 e f g diff --git a/Documentation/snippets/repeats-headword.ly b/Documentation/snippets/repeats-headword.ly index 0f284e5bc4..fa562f980a 100644 --- a/Documentation/snippets/repeats-headword.ly +++ b/Documentation/snippets/repeats-headword.ly @@ -4,7 +4,7 @@ %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. -\version "2.16.0" +\version "2.17.5" \header { lsrtags = "headword" @@ -30,7 +30,7 @@ Repeats headword \key df \major \time 2/4 \set Score.currentBarNumber = #9 - \bar "|:" + \bar ".|:" 4 ( 8.. 32 @@ -84,7 +84,7 @@ Repeats headword \oneVoice r8 \clef bass - \bar ":|" + \bar ":|." } \new Staff = LH { diff --git a/Documentation/snippets/setting-the-double-repeat-default-for-volte.ly b/Documentation/snippets/setting-the-double-repeat-default-for-volte.ly index 7051646a03..c469c52e64 100644 --- a/Documentation/snippets/setting-the-double-repeat-default-for-volte.ly +++ b/Documentation/snippets/setting-the-double-repeat-default-for-volte.ly @@ -4,7 +4,7 @@ %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. -\version "2.16.0" +\version "2.17.5" \header { lsrtags = "repeats" @@ -19,7 +19,7 @@ be set using @code{doubleRepeatType}. \relative c'' { \repeat volta 1 { c1 } - \set Score.doubleRepeatType = #":|:" + \set Score.doubleRepeatType = #":..:" \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":|.|:" \repeat volta 1 { c1 } diff --git a/Documentation/snippets/unfretted-headword.ly b/Documentation/snippets/unfretted-headword.ly index eb7d328427..a7d4258638 100644 --- a/Documentation/snippets/unfretted-headword.ly +++ b/Documentation/snippets/unfretted-headword.ly @@ -4,7 +4,7 @@ %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. -\version "2.17.0" +\version "2.17.5" \header { lsrtags = "headword" @@ -221,7 +221,7 @@ ViolinSolo = \relative c' { >> \override Score.Rest #'transparent = ##t - \set Score.defaultBarType = "empty" + \set Score.defaultBarType = "-" >> \layout { diff --git a/input/regression/auto-beam-bar.ly b/input/regression/auto-beam-bar.ly index 8daa66e330..34fa328dda 100644 --- a/input/regression/auto-beam-bar.ly +++ b/input/regression/auto-beam-bar.ly @@ -1,5 +1,5 @@ -\version "2.16.0" +\version "2.17.5" \header{ texidoc="No auto beams will be put over (manual) repeat bars." @@ -8,5 +8,5 @@ texidoc="No auto beams will be put over (manual) repeat bars." { \time 3/4 - a'4 b' c''8 \bar ":|:" d''8 + a'4 b' c''8 \bar ":..:" d''8 } diff --git a/input/regression/bar-line-define-bar-glyph.ly b/input/regression/bar-line-define-bar-glyph.ly new file mode 100644 index 0000000000..7b5ce64ae2 --- /dev/null +++ b/input/regression/bar-line-define-bar-glyph.ly @@ -0,0 +1,28 @@ +\version "2.17.5" + +\header { texidoc = "New bar line glyphs can be defined in Scheme." + } + +\paper { ragged-right = ##t } + + +#(define (make-coda-sign-bar-line grob extent) + (let ((stencil (ly:font-get-glyph (ly:grob-default-font grob) + "scripts.coda"))) + stencil)) + +#(add-bar-glyph-print-procedure "0" make-coda-sign-bar-line) + +\defineBarLine "0" #'("0" "" "") + + +\relative \new StaffGroup << + \new Staff { + c4 c \bar "0" c c \bar "0" \break + c1 + } + \new Staff { + c4 c c c + c1 + } +>> diff --git a/input/regression/bar-line-define-bar-line.ly b/input/regression/bar-line-define-bar-line.ly new file mode 100644 index 0000000000..66a5777293 --- /dev/null +++ b/input/regression/bar-line-define-bar-line.ly @@ -0,0 +1,21 @@ +\version "2.17.5" + +\header { texidoc = "New bar line styles can be defined by @code{\defineBarLine}." + } + +\paper { ragged-right = ##t } + +\defineBarLine "[|;" #'("|" "[|;" " |") +\defineBarLine ";|]" #'(";|]" "" " |") + +\relative \new StaffGroup << + \new Staff { + c4 c \bar "[|;" c c \bar ";|]" \break + c4 c \bar ";|]" c c \bar "[|;" \break + c1 } + \new Staff { + c4 c c c + c4 c c c + c1 + } +>> diff --git a/input/regression/bar-line-segno.ly b/input/regression/bar-line-segno.ly index 17d5a7dc0e..7b17c0f58b 100644 --- a/input/regression/bar-line-segno.ly +++ b/input/regression/bar-line-segno.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "Segno bar lines can be used to mark the begin and the end of a segno part." @@ -8,10 +8,10 @@ \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 + c4 \bar "S" c \bar "S-|" c \bar "S-S" c \bar ":|.S" \break + c4 c \bar ":|.S.|:" c c \bar ":|.S.|:-S" \break + c4 c c2 \bar "S.|:" \break + c1 \bar ":|.S-S" \break c1 \bar "S" \break c1 } \new Staff { diff --git a/input/regression/bar-lines.ly b/input/regression/bar-lines.ly index 359ccb4dd2..1ae85f4e26 100644 --- a/input/regression/bar-lines.ly +++ b/input/regression/bar-lines.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "Various types of bar lines can be drawn. @@ -17,9 +17,9 @@ space, centered on the top-most barline. \relative \new StaffGroup << \new Staff = "1" { - c2 \bar "dashed" c + c2 \bar "!" c s1 - c2 \bar ":" c + c2 \bar ";" c s1 c2 \bar "." c s1 diff --git a/input/regression/double-repeat.ly b/input/regression/double-repeat.ly index 08cc5f835d..9ce981dc59 100644 --- a/input/regression/double-repeat.ly +++ b/input/regression/double-repeat.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "Three types of double repeat bar line are supported." @@ -7,7 +7,7 @@ \new Staff \relative c' { c1 \mark "\":|:\"" - \bar ":|:" + \bar ":..:" c1 \mark "\":|.|:\"" \bar ":|.|:" diff --git a/input/regression/grace-volta-repeat-2.ly b/input/regression/grace-volta-repeat-2.ly index 113de90be8..1a150fcc8a 100644 --- a/input/regression/grace-volta-repeat-2.ly +++ b/input/regression/grace-volta-repeat-2.ly @@ -1,9 +1,9 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "A volta repeat may begin with a grace. Consecutive - ending and starting repeat bars are merged into one @code{:||:}." + ending and starting repeat bars are merged into one @code{:..:}." } @@ -11,7 +11,7 @@ \relative c' { \repeat volta 2 { - c1 + c1 } \repeat volta 2 { \grace {c8 } c4 diff --git a/input/regression/lyrics-bar.ly b/input/regression/lyrics-bar.ly index c559bedebe..1f41177f9b 100644 --- a/input/regression/lyrics-bar.ly +++ b/input/regression/lyrics-bar.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header{ texidoc=" @@ -13,7 +13,7 @@ lyrics do not collide with barlines. \relative c'' << \new Voice = "a"{ - b1 \bar "|:" b1 \bar ":|" b1 \bar "|." + b1 \bar ".|:" b1 \bar ":|." b1 \bar "|." } \new Lyrics \with { \consists "Bar_engraver" diff --git a/input/regression/music-function.ly b/input/regression/music-function.ly index 0a1d36825a..8f4da124fa 100644 --- a/input/regression/music-function.ly +++ b/input/regression/music-function.ly @@ -1,13 +1,13 @@ \header { - + texidoc = "Music functions are generic music transformation functions, which can be used to extend music syntax seamlessly. Here we demonstrate a @code{\\myBar} function, which works similar to @code{\\bar}, but is implemented completely in Scheme." } -\version "2.16.0" +\version "2.17.5" myBar = #(define-music-function (parser location bar-type) (string?) (context-spec-music @@ -17,6 +17,6 @@ myBar = #(define-music-function (parser location bar-type) (string?) \layout { ragged-right = ##t } { - d4 \myBar "|:" d4 + d4 \myBar ".|:" d4 } diff --git a/input/regression/non-centered-bar-lines.ly b/input/regression/non-centered-bar-lines.ly index 79e8ec88dc..308a6e3abb 100644 --- a/input/regression/non-centered-bar-lines.ly +++ b/input/regression/non-centered-bar-lines.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "Bar lines are positioned correctly when using custom staves which are not centered around position@tie{}0. @@ -7,6 +7,6 @@ staves which are not centered around position@tie{}0. \new Staff { \override Staff.StaffSymbol #'line-positions = #'(1 3 5 7 9) c''1 \bar "||" - c''1 \bar ":" + c''1 \bar ";" c''1 \bar "|." } diff --git a/input/regression/number-staff-lines.ly b/input/regression/number-staff-lines.ly index 489e62be63..99e3251d01 100644 --- a/input/regression/number-staff-lines.ly +++ b/input/regression/number-staff-lines.ly @@ -1,5 +1,5 @@ -\version "2.16.0" +\version "2.17.5" \header{ texidoc=" The number of stafflines of a staff can be set. Ledger @@ -12,6 +12,6 @@ adjusted accordingly. " \override StaffSymbol #'line-count = #3 } \relative c { - c' c c c | g' g g g \bar ":|" + c' c c c | g' g g g \bar ":|." } diff --git a/input/regression/prefatory-spacing-matter.ly b/input/regression/prefatory-spacing-matter.ly index 7ab076858f..8eb6b0b20a 100644 --- a/input/regression/prefatory-spacing-matter.ly +++ b/input/regression/prefatory-spacing-matter.ly @@ -1,5 +1,5 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "Distances between prefatory items (e.g. clef, bar, @@ -16,11 +16,11 @@ bar-line is different from the start of line. \relative c'' { \set Staff.instrumentName = "fobar" - \bar "||:" + \bar ".|:-||" \key cis \major cis4 cis4 cis4 cis4 \clef bass cis,1 \clef treble - \bar ":|" + \bar ":|." \key g \minor c1 } diff --git a/input/regression/repeat-sign-global-size-10.ly b/input/regression/repeat-sign-global-size-10.ly index 3fea78a4a8..093fd54a61 100644 --- a/input/regression/repeat-sign-global-size-10.ly +++ b/input/regression/repeat-sign-global-size-10.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "The two dots of a repeat sign should be symmetric to the staff centre and avoid staff lines even for exotic staves. @@ -12,18 +12,18 @@ Test set-global-staff size 10 (with layout-set-staff-size)." \context Staff = "s1" \with { \override StaffSymbol #'staff-space = #0.6 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'line-positions = #'(-4 -2 0 2) \override StaffSymbol #'staff-space = #0.7 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" { - s1 \bar ":|" + s1 \bar ":|." } >> } @@ -31,20 +31,20 @@ Test set-global-staff size 10 (with layout-set-staff-size)." \score { << \context Staff = "s1" { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #1.7 \override StaffSymbol #'line-positions = #'(-4 -2 0 2) } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" \with { \override StaffSymbol #'staff-space = #3 } { - s1 \bar ":|" + s1 \bar ":|." } >> diff --git a/input/regression/repeat-sign-global-size-30.ly b/input/regression/repeat-sign-global-size-30.ly index f3ac22d60a..69b136a533 100644 --- a/input/regression/repeat-sign-global-size-30.ly +++ b/input/regression/repeat-sign-global-size-30.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "The two dots of a repeat sign should be symmetric to the staff centre and avoid staff lines even for exotic staves. @@ -12,18 +12,18 @@ Test set-global-staff size 30 (with layout-set-staff-size)." \context Staff = "s1" \with { \override StaffSymbol #'staff-space = #0.5 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #0.6 \override StaffSymbol #'line-positions = #'(-4 -2 0 2) } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" { - s1 \bar ":|" + s1 \bar ":|." } >> } @@ -31,20 +31,20 @@ Test set-global-staff size 30 (with layout-set-staff-size)." \score { << \context Staff = "s1" { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #0.33 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" \with { \override StaffSymbol #'staff-space = #0.33 \override StaffSymbol #'line-positions = #'(-4 -2 0 2) } { - s1 \bar ":|" + s1 \bar ":|." } >> diff --git a/input/regression/repeat-sign-global-size-5.ly b/input/regression/repeat-sign-global-size-5.ly index cccfd56892..dc1a88e0cc 100644 --- a/input/regression/repeat-sign-global-size-5.ly +++ b/input/regression/repeat-sign-global-size-5.ly @@ -1,4 +1,4 @@ -\version "2.17.2" +\version "2.17.5" \header { texidoc = "The two dots of a repeat sign should be symmetric to the staff centre and avoid staff lines even for exotic staves. @@ -12,17 +12,17 @@ Test set-global-staff size 10 (with layout-set-staff-size)." \context Staff = "s1" \with { \override StaffSymbol #'staff-space = #0.7 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'line-positions = #'(-4 -2 0 2) } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" { - s1 \bar ":|" + s1 \bar ":|." } >> } @@ -30,20 +30,20 @@ Test set-global-staff size 10 (with layout-set-staff-size)." \score { << \context Staff = "s1" { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #3 \override StaffSymbol #'line-positions = #'(-4 -2 0 2) } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" \with { \override StaffSymbol #'staff-space = #6 } { - s1 \bar ":|" + s1 \bar ":|." } >> diff --git a/input/regression/repeat-sign-layout-size.ly b/input/regression/repeat-sign-layout-size.ly index 0856984dd7..c47cac2359 100644 --- a/input/regression/repeat-sign-layout-size.ly +++ b/input/regression/repeat-sign-layout-size.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "The two dots of a repeat sign should be symmetric to the staff centre and avoid staff lines even for exotic staves. @@ -10,17 +10,17 @@ Test layout-set-staff-size." \context Staff = "s1" \with { \override StaffSymbol #'staff-space = #0.3 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #0.5 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" { - s1 \bar ":|" + s1 \bar ":|." } >> @@ -35,17 +35,17 @@ Test layout-set-staff-size." \context Staff = "s1" \with { \override StaffSymbol #'staff-space = #0.5 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s2" \with { \override StaffSymbol #'staff-space = #0.6 } { - s1 \bar ":|" + s1 \bar ":|." } \context Staff = "s3" { - s1 \bar ":|" + s1 \bar ":|." } >> } diff --git a/input/regression/repeat-sign.ly b/input/regression/repeat-sign.ly index b40c08d590..841e19d2ca 100644 --- a/input/regression/repeat-sign.ly +++ b/input/regression/repeat-sign.ly @@ -1,11 +1,11 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc = "The two dots of a repeat sign should be symmetric to the staff centre and avoid staff lines even for exotic staves." } -mus = \context Voice { \relative f' { d e f g \bar ":|" } } +mus = \context Voice { \relative f' { d e f g \bar ":|." } } \new Staff { << diff --git a/input/regression/span-bar-break.ly b/input/regression/span-bar-break.ly index 5bd5b074df..aac291494d 100644 --- a/input/regression/span-bar-break.ly +++ b/input/regression/span-bar-break.ly @@ -1,9 +1,9 @@ -\version "2.16.0" +\version "2.17.5" \header { - texidoc = "At the beginning of a system, the @code{|:} repeat -barline is drawn between the staves, but the @code{:|} is not." + texidoc = "At the beginning of a system, the @code{.|:} repeat +barline is drawn between the staves, but the @code{:|.} is not." } @@ -12,8 +12,8 @@ barline is drawn between the staves, but the @code{:|} is not." \new PianoStaff << \new Staff = "up" { - \bar "|:" r1 - \bar ":|" \break r1 + \bar ".|:" r1 + \bar ":|." \break r1 } \new Staff = "down" { r r } >> diff --git a/input/regression/tuplet-broken.ly b/input/regression/tuplet-broken.ly index 172d28cabc..5d124e0094 100644 --- a/input/regression/tuplet-broken.ly +++ b/input/regression/tuplet-broken.ly @@ -8,7 +8,7 @@ } -\version "2.16.0" +\version "2.17.5" \paper { ragged-right = ##t @@ -25,10 +25,10 @@ (markup #:arrow-head X RIGHT #f)) \times 11/19 { c4 c4 c4 c4 - \bar "empty" \break + \bar "-" \break c4 c4 c4 c4 c4 c4 c4 c4 - \bar "empty" \break + \bar "-" \break c4 c4 c4 c4 c4 c4 c4 } diff --git a/input/regression/tuplet-full-length.ly b/input/regression/tuplet-full-length.ly index 5e4b46bab5..96016b471a 100644 --- a/input/regression/tuplet-full-length.ly +++ b/input/regression/tuplet-full-length.ly @@ -5,7 +5,7 @@ start of the next non-tuplet note. " } -\version "2.16.0" +\version "2.17.5" \paper { ragged-right = ##t indent = 0.0 } @@ -18,9 +18,9 @@ indent = 0.0 } \set tupletFullLength = ##t c4 \times 2/3 { c8[ c c] } - \times 2/3 { c8[ c \bar "empty" \break c] } + \times 2/3 { c8[ c \bar "-" \break c] } << \times 2/3 { c8[ c c] } - { s4*5/6 \bar "empty" \break } >> + { s4*5/6 \bar "-" \break } >> c4 \times 2/3 { c8[ c c] } diff --git a/input/regression/zero-staff-space.ly b/input/regression/zero-staff-space.ly index 65d2eb95de..b3047a9ebd 100644 --- a/input/regression/zero-staff-space.ly +++ b/input/regression/zero-staff-space.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.17.5" \header { texidoc=" @@ -10,6 +10,6 @@ Setting staff-space to 0 does not cause a segmentation fault. \override StaffSymbol #'staff-space = #0 } { \relative c' { - c1 \bar ":|" + c1 \bar ":|." } } diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 81ff7864ff..1fe50f00f1 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -466,3 +466,15 @@ LY_DEFINE (ly_grob_vertical_less_p, "ly:grob-verticallayout (); - Real half_space = 0.5; Item *bound = dynamic_cast (me)->get_bound (LEFT); @@ -92,7 +91,7 @@ Volta_bracket_interface::print (SCM smob) Interval empty; Offset start; - start[X_AXIS] = me->spanner_length () - left - half_space; + start[X_AXIS] = me->spanner_length () - left; /* ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around. @@ -138,14 +137,8 @@ Volta_bracket_interface::modify_edge_height (Spanner *me) else str = "|"; - no_vertical_end - |= (str != ":|" - && str != "|:" - && str != "|." - && str != ":|:" - && str != ":|.|:" - && str != ":|.:" - && str != ".|"); + no_vertical_end |= ly_scm2bool (scm_call_1 (ly_lily_module_constant ("volta-bracket::calc-hook-visibility"), + ly_string2scm (str))); if (no_vertical_end || no_vertical_start) { @@ -179,5 +172,6 @@ ADD_INTERFACE (Volta_bracket_interface, "bars " "thickness " "height " + "shorten-pair " ); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 1da890c4db..06060c02e1 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -606,9 +606,9 @@ automatically when an output definition (a @code{\score} or decrescendoSpanner = #'hairpin defaultBarType = #"|" - doubleRepeatType = #":|:" - startRepeatType = #"|:" - endRepeatType = #":|" + doubleRepeatType = #":..:" + startRepeatType = #".|:" + endRepeatType = #":|." barNumberVisibility = #first-bar-number-invisible-and-no-parenthesized-bar-numbers barNumberFormatter = #robust-bar-number-function automaticBars = ##t diff --git a/ly/property-init.ly b/ly/property-init.ly index e36c3c0465..269648639b 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -84,6 +84,23 @@ balloonLengthOff = { } +%% bar lines + +defineBarLine = +#(define-void-function + (parser location bar glyph-list) (string? list?) + (_i "Define bar line settings for bar line @var{bar}. + The list @var{glyph-list} must have three entries which define + the appearance at the end of line, at the beginning of the next line, + and the span bar, respectively." ) + (if (not (= (length glyph-list) 3)) + (ly:error (_ "Argument list for bar '~a' must have three components.") bar) + (define-bar-line bar + (car glyph-list) + (cadr glyph-list) + (caddr glyph-list)))) + + %% bass figures bassFigureExtendersOn = { @@ -604,6 +621,12 @@ voiceNeutralStyle = { } +%% volta brackets + +allowVoltaHook = +#(define-void-function (parser location bar) (string?) + (allow-volta-hook bar)) + %% x notes xNotesOn = diff --git a/python/convertrules.py b/python/convertrules.py index b8921a02be..6eeb392ee4 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3392,12 +3392,37 @@ def conv (str): str = re.sub ('blank-after-score-page-force', 'blank-after-score-page-penalty', str) return str + @rule ((2, 17, 4), r"\shape Grob #offsets -> \shape #offsets Grob") def conv (str): str = re.sub (r"\\shape(\s+(?:[a-zA-Z]+|" + matchstring + "))(" + matcharg + ")", r"\\shape\2\1", str) return str +barstring=r"(\\bar|defaultBarType|segnoType|doubleRepeatType|startRepeatType|endRepeatType|doubleRepeatSegnoType|startRepeatSegnoType|endRepeatSegnoType)(\s*[=]?\s*[#]?)" + +@rule ((2, 17, 5), r"New bar line interface") +def conv(str): + str = re.sub (barstring + r'"\|:"', '\\1\\2".|:"', str) + str = re.sub (barstring + r'":\|"', '\\1\\2":|."', str) + str = re.sub (barstring + r'"\|\|:"', '\\1\\2".|:-||"', str) + str = re.sub (barstring + r'":\|:"', '\\1\\2":..:"', str) + str = re.sub (barstring + r'"\.\|\."', '\\1\\2".."', str) + str = re.sub (barstring + r'"\|S"', '\\1\\2"S-|"', str) + str = re.sub (barstring + r'"S\|"', '\\1\\2"S-S"', str) + str = re.sub (barstring + r'":\|S"', '\\1\\2":|.S"', str) + str = re.sub (barstring + r'":\|S\."', '\\1\\2":|.S-S"', str) + str = re.sub (barstring + r'"S\|:"', '\\1\\2"S.|:-S"', str) + str = re.sub (barstring + r'"\.S\|:"', '\\1\\2"S.|:"', str) + str = re.sub (barstring + r'":\|S\|:"', '\\1\\2":|.S.|:"', str) + str = re.sub (barstring + r'":\|S\.\|:"', '\\1\\2":|.S.|:-S"', str) + str = re.sub (barstring + r'":"', '\\1\\2";"', str) + str = re.sub (barstring + r'"\|s"', '\\1\\2"|-s"', str) + str = re.sub (barstring + r'"dashed"', '\\1\\2"!"', str) + str = re.sub (barstring + r'"kievan"', '\\1\\2"k"', str) + str = re.sub (barstring + r'"empty"', '\\1\\2"-"', str) + return str + # Guidelines to write rules (please keep this at the end of this file) # # - keep at most one rule per version; if several conversions should be done, diff --git a/scm/bar-line.scm b/scm/bar-line.scm index 25cf20ea27..6986f5a52a 100644 --- a/scm/bar-line.scm +++ b/scm/bar-line.scm @@ -15,34 +15,76 @@ ;;;; You should have received a copy of the GNU General Public License ;;;; along with LilyPond. If not, see . -;; helper functions + + +;; TODO: +;; (1) Dashed bar lines may stick out above and below the staff lines +;; +;; (2) Dashed and dotted lines look ugly in combination with span bars +;; +;; (This was the case in the c++-version of (span) bar stuff) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; helper functions for staff and layout properties + +(define (calc-blot thickness extent grob) + "Calculate the blot diameter by taking @code{'rounded} +and the dimensions of the extent into account." + (let* ((rounded (ly:grob-property grob 'rounded #f)) + (blot (if rounded + (let ((blot-diameter (layout-blot-diameter grob)) + (height (interval-length extent))) + + (cond ((< thickness blot-diameter) thickness) + ((< height blot-diameter) height) + (else blot-diameter))) + 0))) + + blot)) + +(define (get-span-glyph bar-glyph) + "Get the corresponding span glyph from the @code{span-glyph-bar-alist}. +Pad the string with @code{annotation-char}s to the length of the +@var{bar-glyph} string." + (let ((span-glyph (assoc-get bar-glyph span-bar-glyph-alist bar-glyph))) + + (if (string? span-glyph) + (set! span-glyph (string-pad-right + span-glyph + (string-length bar-glyph) + replacement-char))) + span-glyph)) (define (get-staff-symbol grob) + "Return the staff symbol corresponding to Grob @var{grob}." (if (grob::has-interface grob 'staff-symbol-interface) grob (ly:grob-object grob 'staff-symbol))) (define (layout-blot-diameter grob) + "Get the blot diameter of the @var{grob}'s corresponding layout." (let* ((layout (ly:grob-layout grob)) - (blot (ly:output-def-lookup layout 'blot-diameter))) + (blot-diameter (ly:output-def-lookup layout 'blot-diameter))) - blot)) + blot-diameter)) (define (layout-line-thickness grob) + "Get the line thickness of the @var{grob}'s corresponding layout." (let* ((layout (ly:grob-layout grob)) (line-thickness (ly:output-def-lookup layout 'line-thickness))) line-thickness)) -(define (staff-symbol-line-count grob) +(define (staff-symbol-line-count staff) + "Get or compute the number of lines of staff @var{staff}." (let ((line-count 0)) - (if (ly:grob? grob) - (let ((line-pos (ly:grob-property grob 'line-positions '()))) + (if (ly:grob? staff) + (let ((line-pos (ly:grob-property staff 'line-positions '()))) (set! line-count (if (pair? line-pos) (length line-pos) - (ly:grob-property grob 'line-count 0))))) + (ly:grob-property staff 'line-count 0))))) line-count)) @@ -65,6 +107,7 @@ iv)) (define (staff-symbol-line-positions grob) + "Get or compute the @code{'line-positions} list from @var{grob}." (let ((line-pos (ly:grob-property grob 'line-positions '()))) (if (not (pair? line-pos)) @@ -76,9 +119,68 @@ (iota line-count))))) line-pos)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; internal helper functions + +(define annotation-char #\-) +(define replacement-char #\ ) + +(define dummy-extent (cons -1 1)) + + +(define (glyph->stencil glyph grob extent) + "Return a stencil computed by the procedure associated with +glyph @var{glyph}. The arguments @var{grob} and @var{extent} are +mandatory to the procedures stored in @code{bar-glyph-print-procedures}." + (let ((proc (assoc-get glyph bar-glyph-print-procedures)) + (stencil empty-stencil)) + + (if (procedure? proc) + (set! stencil (proc grob extent)) + (ly:warning (_ "Bar glyph ~a not known. Ignoring.") glyph)) + stencil)) + +(define (string->string-list str) + "Convert a string into a list of strings with length 1. +@code{"aBc"} will be converted to @code{("a" "B" "c")}. +An empty string will be converted to a list containing @code{""}." + (if (and (string? str) + (not (zero? (string-length str)))) + (map (lambda (s) + (string s)) + (string->list str)) + (list ""))) + +(define (strip-string-annotation str) + "Strip annotations starting with and including the +annotation char from string @var{str}." + (let ((pos (string-index str annotation-char))) + + (if pos + (substring str 0 pos) + str))) + +(define (check-for-annotation str) + "Check whether the annotation char is present in string @var{str}." + (if (string? str) + (if (string-index str annotation-char) + (ly:warning + (_ "Annotation '~a' is allowed in the first argument of a bar line definition only.") + str)))) + +(define (check-for-replacement str) + "Check whether the replacement char is present in string @var{str}." + (if (string? str) + (if (string-index str replacement-char) + (ly:warning + (_ "Replacement '~a' is allowed in the last argument of a bar line definition only.") + str)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; functions used by external routines (define-public (span-bar::notify-grobs-of-my-existence grob) + "Set the @code{'has-span-bar} property for all elements of Grob @var{grob}." (let* ((elts (ly:grob-array->list (ly:grob-object grob 'elements))) (sorted-elts (sort elts ly:grob-vertical (string-length glyph) 1)) + (ly:warning + (_ "add-bar-glyph-print-procedure: glyph '~a' has to be a single ASCII character.") + glyph) + (set! bar-glyph-print-procedures + (acons glyph proc bar-glyph-print-procedures)))) + +(define-session-public bar-glyph-print-procedures `()) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawing functions for various bar line types +;; to include them and other user-defined functions, +;; all of them have the form +;; (make-...-bar-line grob extent) +;; even if the extent is not used. (define (make-empty-bar-line grob extent) + "Draw an empty bar line." (ly:make-stencil "" (cons 0 0) extent)) -(define (make-simple-bar-line grob width extent rounded) - (let ((blot (if rounded - (layout-blot-diameter grob) - 0))) +(define (make-simple-bar-line grob extent) + "Draw a simple bar line." + (let* ((line-thickness (layout-line-thickness grob)) + (thickness (* (ly:grob-property grob 'hair-thickness 1) + line-thickness)) + (blot (calc-blot thickness extent grob)) + (extent (bar-line::widen-bar-extent-on-span grob extent))) + + (ly:round-filled-box (cons 0 thickness) + extent + blot))) - (ly:round-filled-box (cons 0 width) +(define (make-thick-bar-line grob extent) + "Draw a thick bar line." + (let* ((line-thickness (layout-line-thickness grob)) + (thickness (* (ly:grob-property grob 'thick-thickness 1) + line-thickness)) + (blot (calc-blot thickness extent grob)) + (extent (bar-line::widen-bar-extent-on-span grob extent))) + + (ly:round-filled-box (cons 0 thickness) extent blot))) -(define (make-tick-bar-line grob height rounded) - (let ((half-staff (* 1/2 (ly:staff-symbol-staff-space grob))) - (staff-line-thickness (ly:staff-symbol-line-thickness grob)) - (blot (if rounded - (layout-blot-diameter grob) - 0))) +(define (make-tick-bar-line grob extent) + "Draw a tick bar line." + (let* ((half-staff (* 1/2 (ly:staff-symbol-staff-space grob))) + (staff-line-thickness (ly:staff-symbol-line-thickness grob)) + (height (interval-end extent)) + (blot (calc-blot staff-line-thickness extent grob))) - (ly:round-filled-box (cons 0 staff-line-thickness) - (cons (- height half-staff) (+ height half-staff)) - blot))) + (ly:round-filled-box (cons 0 staff-line-thickness) + (cons (- height half-staff) (+ height half-staff)) + blot))) -(define (make-colon-bar-line grob) +(define (make-colon-bar-line grob extent) + "Draw repeat dots." (let* ((staff-space (ly:staff-symbol-staff-space grob)) (line-thickness (ly:staff-symbol-line-thickness grob)) (dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot")) @@ -244,7 +367,9 @@ (/ staff-space 2)) Y))) stencil))) + (define (make-dotted-bar-line grob extent) + "Draw a dotted bar line." (let* ((position (round (* (interval-end extent) 2))) (correction (if (even? position) 0.5 0.0)) (dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot")) @@ -268,11 +393,14 @@ (add-stencils! empty-stencil stil-list))) -(define (make-dashed-bar-line grob extent thickness) +(define (make-dashed-bar-line grob extent) + "Draw a dashed bar line." (let* ((height (interval-length extent)) (staff-symbol (get-staff-symbol grob)) (staff-space (ly:staff-symbol-staff-space grob)) (line-thickness (layout-line-thickness grob)) + (thickness (* (ly:grob-property grob 'hair-thickness 1) + line-thickness)) (dash-size (- 1.0 (ly:grob-property grob 'gap 0.3))) (line-count (staff-symbol-line-count staff-symbol))) @@ -303,94 +431,101 @@ stencil) (let* ((dashes (/ height staff-space)) (total-dash-size (/ height dashes)) - (factor (/ (- dash-size thickness) staff-space))) - - (ly:stencil-translate-axis - (ly:make-stencil (list 'dashed-line - thickness - (* factor total-dash-size) - (* (- 1 factor) total-dash-size) - 0 - height - (* factor total-dash-size 0.5)) - (cons 0 thickness) - (cons 0 height)) - (interval-start extent) - Y))))) - -(define (make-segno-bar-line grob glyph extent rounded) + (factor (/ (- dash-size thickness) staff-space)) + (stencil (ly:stencil-translate-axis + (ly:make-stencil (list 'dashed-line + thickness + (* factor total-dash-size) + (* (- 1 factor) total-dash-size) + 0 + height + (* factor total-dash-size 0.5)) + (cons (/ thickness -2) (/ thickness 2)) + (cons 0 height)) + (interval-start extent) + Y))) + + (ly:stencil-translate-axis stencil (/ thickness 2) X))))) + + +(define ((make-segno-bar-line show-segno) grob extent) + "Draw a segno bar line. If @var{show-segno} is set to @code{#t}, +the segno sign is drawn over the double bar line; otherwise, it +draws the span bar variant, i.e. without the segno sign." (let* ((line-thickness (layout-line-thickness grob)) - (kern (* (ly:grob-property grob 'kern 1) line-thickness)) (thinkern (* (ly:grob-property grob 'thin-kern 1) line-thickness)) - (hair (* (ly:grob-property grob 'hair-thickness 1) line-thickness)) - (fatline (* (ly:grob-property grob 'thick-thickness 1) line-thickness)) - (thin-stil (make-simple-bar-line grob hair extent rounded)) - (thick-stil (make-simple-bar-line grob fatline extent rounded)) - (colon-stil (make-colon-bar-line grob)) - (segno-stil (ly:stencil-add - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - '() X LEFT thin-stil thinkern) - X RIGHT thin-stil thinkern) - (ly:font-get-glyph (ly:grob-default-font grob) "scripts.varsegno"))) - (glyph (cond - ((string=? glyph "|S") "S") - ((string=? glyph "S|") "S") - (else glyph))) - (stencil (cond - ((or (string=? glyph "S|:") - (string=? glyph ".S|:")) - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X RIGHT thin-stil kern) - X RIGHT colon-stil kern) - X LEFT segno-stil thinkern)) - ((or (string=? glyph ":|S") - (string=? glyph ":|S.")) - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X LEFT colon-stil kern) - X RIGHT segno-stil thinkern)) - ((or (string=? glyph ":|S|:") - (string=? glyph ":|S.|:")) - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X LEFT colon-stil kern) - X RIGHT segno-stil thinkern) - X RIGHT thick-stil thinkern) - X RIGHT thin-stil kern) - X RIGHT colon-stil kern)) - ((string=? glyph "|._.|") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X RIGHT thick-stil (+ (interval-length - (ly:stencil-extent segno-stil X)) - (* 2 thinkern))) - X RIGHT thin-stil kern)) - (else segno-stil)))) + (thin-stil (make-simple-bar-line grob extent)) + (double-line-stil (ly:stencil-combine-at-edge + thin-stil + X + LEFT + thin-stil + thinkern)) + (segno (ly:font-get-glyph (ly:grob-default-font grob) + "scripts.varsegno")) + (stencil (ly:stencil-add + (if show-segno + segno + (ly:make-stencil + "" + (ly:stencil-extent segno X) + (cons 0 0))) + (ly:stencil-translate-axis + double-line-stil + (* 1/2 thinkern) + X)))) stencil)) -(define (make-kievan-bar-line grob) +(define (make-kievan-bar-line grob extent) + "Draw a kievan bar line." (let* ((font (ly:grob-default-font grob)) (stencil (stencil-whiteout (ly:font-get-glyph font "scripts.barline.kievan")))) - ;; the kievan bar line has mo staff lines underneath, - ;; so we whiteout them and move ithe grob to a higher layer + ;; the kievan bar line has no staff lines underneath, + ;; so we whiteout them and move the grob to a higher layer (ly:grob-set-property! grob 'layer 1) stencil)) +(define ((make-bracket-bar-line dir) grob extent) + "Draw a bracket-style bar line. If @var{dir} is set to @code{LEFT}, the +opening bracket will be drawn, for @code{RIGHT} we get the closing bracket." + (let* ((thick-stil (make-thick-bar-line grob extent)) + (brackettips-up (ly:font-get-glyph (ly:grob-default-font grob) + "brackettips.up")) + (brackettips-down (ly:font-get-glyph (ly:grob-default-font grob) + "brackettips.down")) + ;; the x-extent of the brackettips must not be taken into account + ;; for bar line constructs like "[|:", so we set new bounds: + (tip-up-stil (ly:make-stencil (ly:stencil-expr brackettips-up) + (cons 0 0) + (ly:stencil-extent brackettips-up Y))) + (tip-down-stil (ly:make-stencil (ly:stencil-expr brackettips-down) + (cons 0 0) + (ly:stencil-extent brackettips-down Y))) + (stencil (ly:stencil-add + thick-stil + (ly:stencil-translate-axis tip-up-stil + (interval-end extent) + Y) + (ly:stencil-translate-axis tip-down-stil + (interval-start extent) + Y)))) + + (if (eq? dir LEFT) + stencil + (ly:stencil-scale stencil -1 1)))) + +(define ((make-spacer-bar-line glyph) grob extent) + "Draw an invisible bar line which has the same dimensions as the one +drawn by the procedure associated with glyph @var{glyph}." + (let* ((stil (glyph->stencil glyph grob extent)) + (stil-x-extent (ly:stencil-extent stil X))) + + (ly:make-stencil "" stil-x-extent extent))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bar line callbacks (define-public (ly:bar-line::calc-bar-extent grob) @@ -398,37 +533,65 @@ (staff-extent (cons 0 0))) (if (ly:grob? staff-symbol) - (let* ((bar-line-color (ly:grob-property grob 'color)) - (staff-color (ly:grob-property staff-symbol 'color)) - (staff-line-thickness (ly:staff-symbol-line-thickness grob)) - (staff-space (ly:staff-symbol-staff-space grob))) - - (set! staff-extent (ly:staff-symbol::height staff-symbol)) - - (if (zero? staff-space) - (set! staff-space 1.0)) - - (if (< (interval-length staff-extent) staff-space) - ;; staff is too small (perhaps consists of a single line); - ;; extend the bar line to make it visible - (set! staff-extent - (interval-widen staff-extent staff-space)) - ;; Due to rounding problems, bar lines extending to the outermost edges - ;; of the staff lines appear wrongly in on-screen display - ;; (and, to a lesser extent, in print) - they stick out a pixel. - ;; The solution is to extend bar lines only to the middle - ;; of the staff line - unless they have different colors, - ;; when it would be undesirable. - ;; - ;; This reduction should not influence whether bar is to be - ;; expanded later, so length is not updated on purpose. - (if (eq? bar-line-color staff-color) - (set! staff-extent - (interval-widen staff-extent - (* -1/2 staff-line-thickness))))))) + (let ((bar-line-color (ly:grob-property grob 'color)) + (staff-color (ly:grob-property staff-symbol 'color)) + (half-staff-line-thickness (/ (ly:staff-symbol-line-thickness grob) 2)) + (staff-space (ly:staff-symbol-staff-space grob))) + + (set! staff-extent (ly:staff-symbol::height staff-symbol)) + + (if (zero? staff-space) + (set! staff-space 1.0)) + + (if (< (interval-length staff-extent) staff-space) + ;; staff is too small (perhaps consists of a single line); + ;; extend the bar line to make it visible + (set! staff-extent + (interval-widen staff-extent staff-space)) + ;; Due to rounding problems, bar lines extending to the outermost edges + ;; of the staff lines appear wrongly in on-screen display + ;; (and, to a lesser extent, in print) - they stick out a pixel. + ;; The solution is to extend bar lines only to the middle + ;; of the staff line - unless they have different colors, + ;; when it would be undesirable. + ;; + ;; This reduction should not influence whether the bar is to be + ;; expanded later, so length is not updated on purpose. + (if (eq? bar-line-color staff-color) + (set! staff-extent + (interval-widen staff-extent + (- half-staff-line-thickness))))))) staff-extent)) +;; this function may come in handy when defining new bar line glyphs, so +;; we make it public. +;; This code should not be included in ly:bar-line::calc-bar-extent, because +;; this may confuse the drawing functions for dashed and dotted bar lines. +(define-public (bar-line::widen-bar-extent-on-span grob extent) + "Widens the bar line @var{extent} towards span bars adjacent to grob @var{grob}." + (let ((staff-symbol (get-staff-symbol grob)) + (has-span-bar (ly:grob-property grob 'has-span-bar #f))) + + (if (and (ly:grob? staff-symbol) + (pair? has-span-bar)) + (let ((bar-line-color (ly:grob-property grob 'color)) + (staff-color (ly:grob-property staff-symbol 'color)) + (half-staff-line-thickness (/ (ly:staff-symbol-line-thickness grob) 2))) + (if (eq? bar-line-color staff-color) + ;; if the colors are equal, ly:bar-line::calc-bar-extent has + ;; shortened the bar line extent by a half-staff-line-thickness + ;; this is reverted on the interval bounds where span bars appear: + (begin + (and (ly:grob? (car has-span-bar)) + (set! extent (cons (- (car extent) half-staff-line-thickness) + (cdr extent)))) + (and (ly:grob? (cdr has-span-bar)) + (set! extent (cons (car extent) + (+ (cdr extent) half-staff-line-thickness)))))))) + extent)) + (define (bar-line::bar-y-extent grob refpoint) + "Compute the y-extent of the bar line relative to @var{refpoint}." (let* ((extent (ly:grob-property grob 'bar-extent '(0 . 0))) (rel-y (ly:grob-relative-coordinate grob refpoint Y)) (y-extent (coord-translate extent rel-y))) @@ -436,131 +599,105 @@ y-extent)) (define-public (ly:bar-line::print grob) - (let ((glyph (ly:grob-property grob 'glyph-name)) + "The print routine for bar lines." + (let ((glyph-name (ly:grob-property grob 'glyph-name)) (extent (ly:grob-property grob 'bar-extent '(0 . 0)))) - (if (and (not (eq? glyph '())) + (if (and glyph-name (> (interval-length extent) 0)) - (bar-line::compound-bar-line grob glyph extent #f) + (bar-line::compound-bar-line grob glyph-name extent) #f))) -(define-public (bar-line::compound-bar-line grob glyph extent rounded) +(define-public (bar-line::compound-bar-line grob bar-glyph extent) + "Build the bar line stencil." (let* ((line-thickness (layout-line-thickness grob)) - (height (interval-length extent)) (kern (* (ly:grob-property grob 'kern 1) line-thickness)) - (thinkern (* (ly:grob-property grob 'thin-kern 1) line-thickness)) - (hair (* (ly:grob-property grob 'hair-thickness 1) line-thickness)) - (fatline (* (ly:grob-property grob 'thick-thickness 1) line-thickness)) - (thin-stil (make-simple-bar-line grob hair extent rounded)) - (thick-stil (make-simple-bar-line grob fatline extent rounded)) - (colon-stil (make-colon-bar-line grob)) - (glyph (cond - ((not glyph) "") - ((string=? glyph "||:") "|:") - ;; bar-line::compound-bar-line is called only if - ;; height > 0, but just in case ... - ((and (string=? glyph ":|") - (zero? height)) "|.") - ((and (string=? glyph "|:") - (zero? height)) ".|") - (else glyph))) - (stencil (cond - ((string=? glyph "|") thin-stil) - ((string=? glyph ".") thick-stil) - ((string=? glyph "||") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - '() X LEFT thin-stil thinkern) - X RIGHT thin-stil thinkern)) - ((string=? glyph "|.") - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern)) - ((string=? glyph ".|") - (ly:stencil-combine-at-edge - thick-stil X RIGHT thin-stil kern)) - ((string=? glyph "|:") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X RIGHT thin-stil kern) - X RIGHT colon-stil kern)) - ((string=? glyph ":|") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X LEFT colon-stil kern)) - ((string=? glyph ":|:") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - '() X LEFT thick-stil thinkern) - X LEFT colon-stil kern) - X RIGHT thick-stil kern) - X RIGHT colon-stil kern)) - ((string=? glyph ":|.|:") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X LEFT colon-stil kern) - X RIGHT thin-stil kern) - X RIGHT colon-stil kern)) - ((string=? glyph ":|.:") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X LEFT colon-stil kern) - X RIGHT colon-stil kern)) - ((string=? glyph ".|.") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - '() X LEFT thick-stil thinkern) - X RIGHT thick-stil kern)) - ((string=? glyph "|.|") - (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge - thick-stil X LEFT thin-stil kern) - X RIGHT thin-stil kern)) - ((string=? glyph ":") - (make-dotted-bar-line grob extent)) - ((or (string=? glyph "|._.|") - (string-contains glyph "S")) - (make-segno-bar-line grob glyph extent rounded)) - ((string=? glyph "'") - (make-tick-bar-line grob (interval-end extent) rounded)) - ((string=? glyph "dashed") - (make-dashed-bar-line grob extent hair)) - ((string=? glyph "kievan") - (make-kievan-bar-line grob)) - (else (make-empty-bar-line grob extent))))) - stencil)) + (bar-glyph-list (string->string-list + (strip-string-annotation bar-glyph))) + (span-glyph (get-span-glyph bar-glyph)) + (span-glyph-list (string->string-list span-glyph)) + (neg-stencil empty-stencil) + (stencil empty-stencil) + (is-first-neg-stencil #t) + (is-first-stencil #t)) + + ;; We build up two separate stencils first: + ;; (1) the neg-stencil is built from all glyphs that have + ;; a replacement-char in the span bar + ;; (2) the main stencil is built from all remaining glyphs + ;; + ;; Afterwards the neg-stencil is attached left to the + ;; stencil; this ensures that the main stencil starts + ;; at x = 0. + ;; + ;; For both routines holds: + ;; we stack the stencils obtained by the corresponding + ;; single glyphs with spacing 'kern' except for the + ;; first stencil + ;; (Thanks to Harm who came up with this idea!) + (for-each (lambda (bar span) + (if (and (string=? span (string replacement-char)) + is-first-stencil) + (begin + (set! neg-stencil + (ly:stencil-combine-at-edge + neg-stencil + X + RIGHT + (glyph->stencil bar grob extent) + (if is-first-neg-stencil 0 kern))) + (set! is-first-neg-stencil #f)) + (begin + (set! stencil + (ly:stencil-combine-at-edge + stencil + X + RIGHT + (glyph->stencil bar grob extent) + (if is-first-stencil 0 kern))) + (set! is-first-stencil #f)))) + bar-glyph-list span-glyph-list) + ;; if we have a non-empty neg-stencil, + ;; we attach it to the left side of the stencil + (and (not is-first-neg-stencil) + (set! stencil + (ly:stencil-combine-at-edge + stencil + X + LEFT + neg-stencil + kern))) + stencil)) (define-public (ly:bar-line::calc-anchor grob) - (let* ((line-thickness (layout-line-thickness grob)) - (kern (* (ly:grob-property grob 'kern 1) line-thickness)) - (glyph (ly:grob-property grob 'glyph-name "")) + "Calculate the anchor position of a bar line. The anchor is used for +the correct placement of bar numbers etc." + (let* ((bar-glyph (ly:grob-property grob 'glyph-name "")) + (bar-glyph-list (string->string-list (strip-string-annotation bar-glyph))) + (span-glyph (assoc-get bar-glyph span-bar-glyph-alist bar-glyph)) (x-extent (ly:grob-extent grob grob X)) - (dot-width (+ (interval-length - (ly:stencil-extent - (ly:font-get-glyph - (ly:grob-default-font grob) - "dots.dot") - X)) - kern)) (anchor 0.0)) - (if (> (interval-length x-extent) 0) - (begin - (set! anchor (interval-center x-extent)) - (cond ((string=? glyph "|:") - (set! anchor (+ anchor (/ dot-width -2.0)))) - ((string=? glyph ":|") - (set! anchor (+ anchor (/ dot-width 2.0))))))) - anchor)) + (and (> (interval-length x-extent) 0) + (if (or (= (length bar-glyph-list) 1) + (string=? bar-glyph span-glyph) + (string=? span-glyph "")) + ;; We use the x-extent of the stencil if either + ;; - we have a single bar-glyph + ;; - bar-glyph and span-glyph are identical + ;; - we have no span-glyph + (set! anchor (interval-center x-extent)) + ;; If the conditions above do not hold,the anchor is the + ;; center of the corresponding span bar stencil extent + (set! anchor (interval-center + (ly:stencil-extent + (span-bar::compound-bar-line grob bar-glyph dummy-extent) + X))))) + anchor)) (define-public (bar-line::calc-glyph-name grob) + "Determine the @code{glyph-name} of the bar line depending on the +line break status." (let* ((glyph (ly:grob-property grob 'glyph)) (dir (ly:item-break-dir grob)) (result (assoc-get glyph bar-glyph-alist)) @@ -573,6 +710,7 @@ glyph-name)) (define-public (bar-line::calc-break-visibility grob) + "Calculate the visibility of a bar line at line breaks." (let* ((glyph (ly:grob-property grob 'glyph)) (result (assoc-get glyph bar-glyph-alist))) @@ -580,61 +718,97 @@ (vector (string? (car result)) #t (string? (cdr result))) all-invisible))) -;; which span bar belongs to a bar line? - -(define-public span-bar-glyph-alist - '(("|:" . ".|") - ("||:" . ".|") - (":|" . "|.") - (":|.:" . "|.") - (":|:" . ".|.") - (":|.|:" . "|.|") - (":|.|" . "|.") - ("S" . "||" ) - ("S|" . "||") - ("|S" . "||") - ("S|:" . ".|") - (".S|:" . ".|") - (":|S" . "|.") - (":|S." . "|.") - (":|S|:" . "|._.|") - (":|S.|:" . "|._.|") - ("kievan" . "") - ("'" . ""))) - +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; span bar callbacks (define-public (ly:span-bar::calc-glyph-name grob) + "Return the @code{'glyph-name} of the corresponding BarLine grob. +The corresponding SpanBar glyph is computed within +@code{span-bar::compound-bar-line}." (let* ((elts (ly:grob-object grob 'elements)) (pos (1- (ly:grob-array-length elts))) - (glyph '())) + (glyph-name '())) - (while (and (eq? glyph '()) + (while (and (eq? glyph-name '()) (> pos -1)) - (begin (set! glyph (ly:grob-property (ly:grob-array-ref elts pos) - 'glyph-name)) + (begin (set! glyph-name + (ly:grob-property (ly:grob-array-ref elts pos) + 'glyph-name)) (set! pos (1- pos)))) - (if (eq? glyph '()) + (if (eq? glyph-name '()) (begin (ly:grob-suicide! grob) - (set! glyph ""))) - (assoc-get glyph span-bar-glyph-alist glyph))) + (set! glyph-name ""))) + glyph-name)) (define-public (ly:span-bar::width grob) + "Compute the width of the SpanBar stencil." (let ((width (cons 0 0))) (if (grob::is-live? grob) - (let* ((glyph (ly:grob-property grob 'glyph-name)) - (stencil (bar-line::compound-bar-line grob glyph (cons -1 1) #f))) + (let* ((glyph-name (ly:grob-property grob 'glyph-name)) + (stencil (span-bar::compound-bar-line grob + glyph-name + dummy-extent))) (set! width (ly:stencil-extent stencil X)))) width)) (define-public (ly:span-bar::before-line-breaking grob) + "A dummy callback that kills the Grob @var{grob} if it contains +no elements." (let ((elts (ly:grob-object grob 'elements))) (if (zero? (ly:grob-array-length elts)) (ly:grob-suicide! grob)))) +(define-public (span-bar::compound-bar-line grob bar-glyph extent) + "Build the stencil of the span bar." + (let* ((line-thickness (layout-line-thickness grob)) + (kern (* (ly:grob-property grob 'kern 1) line-thickness)) + (bar-glyph-list (string->string-list + (strip-string-annotation bar-glyph))) + (span-glyph (assoc-get bar-glyph span-bar-glyph-alist 'undefined)) + (stencil empty-stencil)) + + (if (string? span-glyph) + (let ((span-glyph-list (string->string-list span-glyph)) + (is-first-stencil #t)) + + (for-each (lambda (bar span) + ;; the stencil stack routine is similar to the one + ;; used in bar-line::compound-bar-line, but here, + ;; leading replacement-chars are discarded. + (if (not (and (string=? span (string replacement-char)) + is-first-stencil)) + (begin + (set! stencil + (ly:stencil-combine-at-edge + stencil + X + RIGHT + ;; if the current glyph is the replacement-char, + ;; we take the corresponding glyph from the + ;; bar-glyph-list and insert an empty stencil + ;; with the appropriate width. + ;; (this method would fail if the bar-glyph-list + ;; were shorter than the span-glyph-list, + ;; but this makes hardly any sense from a + ;; typographical point of view + (if (string=? span (string replacement-char)) + ((make-spacer-bar-line bar) grob extent) + (glyph->stencil span grob extent)) + (if is-first-stencil 0 kern))) + (set! is-first-stencil #f)))) + bar-glyph-list span-glyph-list)) + ;; if span-glyph is not a string, it may be #f or 'undefined; + ;; the latter signals that the span bar for the current bar-glyph + ;; is undefined, so we raise a warning. + (if (eq? span-glyph 'undefined) + (ly:warning + (_ "No span bar glyph defined for bar glyph '~a'; ignoring.") + bar-glyph))) + stencil)) + ;; The method used in the following routine depends on bar_engraver ;; not being removed from staff context. If bar_engraver is removed, ;; the size of the staff lines is evaluated as 0, which results in a @@ -643,6 +817,7 @@ ;; This routine was originally by Juergen Reuter, but it was a on the ;; bulky side. Rewritten by Han-Wen. Ported from c++ to Scheme by Marc Hohl. (define-public (ly:span-bar::print grob) + "The print routine for span bars." (let* ((elts-array (ly:grob-object grob 'elements)) (refp (ly:grob-common-refpoint-of-array grob elts-array Y)) (elts (reverse (sort (ly:grob-array->list elts-array) @@ -650,69 +825,271 @@ ;; Elements must be ordered according to their y coordinates ;; relative to their common axis group parent. ;; Otherwise, the computation goes mad. - (glyph (ly:grob-property grob 'glyph-name)) + (bar-glyph (ly:grob-property grob 'glyph-name)) (span-bar empty-stencil)) - (if (string? glyph) - (let* ((extents '()) - (make-span-bars '()) - (model-bar #f)) - - ;; we compute the extents of each system and store them - ;; in a list; dito for the 'allow-span-bar property. - ;; model-bar takes the bar grob, if given. - (map (lambda (bar) - (let* ((ext (bar-line::bar-y-extent bar refp)) - (staff-symbol (ly:grob-object bar 'staff-symbol))) - - (if (ly:grob? staff-symbol) - (let ((refp-extent (ly:grob-extent staff-symbol refp Y))) - - (set! ext (interval-union ext refp-extent)) - - (if (> (interval-length ext) 0) + (if (string? bar-glyph) + (let ((extents '()) + (make-span-bars '()) + (model-bar #f)) + + ;; we compute the extents of each system and store them + ;; in a list; dito for the 'allow-span-bar property. + ;; model-bar takes the bar grob, if given. + (map (lambda (bar) + (let ((ext (bar-line::bar-y-extent bar refp)) + (staff-symbol (ly:grob-object bar 'staff-symbol))) + + (if (ly:grob? staff-symbol) + (let ((refp-extent (ly:grob-extent staff-symbol refp Y))) + + (set! ext (interval-union ext refp-extent)) + + (if (> (interval-length ext) 0) + (begin + (set! extents (append extents (list ext))) + (set! model-bar bar) + (set! make-span-bars + (append make-span-bars + (list (ly:grob-property + bar + 'allow-span-bar + #t)))))))))) + elts) + ;; if there is no bar grob, we use the callback argument + (if (not model-bar) + (set! model-bar grob)) + ;; we discard the first entry in make-span-bars, + ;; because its corresponding bar line is the + ;; uppermost and therefore not connected to + ;; another bar line + (if (pair? make-span-bars) + (set! make-span-bars (cdr make-span-bars))) + ;; the span bar reaches from the lower end of the upper staff + ;; to the upper end of the lower staff - when allow-span-bar is #t + (reduce (lambda (curr prev) + (let ((span-extent (cons 0 0)) + (allow-span-bar (car make-span-bars))) + + (set! make-span-bars (cdr make-span-bars)) + (if (> (interval-length prev) 0) (begin - (set! extents (append extents (list ext))) - (set! model-bar bar) - (set! make-span-bars - (append make-span-bars - (list (ly:grob-property bar 'allow-span-bar #t)))))))))) - elts) - ;; if there is no bar grob, we use the callback argument - (if (not model-bar) - (set! model-bar grob)) - ;; we discard the first entry in make-span-bars, because its corresponding - ;; bar line is the uppermost and therefore not connected to another bar line - (if (pair? make-span-bars) - (set! make-span-bars (cdr make-span-bars))) - ;; the span bar reaches from the lower end of the upper staff - ;; to the upper end of the lower staff - when allow-span-bar is #t - (reduce (lambda (curr prev) - (let ((l (cons 0 0)) - (allow-span-bar (car make-span-bars))) - - (set! make-span-bars (cdr make-span-bars)) - (if (> (interval-length prev) 0) - (begin - (set! l (cons (cdr prev) (car curr))) - (if (or (zero? (interval-length l)) - (not allow-span-bar)) - (begin - ;; there is overlap between the bar lines - ;; or 'allow-span-bar = #f. - ;; Do nothing. - ) + (set! span-extent (cons (cdr prev) + (car curr))) + ;; draw the span bar only when the staff lines + ;; don't overlap and allow-span-bar is #t: + (and (> (interval-length span-extent) 0) + allow-span-bar (set! span-bar - (ly:stencil-add span-bar - (bar-line::compound-bar-line - model-bar - glyph - l - #f)))))) - curr)) - "" extents) - (set! span-bar (ly:stencil-translate-axis - span-bar - (- (ly:grob-relative-coordinate grob refp Y)) - Y)))) + (ly:stencil-add + span-bar + (span-bar::compound-bar-line + model-bar + bar-glyph + span-extent)))))) + curr)) + "" extents) + (set! span-bar (ly:stencil-translate-axis + span-bar + (- (ly:grob-relative-coordinate grob refp Y)) + Y)))) span-bar)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; volta bracket functions + +(define-public (allow-volta-hook bar-glyph) + "Allow the volta bracket hook being drawn over bar line @var{bar-glyph}." + (if (string? bar-glyph) + (set! volta-bracket-allow-volta-hook-list + (append volta-bracket-allow-volta-hook-list + (list bar-glyph))) + (ly:warning (_ ("Volta hook bar line must be a string; ignoring '~a'.") + bar-glyph)))) + +(define-session-public volta-bracket-allow-volta-hook-list '()) + +(define-public (volta-bracket::calc-hook-visibility bar-glyph) + "Determine the visibility of the volta bracket hook. It is called in +@code{lily/volta-bracket.cc} and returns @code{#t} if @emph{no} hook +should be drawn." + (not (member bar-glyph volta-bracket-allow-volta-hook-list))) + +(define-public (ly:volta-bracket::calc-shorten-pair grob) + "Calculate the @code{shorten-pair} values for an ideal placement +of the volta brackets relative to the bar lines." + (let* ((line-thickness (layout-line-thickness grob)) + (volta-half-line-thickness (* (ly:grob-property grob 'thickness 1.6) + line-thickness + 1/2)) + (bar-array (ly:grob-object grob 'bars)) + (bar-array-length (ly:grob-array-length bar-array)) + ;; the bar-array starts with the uppermost bar line grob that is + ;; covered by the left edge of the volta bracket; more (span) + ;; bar line grobs from other staves may follow + (left-bar-line (if (> bar-array-length 0) + (ly:grob-array-ref bar-array 0) + '())) + ;; we need the vertical-axis-group-index of the left-bar-line + ;; to find the corresponding right-bar-line + (vag-index (if (null? left-bar-line) + -1 + (ly:grob-get-vertical-axis-group-index left-bar-line))) + ;; the bar line corresponding to the right edge of the volta bracket + ;; is the last entry with the same vag-index, so we transform the array to a list, + ;; reverse it and search for suitable entries: + (filtered-grobs (filter (lambda (e) + (eq? (ly:grob-get-vertical-axis-group-index e) + vag-index)) + (reverse (ly:grob-array->list bar-array)))) + ;; we need the first one (if any) + (right-bar-line (if (pair? filtered-grobs) + (car filtered-grobs) + '())) + ;; the left-bar-line may be a #', + ;; so we add "" as a fallback return value + (left-bar-glyph-name (if (null? left-bar-line) + (string annotation-char) + (ly:grob-property left-bar-line 'glyph-name ""))) + (right-bar-glyph-name (if (null? right-bar-line) + (string annotation-char) + (ly:grob-property right-bar-line 'glyph-name ""))) + (left-bar-broken (or (null? left-bar-line) + (not (zero? (ly:item-break-dir left-bar-line))))) + (right-bar-broken (or (null? right-bar-line) + (not (zero? (ly:item-break-dir right-bar-line))))) + (left-span-stencil-extent (ly:stencil-extent + (span-bar::compound-bar-line + left-bar-line + left-bar-glyph-name + dummy-extent) + X)) + (right-span-stencil-extent (ly:stencil-extent + (span-bar::compound-bar-line + right-bar-line + right-bar-glyph-name + dummy-extent) + X)) + (left-shorten 0.0) + (right-shorten 0.0)) + + ;; since "empty" intervals may look like (1.0 . -1.0), we use the + ;; min/max functions to make sure that the placement is not corrupted + ;; in case of empty bar lines + (set! left-shorten + (if left-bar-broken + (- (max 0 (interval-end left-span-stencil-extent)) + (max 0 (interval-end (ly:stencil-extent + (bar-line::compound-bar-line + left-bar-line + left-bar-glyph-name + dummy-extent) + X))) + volta-half-line-thickness) + (- (max 0 (interval-end left-span-stencil-extent)) + volta-half-line-thickness))) + + (set! right-shorten + (if right-bar-broken + (+ (- (max 0 (interval-end right-span-stencil-extent))) + volta-half-line-thickness) + (- (min 0 (interval-start right-span-stencil-extent)) + volta-half-line-thickness))) + + (cons left-shorten right-shorten))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; predefined bar glyph print procedures + +(add-bar-glyph-print-procedure "" make-empty-bar-line) +(add-bar-glyph-print-procedure "|" make-simple-bar-line) +(add-bar-glyph-print-procedure "." make-thick-bar-line) +(add-bar-glyph-print-procedure "!" make-dashed-bar-line) +(add-bar-glyph-print-procedure "'" make-tick-bar-line) +(add-bar-glyph-print-procedure ":" make-colon-bar-line) +(add-bar-glyph-print-procedure ";" make-dotted-bar-line) +(add-bar-glyph-print-procedure "k" make-kievan-bar-line) +(add-bar-glyph-print-procedure "S" (make-segno-bar-line #t)) +(add-bar-glyph-print-procedure "=" (make-segno-bar-line #f)) +(add-bar-glyph-print-procedure "[" (make-bracket-bar-line LEFT)) +(add-bar-glyph-print-procedure "]" (make-bracket-bar-line RIGHT)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; predefined bar lines +;; +;; definition of bar lines goes as follows: +;; +;; (define-bar-line "normal bar[-annotation]" "end of line" "start of line" "span bar") +;; +;; each entry has to be a string or #f. +;; The empty string "" is allowed and yields in an invisible bar line, +;; whereas #f reads 'no stencil'. +;; +;; Convention: if two bar lines would be identical in their +;; unbroken bar glyph, we use annotations to make them distinct; +;; as a general rule of thumb the main difference in their +;; behavior at the end of a line is used as annotation, cf. +;; +;; (define-bar-line ".|:" "|" ".|:" ".|") +;; (define-bar-line ".|:-||" "||" ".|:" ".|") +;; +;; or +;; +;; (define-bar-line "S-|" "|" "S" "=") +;; (define-bar-line "S-S" "S" "" "=") + +;; common bar lines +(define-bar-line "" "" "" #f) +(define-bar-line "-" #f #f #f) +(define-bar-line "|" "|" #f "|") +(define-bar-line "|-s" #f "|" "|") +(define-bar-line "." "." #f ".") +(define-bar-line ".|" "|" ".|" ".|") +(define-bar-line "|." "|." #f "|.") +(define-bar-line "||" "||" #f "||") +(define-bar-line ".." ".." #f "..") +(define-bar-line "|.|" "|.|" #f "|.|") +(define-bar-line "!" "!" #f "!") +(define-bar-line ";" ";" #f ";") +(define-bar-line "'" "'" #f #f) + +;; repeats +(define-bar-line ":|.:" ":|." ".|:" " |.") +(define-bar-line ":..:" ":|." ".|:" " ..") +(define-bar-line ":|.|:" ":|." ".|:" " |.|") +(define-bar-line ":.|.:" ":|." ".|:" " .|.") +(define-bar-line ":|." ":|." #f " |.") +(define-bar-line ".|:" "|" ".|:" ".|") +(define-bar-line "[|:" "|" "[|:" " |") +(define-bar-line ":|]" ":|]" #f " |") +(define-bar-line ":|][|:" ":|]" "[|:" " | |") +(define-bar-line ".|:-||" "||" ".|:" ".|") + +;; segno bar lines +(define-bar-line "S" "||" "S" "=") +(define-bar-line "S-|" "|" "S" "=") +(define-bar-line "S-S" "S" #f "=") +(define-bar-line ":|.S" ":|." "S" " |.") +(define-bar-line ":|.S-S" ":|.S" "" " |.") +(define-bar-line "S.|:" "|" "S.|:" " .|") +(define-bar-line "S.|:-S" "S" ".|:" " .|") +(define-bar-line ":|.S.|:" ":|." "S.|:" " |. .|") +(define-bar-line ":|.S.|:-S" ":|.S" ".|:" " |. .|") + +;; ancient bar lines +(define-bar-line "k" "k" #f #f) ;; kievan style + +;; volta hook settings +(allow-volta-hook ":|.") +(allow-volta-hook ".|:") +(allow-volta-hook "|.") +(allow-volta-hook ":..:") +(allow-volta-hook ":|.|:") +(allow-volta-hook ":|.:") +(allow-volta-hook ".|") +(allow-volta-hook ":|.S") +(allow-volta-hook ":|.S-S") +(allow-volta-hook ":|.S.|:") +(allow-volta-hook ":|.S.|:-S") +(allow-volta-hook ":|]") +(allow-volta-hook ":|][|:") diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 16a1b21b1e..c1c006cf06 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -213,7 +213,7 @@ This variable is read by @rinternals{Timing_translator} at frets for tablatures and fretboards if no strings are provided in the notes for the current moment.") (doubleRepeatSegnoType ,string? "Set the default bar line for -the combinations double repeat with segno. Default is @samp{:|S|:}.") +the combinations double repeat with segno. Default is @samp{:|.S.|:}.") (doubleRepeatType ,string? "Set the default bar line for double repeats.") (doubleSlurs ,boolean? "If set, two slurs are created for every @@ -231,7 +231,7 @@ the symbol @samp{hihat}) as keys, and a list values.") (endRepeatSegnoType ,string? "Set the default bar line for the -combinations ending of repeat with segno. Default is @samp{:|S}.") +combinations ending of repeat with segno. Default is @samp{:|.S}.") (endRepeatType ,string? "Set the default bar line for the ending of repeats.") (explicitClefVisibility ,vector? "@samp{break-visibility} @@ -485,7 +485,7 @@ part-combining.") (stanza ,markup? "Stanza @q{number} to print before the start of a verse. Use in @code{Lyrics} context.") (startRepeatSegnoType ,string? "Set the default bar line for the -combinations beginning of repeat with segno. Default is @samp{.S|:}.") +combinations beginning of repeat with segno. Default is @samp{S.|:}.") (startRepeatType ,string? "Set the default bar line for the beginning of repeats.") (stemLeftBeamCount ,integer? "Specify the number of beams to draw diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index eb76e96e0b..bb6197463b 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -41,44 +41,13 @@ note)." "Print a special bar symbol. It replaces the regular bar symbol with a special symbol. The argument @var{bartype} 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}, @code{'} and @code{S}. - -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, a tick as bar line and a segno bar. - -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. - -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. - -@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. - -If @var{bartype} is set to @code{empty} then nothing is -printed, but a line break is allowed at that spot. + +The list of allowed glyphs and predefined bar lines can be +found in @file{scm/bar-line.scm}. @code{gap} is used for the gaps in dashed bar lines." '(allow-span-bar bar-extent gap glyph glyph-name has-span-bar - hair-thickness kern thin-kern thick-thickness)) + hair-thickness kern rounded thin-kern thick-thickness)) (ly:add-interface 'bass-figure-interface diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 39dba17c1f..f8c5b29ba8 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -429,8 +429,15 @@ read from the NonMusicalPaperColumn that begins the measure.") by glissandi?") (glyph ,string? "A string determining what @q{style} of glyph is typeset. Valid choices depend on the function that is reading this -property.") - (glyph-name ,string? "The glyph name within the font.") +property. + +In combination with (span) bar lines, it is a string resembling the +bar line appearance in ASCII form.") + (glyph-name ,string? "The glyph name within the font. + +In the context of (span) bar lines, @var{glyph-name} represents +a processed form of @code{glyph}, where decisions about line breaking +etc. are already taken.") (glyph-name-alist ,list? "An alist of key-string pairs.") (graphical ,boolean? "Display in graphical (vs. text) form.") (grow-direction ,ly:dir? "Crescendo or decrescendo?") @@ -745,6 +752,7 @@ of an object (e.g., between note and its accidentals).") (rotation ,list? "Number of degrees to rotate this object, and what point to rotate around. For example, @code{'(45 0 0)} rotates by 45 degrees around the center of this object.") + (rounded ,boolean? "Decide whether lines should be drawn rounded or not.") (round-up-to-longer-rest ,boolean? "Displays the longer multi-measure rest when the length of a measure is between two values of @code{usable-duration-logs}. For example, displays a breve instead of a whole diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index b66bca7550..28bc6d04d4 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -218,6 +218,7 @@ (layer . 0) (non-musical . #t) + (rounded . #f) (space-alist . ( (time-signature . (extra-space . 0.75)) (custos . (minimum-space . 2.0)) @@ -1901,16 +1902,6 @@ (break-align-symbol . staff-bar) (cross-staff . #t) (glyph-name . ,ly:span-bar::calc-glyph-name) - - ;; ugh duplication! (these 4 properties were copied from Barline) - ;; - ;; Ross. page 151 lists other values, we opt for a leaner look - ;; - (kern . 3.0) - (thin-kern . 3.0) - (hair-thickness . 1.6) - (thick-thickness . 6.0) - (layer . 0) (non-musical . #t) (stencil . ,ly:span-bar::print) @@ -2609,6 +2600,7 @@ (edge-height . (2.0 . 2.0)) ;; staff-space; (font-encoding . fetaText) (font-size . -4) + (shorten-pair . ,ly:volta-bracket::calc-shorten-pair) (stencil . ,ly:volta-bracket-interface::print) (thickness . 1.6) ;; line-thickness (word-space . 0.6) diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index 15161032f2..77d47d7dcd 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -233,7 +233,7 @@ def dump_default_bar (outf): Nowadays abc2ly outputs explicits barlines (?) """ ## < 2.2 - outf.write ("\n\\set Score.defaultBarType = \"empty\"\n") + outf.write ("\n\\set Score.defaultBarType = \"\"\n") def dump_slyrics (outf): @@ -1124,12 +1124,12 @@ old_bar_dict = { '|]' : '|.', '||' : '||', '[|' : '||', -':|' : ':|', +':|' : ':|.', '|:' : '|:', -'::' : ':|:', +'::' : ':|.|:', '|1' : '|', '|2' : '|', -':|2' : ':|', +':|2' : ':|.', '|' : '|' } bar_dict = { diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index 0e7fb9c83e..bb61108383 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -576,7 +576,7 @@ class Staff: last_time = g.timesig if 'start' in g.repeats: - e = e + ' \\bar "|:" ' + e = e + ' \\bar ".|:" ' # we don't attempt voltas since they fail easily. @@ -608,7 +608,7 @@ class Staff: if g: gap = rat_add (gap, g.length ()) if 'stop' in g.repeats: - k = k + ' \\bar ":|" ' + k = k + ' \\bar ":|." ' k = '%sglobal = { %s }\n\n ' % (self.staffid (), k) return k -- 2.39.2