lilypond-user
[Top][All Lists]
Advanced

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

Re: Adjusting OttavaBracket parameters (was "Re: can't seem to apply twe


From: Kieren MacMillan
Subject: Re: Adjusting OttavaBracket parameters (was "Re: can't seem to apply tweaks on tweaks")
Date: Sat, 2 Jan 2016 11:16:40 -0500

Hi Harm,

> Just wrote a bug-report:
> http://lilypond.1069038.n5.nabble.com/Overriding-OttavaBracket-text-fails-td185451.html

Thanks!

Can you help me with the #'stencil-align-dir-y replacement hack?

In the snippet (below), I’ve got the basic 8va the way I want it, but can’t 
seem to find the right combination of \with-dimension, \translate, and \lower 
[or \raise] for the broken 8va version: it needs to have a tight skyline, be 
aligned with the extender line exactly as the 8va, and have sufficient padding 
for both inside-staff and outside-staff notes.

Thanks,
Kieren.

p.s. Here’s a perfect example where I’ve spent far more than 50 euros in my 
time, trying to tweak something that took 2 seconds with the overriden stencil. 
I would much rather have paid someone 50 euros to implement 
#'stencil-align-dir-y, since it would then be available to all users forever…  
=\

%%%%  SNIPPET BEGINS
\version "2.19.32"

#(set-global-staff-size 18)
#(ly:set-option 'debug-skylines #t)

\paper {
  #(define fonts
    (make-pango-font-tree "Crimson Text"
                          "Myriad Pro"
                          "Courier Prime"
                          (/ staff-height pt 20)))
  ragged-right = ##f
}

\layout {
  \context {
    \Score
    \override OttavaBracket.padding = #1
  }
}

#(define eightva
 #{
   %% messing around with \with-dimensions,
   %% because OttavaBracket has no details.stencil-align-dir-y
   \markup
       \translate #'(-0.375 . 0) \with-dimensions #'(0 . 3.5) #'(-1 . 0.25)
       \lower #1.875 \italic \concat { "8" \raise #0.5 { \hspace #0.25 "va" } }
 #})
#(define eightva-par
 #{
   \markup
       \translate #'(0.625 . 0) \with-dimensions #'(0 . 4.625) #'(0 . 2)
       \lower #1 \concat { "(" \hspace #-0.125 \italic { "8" \raise #0.5 { 
\hspace #0.125 "va" } } \hspace #0.1 ")" }
 #})
octU = {
  \once \override Staff.OttavaBracket.font-shape = #'roman
  \once \override Staff.OttavaBracket.before-line-breaking =
      #(lambda (grob) (ly:grob-set-property! grob 'text eightva))
  \override Staff.OttavaBracket.after-line-breaking =
   #(lambda (grob)
      (let* ((orig (ly:grob-original grob))
             (siblings (if (ly:grob? orig)
                           (ly:spanner-broken-into orig)
                           '())))
       (if (> (length siblings) 1)
           (for-each
             (lambda (sib) (ly:grob-set-property! sib 'text eightva-par))
             (cdr siblings)))))
  \ottava #1
}

#(define eightba
 #{
   %% messing around with \with-dimensions,
   %% because OttavaBracket has no details.stencil-align-dir-y
   \markup
       \translate #'(-0.375 . 0) \with-dimensions #'(1 . 3.5) #'(2.5 . 0.125)
       \raise #1.25 \italic \concat { "8" \hspace #0.125 "ba" }
 #})
#(define eightba-par
 #{
   \markup
       \translate #'(0.625 . 0) \with-dimensions #'(1 . 4.625) #'(2 . 0.125)
       \raise #1.25 \concat { "(" \hspace #-0.125 \italic { "8" \hspace #0.125 
"ba" } \hspace #0.1 ")" }
 #})
octD = {
  \once \override Staff.OttavaBracket.font-shape = #'roman
  \once \override Staff.OttavaBracket.before-line-breaking =
      #(lambda (grob) (ly:grob-set-property! grob 'text eightba))
  \override Staff.OttavaBracket.after-line-breaking =
   #(lambda (grob)
      (let* ((orig (ly:grob-original grob))
             (siblings (if (ly:grob? orig)
                           (ly:spanner-broken-into orig)
                           '())))
       (if (> (length siblings) 1)
           (for-each
             (lambda (sib) (ly:grob-set-property! sib 'text eightba-par))
             (cdr siblings)))))
  \ottava #-1
}

{
  \octU c'''4 4 4 4 \break 4 4 4 \ottava #0 4 \break
  \octU c''''4 4 4 4 \break 4 4 4 4 \break
  \octD c'4 4 4 4 \break 4 4 4 \ottava #0 4 \break
  \octD c4 4 4 4 \break 4 4 4 4
}
%%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden




reply via email to

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