lilypond-user
[Top][All Lists]
Advanced

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

How to properly scale a line in markup?


From: Thomas Morley
Subject: How to properly scale a line in markup?
Date: Sat, 4 Nov 2017 11:26:47 +0100

Hi all,

for researching a certain bug I tried to create a stripped-down markup-command.
It prints "A" and a vertical line.
In the real markup-command there will be no "A", so I can't go for
stencil-extent of it.
The length of the line is here manually set to 1.6, which is almost
the height of "A".
This line should always have the length of the probably scaled "A" and
thus should scale properly for changes of \fontsize,
layout-set-staff-size and  set-global-staff-size.

Though...

If I do "I" (i.e. taking font-size into account)
Then it is robust for fontsize and set-global-staff-size, but not for
layout-set-staff-size

%%%%%%%%%%
%% "I"
%%%%%%%%%

#(define-markup-command (A-plus-vline layout props)()
#:properties ((font-size 0))
  (let* ((ref-stil (interpret-markup layout props "A"))
         (line-y 1.6)
         (scaled-line
           (* (magstep font-size)
              line-y)))
    (ly:stencil-combine-at-edge
      ref-stil
      X
      RIGHT
      (ly:round-filled-box '(0 . 0.1) (cons 0  scaled-line)
        0.08)
      0.2)))


#(set-global-staff-size 60)

\score {
  {
      a^\markup
          \fontsize #5
          \A-plus-vline
  }
  %\layout { #(layout-set-staff-size 10) }
}

If I do "II" (i.e. taking font-size and text-font-size into account)
Then it is robust for fontsize and layout-set-staff-size, but not for
set-global-staff-size
%%%%%%%%%%
%% II
%%%%%%%%%

#(define-markup-command (A-plus-vlineII layout props)()
#:properties ((font-size 0))
  (let* ((ref-stil (interpret-markup layout props "A"))
         (line-y 1.6)
         (text-font-size (ly:output-def-lookup layout 'text-font-size 11))
         (scaled-line
           (* (/ text-font-size 11)
              (magstep font-size)
              line-y)))
    (ly:stencil-combine-at-edge
      ref-stil
      X
      RIGHT
      (ly:round-filled-box '(0 . 0.1) (cons 0  scaled-line)
        0.08)
      0.2)))


%#(set-global-staff-size 60)

\score {
  {
      a^\markup
          \fontsize #5
          \A-plus-vlineII
  }
  \layout { #(layout-set-staff-size 10) }
}


What's wrong?
Am I missing something?


Thanks,
  Harm



reply via email to

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