From: John Mandereau Date: Sun, 17 Feb 2008 17:17:20 +0000 (+0100) Subject: Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond X-Git-Tag: release/2.11.40-1~3^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3beeccec13bea6cb1ce4031c9ec52d983066e18f;hp=ff54e5ab51c44527b116c21eedc6c25d6e15b09c;p=lilypond.git Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond * 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond: LSR: Incipit example. Scheme markups: raise an error when an unknown #:command is found, to Update from Valentin. Fix possibly broken url. LSR update. --- diff --git a/Documentation/user/text.itely b/Documentation/user/text.itely index 94e53f4e6f..27e0a85816 100644 --- a/Documentation/user/text.itely +++ b/Documentation/user/text.itely @@ -16,10 +16,10 @@ This section explains how to include text (with various formatting) in your scores. @cindex Text, other languages -To write accented and special text (such as characters from other -languages), simply insert the characters directly into the -lilypond file. The file must be saved as UTF-8. For more -information, see @ref{Text encoding}. +@warning{To write accented and special text (such as characters +from other languages), simply insert the characters directly into +the lilypond file. The file must be saved as UTF-8. For more +information, see @ref{Text encoding}.} @menu * Writing text:: @@ -94,29 +94,17 @@ Snippets: @lsrdir{Text,Text} @cindex non-empty texts It is possible to place arbitrary strings of text or @ref{Text -markup}, above or below notes by using a string @code{c^"text"}. -By default, these indications do not influence the note spacing, -but by using the command @code{\textLengthOn}, the widths will be taken -into account +markup} with @var{note}@code{-"}@var{text}@code{"}. -@lilypond[quote,fragment,ragged-right,verbatim,relative=1] -c4^"longtext" \textLengthOn c4_"longlongtext" c4 -@end lilypond - -@noindent -To prevent text from influencing spacing, use @code{\textLengthOff}. +INSERT EXAMPLE More complex formatting may also be added to a note by using the -markup command, +@code{\markup} command, as described in @ref{Text markup}. @lilypond[fragment,ragged-right,verbatim,quote] c'4^\markup { bla \bold bla } @end lilypond -The @code{\markup} is described in more detail in @ref{Text -markup}. - - @refcommands @funindex \textLengthOn @@ -126,7 +114,21 @@ markup}. @commonprop +@c TODO: put this in the LSR. -vv +By default, these indications do not influence the note spacing. +However, by using the command @code{\textLengthOn}, the widths +will be taken into account: +@lilypond[quote,fragment,ragged-right,verbatim,relative=1] +c4^"this does not affect spacing" \textLengthOn c4_"whereas this does" c4 +@end lilypond + +@noindent +After having used such a command, to go back to the default behavior +and prevent text from influencing spacing, use @code{\textLengthOff}. + + +@c TODO: LSR-ize this as well -vv Checking to make sure that text scripts and lyrics are within the margins is a relatively large computational task. To speed up processing, lilypond does not perform such calculations by @@ -151,14 +153,24 @@ Internals Reference: @internalsref{TextScript}. @cindex Text spanners +@c TODO: merge these explanations with the ones below in +@c "Text and Line spanners" -vv + Some performance indications, e.g., @i{rallentando} or @i{accelerando}, are written as text and are extended over many measures with dotted lines. Such texts are created using text spanners; attach @code{\startTextSpan} and @code{\stopTextSpan} to the first and last notes of the spanner. +@lilypond[verbatim,quote,ragged-right,fragment,relative=2] +c1 +\override TextSpanner #'bound-details #'left #'text = "faster" +c2\startTextSpan b c\stopTextSpan a +@end lilypond + +@noindent The string to be printed, as well as the style, is set through -object properties +object properties. It can accept @code{\markup} blocks as well: @lilypond[quote,ragged-right,fragment,relative=1,verbatim] c1 @@ -209,9 +221,16 @@ Internals Reference: @internalsref{TextSpanner}. @funindex \mark The @code{\mark} command is primarily used for @ref{Rehearsal -marks}, but it can also be used to put signs like coda, segno, and -fermata on a bar line. Use @code{\markup} to access the -appropriate symbol (symbols are listed in @ref{The Feta font}). +marks}, but it can also be used to add text elements in a score: + +@lilypond[verbatim,quote,ragged-right,fragment,relative=2] +c4\mark "text" c c c +@end lilypond + +As it can contain a @code{\markup} object, the @code{\mark} command +makes possible to put any text, but also signs like coda, segno, or +fermata on a bar line. The appropriate symbol has to be specified in +the @code{\markup} block; these symbols are listed in @ref{The Feta font}. @lilypond[fragment,quote,ragged-right,verbatim,relative=2] c1 \mark \markup { \musicglyph #"scripts.ufermata" } @@ -219,7 +238,7 @@ c1 @end lilypond @noindent -@code{\mark} is only typeset above the top stave of the score. If +@code{\mark} is only typeset above the top staff of the score. If you specify the @code{\mark} command at a bar line, the resulting mark is placed above the bar line. If you specify it in the middle of a bar, the resulting mark is positioned between notes. @@ -230,12 +249,15 @@ of the next line. @c IMO this is a bug; hopefully it'll be fixed soon, so I can @c delete this sentence. -gp +@noindent If there is no next line, then the mark will not be printed at all. @commonprop +@c TODO: to be LSR-ized stuff -vv + To print the mark at the end of the current line, use @example @@ -344,7 +366,9 @@ Snippets: @lsrdir{Text,Text} Internals Reference: @internalsref{RehearsalMark}. - +@c TODO: add this here? -vv +@c @node Text marks +@c @subsubsection Text marks @node Text markup @subsection Text markup @@ -699,7 +723,8 @@ Snippets: @lsrdir{Text,Text} @node Special text concerns @subsection Special text concerns - +@c FIXME: this section is to be removed +@c (see comments below) -vv @menu * New dynamic marks:: @@ -709,6 +734,9 @@ Snippets: @lsrdir{Text,Text} @node New dynamic marks @subsubsection New dynamic marks +@c FIXME: this whole section should be removed and put in +@c "Writing text" -vv + It is possible to print new dynamic marks or text that should be aligned with dynamics. Use @code{make-dynamic-script} to create these marks. Note that the dynamic font only contains the @@ -750,6 +778,11 @@ Snippets: @lsrdir{Text,Text} @node Text and line spanners @subsubsection Text and line spanners +@c FIXME: this whole section has to be removed. +@c glissando stuff should go into Expressive marks; +@c Text spanners should go into... Text spanners. +@c (I'm on it) --vv + Some performance indications, e.g., @i{rallentando} and @i{accelerando} and @i{trills} are written as text and are extended over many measures with lines, sometimes dotted or wavy. diff --git a/Documentation/user/working.itely b/Documentation/user/working.itely index 94d43b171d..4f8820da01 100644 --- a/Documentation/user/working.itely +++ b/Documentation/user/working.itely @@ -647,8 +647,8 @@ examples are used for @itemize @item Bug reports @item Sending a help request to mailists -@item Adding an example to the @uref{http://lsr@/.dsi@/.unimi@/.it/,LilyPond -Snippet Repository} +@item Adding an example to the @uref{http://lsr.dsi.unimi.it/, +LilyPond Snippet Repository} @end itemize To construct an example which is as small as possible, the rule is diff --git a/input/lsr/spacing.snippet-list b/input/lsr/spacing.snippet-list index d9f5825d2e..1762bd4f7b 100644 --- a/input/lsr/spacing.snippet-list +++ b/input/lsr/spacing.snippet-list @@ -1,5 +1,6 @@ -alignment-vertical-spacing.ly vertically-aligning-ossias-and-lyrics.ly +adjusting-lyrics-vertical-spacing.ly +alignment-vertical-spacing.ly page-label.ly +vertically-centered-dynamics-and-textscripts.ly proportional-strict-notespacing.ly -adjusting-lyrics-vertical-spacing.ly diff --git a/input/lsr/tweaks-and-overrides.snippet-list b/input/lsr/tweaks-and-overrides.snippet-list index eb85822dca..f1322ee7d8 100644 --- a/input/lsr/tweaks-and-overrides.snippet-list +++ b/input/lsr/tweaks-and-overrides.snippet-list @@ -1,8 +1,8 @@ altering-the-number-of-stems-in-a-beam.ly time-signature-in-parentheses.ly -changing-the-default-text-font-family.ly +vertically-centered-dynamics-and-textscripts.ly proportional-strict-notespacing.ly -making-an-object-invisible-with-the-transparent-property.ly +changing-the-default-text-font-family.ly transcription-of-ancient-music-with-incipit.ly alignment-vertical-spacing.ly manually-controlling-beam-positions.ly @@ -10,6 +10,7 @@ custodes.ly drawing-boxes-around-grobs.ly move-specific-text.ly drawing-circles-around-various-objects.ly +making-an-object-invisible-with-the-transparent-property.ly rest-styles.ly creating-text-spanners.ly using-the--tweak-command-to-tweak-individual-grobs.ly diff --git a/input/lsr/vertically-centered-dynamics-and-textscripts.ly b/input/lsr/vertically-centered-dynamics-and-textscripts.ly new file mode 100644 index 0000000000..5d183b4fd2 --- /dev/null +++ b/input/lsr/vertically-centered-dynamics-and-textscripts.ly @@ -0,0 +1,38 @@ +%% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it +%% This file is in the public domain. +\version "2.11.38" + +\header { + lsrtags = "tweaks-and-overrides, spacing" + texidoc = " +By setting the Y-extent property to a fixed value (here -1.5 . 1.5), we +force LilyPond to align every elements of the DynamicLineSpanner (text +elements and dynamics) to a common reference point, regardless to the +actual extent of these objects. This way, every element will be +vertically centered, for a nicer output (you can compare the first and +the second line in this example; the trick is only applied on the +second line). + +The same idea is used to align the text scripts along their baseline. +" } +% begin verbatim +\paper { indent = 0 line-width = 5\in } + +music = \relative c'' +{ + c2\p^\markup { "gorgeous" } c\f^\markup { "fantastic" } + c4\p c \f \> c c \! \p +} + +\score +{ + { + \music \break + + \override DynamicLineSpanner #'staff-padding = #2.0 + \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5) + \override TextScript #'Y-extent = #'(-1.5 . 1.5) + \music + } +} + diff --git a/input/new/incipit.ly b/input/new/incipit.ly new file mode 100644 index 0000000000..6710d998c8 --- /dev/null +++ b/input/new/incipit.ly @@ -0,0 +1,262 @@ +\version "2.11.39" +\header { + doctitle = "Incipit" + lsrtags = "staff-notation,Ancient notation" + texidoc = "Incipits can be added using the instrument name grob, but +keeping separate the instrument name definition and the incipit definition." +} + +incipit = +#(define-music-function (parser location incipit-music) (ly:music?) + #{ + \once \override Staff.InstrumentName #'self-alignment-X = #RIGHT + \once \override Staff.InstrumentName #'self-alignment-Y = #UP + \once \override Staff.InstrumentName #'Y-offset = #4 + \once \override Staff.InstrumentName #'padding = #0.3 + \once \override Staff.InstrumentName #'stencil = + #(lambda (grob) + (let* ((instrument-name (ly:grob-property grob 'long-text)) + (layout (ly:output-def-clone (ly:grob-layout grob))) + (music (make-music 'SequentialMusic + 'elements (list (make-music 'ContextSpeccedMusic + 'context-type 'MensuralStaff + 'element (make-music 'PropertySet + 'symbol 'instrumentName + 'value instrument-name)) + $incipit-music))) + (score (ly:make-score music)) + (mm (ly:output-def-lookup layout 'mm)) + (indent (ly:output-def-lookup layout 'indent)) + (width (ly:output-def-lookup layout 'incipit-width)) + (incipit-width (if (number? width) + (* width mm) + (* indent 0.5)))) + (ly:output-def-set-variable! layout 'indent (- indent incipit-width)) + (ly:output-def-set-variable! layout 'line-width indent) + (ly:output-def-set-variable! layout 'ragged-right #f) + (ly:output-def-set-variable! layout 'ragged-last #f) + (ly:output-def-set-variable! layout 'system-count 1) + (ly:score-add-output-def! score layout) + (set! (ly:grob-property grob 'long-text) + (markup #:score score)) + (ly:system-start-text::print grob))) + #}) + +%%%%%%%%%%%%%%%%%%%%%%%%% + +global = { + \set Score.skipBars = ##t + \key g \major + \time 4/4 + + %make the staff lines invisible on staves + \override Staff.BarLine #'transparent = ##t + \skip 1*8 % the actual music + + % let finis bar go through all staves + \override Staff.BarLine #'transparent = ##f + + % finis bar + \bar "|." +} + +discantusIncipit = << + \new MensuralVoice = discantusIncipit << + \repeat unfold 9 { s1 \noBreak } + { + \clef "neomensural-c1" + \key f \major + \time 2/2 + c''1. + } + >> + \new Lyrics \lyricsto discantusIncipit { IV- } +>> + +discantusNotes = { + \transpose c' c'' { + \clef "treble" + d'2. d'4 | + b e' d'2 | + c'4 e'4.( d'8 c' b | + a4) b a2 | + b4.( c'8 d'4) c'4 | + \once \override NoteHead #'transparent = ##t c'1 | + b\breve | + } +} + +discantusLyrics = \lyricmode { + Ju -- bi -- | + la -- te De -- | + o, om -- + nis ter -- | + ra, __ om- | + "..." | + -us. | +} + +altusIncipit = << + \new MensuralVoice = altusIncipit << + \repeat unfold 9 { s1 \noBreak } + { + \clef "neomensural-c3" + \key f \major + \time 2/2 + r1 f'1. + } + >> + \new Lyrics \lyricsto altusIncipit { IV- } +>> + +altusNotes = { + \transpose c' c'' { + \clef "treble" + r2 g2. e4 fis g | % two bars + a2 g4 e | + fis g4.( fis16 e fis4) | + g1 | + \once \override NoteHead #'transparent = ##t g1 | + g\breve | + } +} + +altusLyrics = \lyricmode { + Ju -- bi -- la -- te | % two bars + De -- o, om -- | + nis ter -- ra, | + "..." | + -us. | +} + +tenorIncipit = << + \new MensuralVoice = tenorIncipit << + \repeat unfold 9 { s1 \noBreak } + { + \clef "neomensural-c4" + \key f \major + \time 2/2 + r\longa + r\breve + r1 c'1. + } + >> + \new Lyrics \lyricsto tenorIncipit { IV- } +>> + +tenorNotes = { + \transpose c' c' { + \once \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 3) + \clef "treble_8" + R1 | + R1 | + R1 | + r2 d'2. d'4 b e' | % two bars + \once \override NoteHead #'transparent = ##t e'1 | + d'\breve | + } +} + +tenorLyrics = \lyricmode { + Ju -- bi -- la -- te | % two bars + "..." | + -us. +} + +bassusIncipit = << + \new MensuralVoice = bassusIncipit << + \repeat unfold 9 { s1 \noBreak } + { + \clef "bass" + \key f \major + \time 2/2 + %% incipit + r\maxima + f1. + } + >> + \new Lyrics \lyricsto bassusIncipit { IV- } +>> + +bassusNotes = { + \transpose c' c' { + \clef "bass" + R1 | + R1 | + R1 | + R1 | + g2. e4 | + \once \override NoteHead #'transparent = ##t e1 | + g\breve | + } +} + +bassusLyrics = \lyricmode { + Ju -- bi- | + "..." | + -us. +} + +\score { + << + \new StaffGroup = choirStaff << + \new Voice = "discantusNotes" << + \global + \set Staff.instrumentName = "Discantus" + \incipit \discantusIncipit + \discantusNotes + >> + \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics } + \new Voice = "altusNotes" << + \global + \set Staff.instrumentName = "Altus" + \incipit \altusIncipit + \altusNotes + >> + \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics } + \new Voice = "tenorNotes" << + \global + \set Staff.instrumentName = "Tenor" + \incipit \tenorIncipit + \tenorNotes + >> + \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics } + \new Voice = "bassusNotes" << + \set Staff.instrumentName = "Bassus" + \incipit \bassusIncipit + \bassusNotes + >> + >> + \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics } + %% Keep the bass lyrics outside of the staff group to avoid bar lines + %% between the lyrics. + >> + \layout { + \context { + \Score + %% no bars in staves + \override BarLine #'transparent = ##t + } + %% the next three instructions keep the lyrics between the barlines + \context { + \Lyrics + \consists "Bar_engraver" + \override BarLine #'transparent = ##t + } + \context { \StaffGroup \consists "Separating_line_group_engraver" } + \context { + \Voice + %% no slurs + \override Slur #'transparent = ##t + %% Comment in the below "\remove" command to allow line + %% breaking also at those barlines where a note overlaps + %% into the next bar. The command is commented out in this + %% short example score, but especially for large scores, you + %% will typically yield better line breaking and thus improve + %% overall spacing if you comment in the following command. + %%\remove "Forbid_line_break_engraver" + } + indent=6\cm + incipit-width = 4\cm + } +} \ No newline at end of file diff --git a/input/regression/incipit.ly b/input/regression/incipit.ly index bbcc17b3e7..d0073bd31e 100644 --- a/input/regression/incipit.ly +++ b/input/regression/incipit.ly @@ -37,7 +37,7 @@ (* incipit-width mm) (* indent 0.5)))) (ly:output-def-set-variable! layout 'indent (- indent scaled-incipit-width)) - (ly:output-def-set-variable! layout 'line-width scaled-incipit-width) + (ly:output-def-set-variable! layout 'line-width indent) (ly:output-def-set-variable! layout 'ragged-right #f) (ly:score-add-output-def! score layout) (set! (ly:grob-property grob 'long-text) diff --git a/scm/markup.scm b/scm/markup.scm index c47cb4a6c3..5daba8d932 100644 --- a/scm/markup.scm +++ b/scm/markup.scm @@ -189,24 +189,26 @@ Use `markup*' in a \\notemode context." (cond ((and (pair? expr) (keyword? (car expr))) ;; expr === (#:COMMAND arg1 ...) - (let* ((command (symbol->string (keyword->symbol (car expr)))) - (sig (markup-command-signature - (car (lookup-markup-command command)))) - (sig-len (length sig))) - (do ((i 0 (1+ i)) - (args '() args) - (rest (cdr expr) rest)) - ((>= i sig-len) - (values (cons (keyword->make-markup (car expr)) (reverse args)) rest)) - (cond ((eqv? (list-ref sig i) markup-list?) - ;; (car rest) is a markup list - (set! args (cons `(list ,@(compile-all-markup-expressions (car rest))) args)) - (set! rest (cdr rest))) - (else - ;; pick up one arg in `rest' - (receive (a r) (compile-markup-arg rest) - (set! args (cons a args)) - (set! rest r))))))) + (let ((command (symbol->string (keyword->symbol (car expr))))) + (if (not (pair? (lookup-markup-command command))) + (ly:error (_ "Not a markup command: ~A") command)) + (let* ((sig (markup-command-signature + (car (lookup-markup-command command)))) + (sig-len (length sig))) + (do ((i 0 (1+ i)) + (args '() args) + (rest (cdr expr) rest)) + ((>= i sig-len) + (values (cons (keyword->make-markup (car expr)) (reverse args)) rest)) + (cond ((eqv? (list-ref sig i) markup-list?) + ;; (car rest) is a markup list + (set! args (cons `(list ,@(compile-all-markup-expressions (car rest))) args)) + (set! rest (cdr rest))) + (else + ;; pick up one arg in `rest' + (receive (a r) (compile-markup-arg rest) + (set! args (cons a args)) + (set! rest r)))))))) ((and (pair? expr) (pair? (car expr)) (keyword? (caar expr)))