lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing text on the staff & using numbers in music functions


From: Thomas Morley
Subject: Re: writing text on the staff & using numbers in music functions
Date: Thu, 31 Mar 2016 11:42:18 +0200

2016-03-31 6:26 GMT+02:00 Flaming Hakama by Elaine <address@hidden>:
> \version "2.19.15"
>
> %{
> I first tried adding parenthesis as text to the multi-measure rest, as
> described in
> http://www.lilypond.org/doc/v2.18/Documentation/snippets/text#text-multi_002dmeasure-rest-markup
> since it claims to center text.  Which it does:
>
> %}
>
> #(define (white-under grob) (grob-interpret-markup grob
>   (markup #:vcenter #:whiteout #:pad-x 1 (ly:grob-property grob 'text))))
>
> setInlineMMRN = {
> \set Score.skipBars = ##t
> \override Score.MultiMeasureRest.expand-limit = 1
> \override Score.MultiMeasureRest.minimum-length = #30
> }
>
> inlineMMRN = {
> \once \override MultiMeasureRest.layer = #-2
> \once \override MultiMeasureRestNumber.layer = #-1
> \once \override MultiMeasureRestNumber.Y-offset = #0
> \once \override MultiMeasureRestNumber.stencil = #white-under
> }
>
> timeParens = \markup { \huge "(" \magnify #1.4 " " \huge ")" }
>
> {
> \setInlineMMRN
> \inlineMMRN R1*4^\markup { \timeParens }
> }

Why add MultiMeasureRestText?
You already create a new stencil for MultiMeasureRestNumber, add the
parentheses there:

#(define (white-under grob)
  (grob-interpret-markup grob
    #{
      \markup
        \whiteout
        \pad-x #-0.2
        \line \vcenter {
          \huge \normal-text "("
          #(ly:grob-property grob 'text)
          \huge \normal-text  ")"
      }
    #}))

setInlineMMRN = {
    \set Score.skipBars = ##t
    \override Score.MultiMeasureRest.expand-limit = 1
    \override Score.MultiMeasureRest.minimum-length = #30
}

inlineMMRN = {
    \once \override MultiMeasureRest.layer = #-2
    \once \override MultiMeasureRestNumber.layer = #-1
    \once \override MultiMeasureRestNumber.Y-offset = #0
    \once \override MultiMeasureRestNumber.stencil = #white-under
}

{
    \setInlineMMRN
    \inlineMMRN
    R1*4
}

This could even be shortened...

> %{
>
> But I could not get it to move down onto the staff.  As described in
> http://www.lilypond.org/doc/v2.19/Documentation/notation/formatting-text#text-alignment
> "Vertical alignment is a bit more complex. As stated above, markup objects
> can be moved as a whole;
> however, it is also possible to move specific elements inside a markup
> block."
>
> It took me a while to realize this meant that the techniques using
> raise, lower, translate, general-align and translate-scaled
> will NOT affect the "markup object moved as a whole",
> but rather affect the relative position of objects within the markup object.
>
> I also learned that these techniques, in addition to never placing text on
> the staff,
> will not place text to the left of the anchor point.
>
> Perhaps this section should include a comment to the effect of:
>
> "The commands raise, lower, translate, general-align and translate-scaled
> used within a markup block are limited to printing text
> outside the staff and to the right of the anchor point."
> %}

Well, it's not true, see:

\markup {
   \line { \circle "."  "This is the anchor" }
   \translate #'(-25 . 3) \with-dimensions #empty-interval #empty-interval "xy"
 }

Printing text in Staff depends of the settings for TextScript

{
  \override TextScript.outside-staff-priority = #'()
  \override TextScript.staff-padding = #'()
  s1^\markup {
        \line { \circle "."  "This is the anchor" }
        \translate #'(-25 . 0) \with-dimensions #empty-interval
#empty-interval "xy"
      }
}


> %  The documentation for moving objects suggests using extra-offset.
> %  http://lilypond.org/doc/v2.19/Documentation/learning/moving-objects
> %  Likewise, this does not work on the multi-measure rest.
>
> \setInlineMMRN
> \inlineMMRN
> \once \override TextScript #'extra-offset = #'(0 . -3.7)
> R1*8^\timeParens
> }

A markup added to a MMR is of type MultiMeasureRestText _not_ TextScript, see:

{
  \once \override TextScript #'extra-offset = #'(0 . -3.7)
  R1^"foo"
  \once \override MultiMeasureRestText #'extra-offset = #'(0 . -3.7)
  R1^"foo"
}

No need for all the other stuff...
> [...]

HTH,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]