lilypond-user
[Top][All Lists]
Advanced

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

Re: How to properly scale a line in markup?


From: Thomas Morley
Subject: Re: How to properly scale a line in markup?
Date: Sun, 5 Nov 2017 13:59:36 +0100

2017-11-05 13:29 GMT+01:00 Robin Bannister <address@hidden>:
> Thomas Morley wrote:
>
>> In the real markup-command there will be no "A", so I can't go for
>> stencil-extent of it.
>
> .
> .
> .
>> Am I missing something?
>
>
> I have the feeling it must be me that's missing something,
> but can't you keep the "A" and just not print it?
>
>     (let* ((ref-stil (interpret-markup layout props "A"))
>            (y-ext (ly:stencil-extent ref-stil Y)))
>       (ly:round-filled-box '(0 . 0.1) y-ext 0.08)))
>
>
> Cheers,
> Robin
>
>

The bug is in note-by-number
https://sourceforge.net/p/testlilyissues/issues/5122/
see last two comments.
Thus no text there.
In my test-markup the "A" was added to have a simple chance to compare
the line and the letter.

Meanwhile I found a factor with a relationship of current
staff-height, staff-space and again an admittedly simpler factor,
which I again can't catch or calculate, though.

See:

#(define-markup-command (A-plus-vlineIII 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))
         (staff-height (ly:output-def-lookup layout 'staff-height))
         (staff-space (ly:output-def-lookup layout 'staff-space))
         (scaled-line
           (* (/ text-font-size 11)
              (magstep font-size)
              (cond
                    (#f ;; global 5
                       (/ staff-height (* 1 staff-space)))
;; currently manually enabled
                    (#t ;; global 10
                       (/ staff-height (* 2 staff-space)))

                    (#f ;; global 20
                       (/ staff-height (* 4 staff-space)))

                    (#f ;; global 30
                       (/ staff-height (* 6 staff-space)))

                    (#f ;; global 40
                       (/ staff-height (* 8 staff-space)))

                    (#f ;; layout-size 60, global 50
                       (/ staff-height (* 10 staff-space)))

                    (#f ;; global 60
                       (/ staff-height (* 12 staff-space)))
                    (else 1)
                       )
              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 10)

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

Thanks,
  Harm



reply via email to

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