[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: within \markup, how to \translate by width of another markup?
From: |
Werner LEMBERG |
Subject: |
Re: within \markup, how to \translate by width of another markup? |
Date: |
Tue, 17 May 2022 08:18:00 +0000 (UTC) |
>> AFAICS, we are back to square one, needing the possibility to
>> `\translate` something by the width of another markup. I will cook
>> something up and see how well it works.
>
>
> Probably
>
> ```
> \version "2.22.2"
>
> #(define-markup-command (translate-by-extent-of layout props axis direction
> extent-source mkup)
> (index? ly:dir? markup? markup?)
> (let* ((stil (interpret-markup layout props mkup))
> (source-stil (interpret-markup layout props extent-source))
> (ext (ly:stencil-extent source-stil axis))
> (trans (* direction (interval-length ext))))
> (ly:stencil-translate-axis stil trans axis)))
>
>
> \markup \box \number \column {
> \translate-by-extent-of #X #RIGHT 9 \right-align { 11 10 }
> 6 5 4 3 2 1
> }
> ```
>
>
> That being said, I think I would rather define an interface to
> align a markup on another markup.
>
> ```
> \version "2.22.2"
>
> #(define-markup-command (align-on-other layout props axis self-align-dir
> other-align-dir
> alignment-markup printed-markup)
> (index? number? number? markup? markup?)
> (let* ((stil (interpret-markup layout props printed-markup))
> (stil-ext (ly:stencil-extent stil axis))
> (align-stil (interpret-markup layout props alignment-markup))
> (align-ext (ly:stencil-extent align-stil axis))
> (trans (- (interval-index align-ext other-align-dir)
> (interval-index stil-ext self-align-dir))))
> (ly:stencil-translate-axis stil trans axis)))
>
> \markup \number \column {
> \align-on-other #X #RIGHT #RIGHT 9 { 11 10 }
> 6 5 4 3 2 1
> }
> ```
Excellent, thanks! I like `\align-on-other` very much.
> By the way, are you sur this is the canonical presentation for
> figured bass digits? \figures { <11 10 6 5 4 3 2 1> } seems to do a
> kind of \center-column (using the ad-hoc translation you mentioned),
> which what I would expect ...
I'm still investigating. Whatever the outcome is, `\align-on-other`
serves all useful possibilities very well and is definitely better
than the current ad-hoc translation.
Werner
- Re: within \markup, how to \translate by width of another markup?, (continued)
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, David Kastrup, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, David Kastrup, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, David Kastrup, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, David Kastrup, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/17
- Re: within \markup, how to \translate by width of another markup?, Jean Abou Samra, 2022/05/17
- Re: within \markup, how to \translate by width of another markup?,
Werner LEMBERG <=
- Re: within \markup, how to \translate by width of another markup?, Jean Abou Samra, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Werner LEMBERG, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, Jean Abou Samra, 2022/05/16
- Re: within \markup, how to \translate by width of another markup?, David Kastrup, 2022/05/16