[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Snippet for aligning markup inside another markup
From: |
Michael Käppler |
Subject: |
Re: Snippet for aligning markup inside another markup |
Date: |
Sat, 5 Oct 2019 23:47:20 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Hi Aaron and Kieren,
very nice!
(I really should have read how the markup commands make use of
ly:stencil-aligned-to...)
Here my variant of the code with tweakable alignment. Personally I
prefer the "scheme only-style" but
I agree that the mixed style Aaron used would be shorter.
%%%%
\version "2.19.80"
#(define-markup-command (aligned-overlay layout props xdir ydir args)
(number? number? markup-list?)
(let* ((stencils (interpret-markup-list layout props args))
(align (lambda (stencil)
(ly:stencil-aligned-to
(ly:stencil-aligned-to stencil X xdir)
Y ydir)))
(stencils-aligned-merged (apply ly:stencil-add (map align
stencils))))
(ly:stencil-aligned-to (ly:stencil-aligned-to
stencils-aligned-merged X LEFT)
Y DOWN)))
boxone = \markup \with-color #yellow \filled-box #'(0 . 10) #'(0 . 10) #0
boxtwo = \markup \with-color #green \filled-box #'(3 . 9) #'(5 . 11) #0
boxthree = \markup \with-color #red \filled-box #'(2 . 5) #'(3 . 6) #0
\markup \column {
"Without alignment"
\overlay { \boxone \boxtwo \boxthree }
\line {
\column {
"Everything centered "
\aligned-overlay #CENTER #CENTER { \boxone \boxtwo \boxthree }
}
\column {
"Everything aligned to bottom-left "
\aligned-overlay #LEFT #DOWN { \boxone \boxtwo \boxthree }
}
\column {
"Different alignments "
\aligned-overlay #CENTER #UP {
\boxone
\aligned-overlay #LEFT #CENTER { \boxtwo \boxthree }
}
}
\column {
"Values in-between"
\aligned-overlay #-0.8 #-0.5 {
\boxone
\aligned-overlay #0.5 #-0.2 { \boxtwo \boxthree }
}
}
}
}
%%%%
Cheers,
Michael
Am 01.10.2019 um 01:45 schrieb Kieren MacMillan:
Hi Aaron,
Here's my take:
Nice work!
This should be part of the base distro, IMO.
Thanks,
Kieren.
________________________________
Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: address@hidden
_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
- Re: Snippet for aligning markup inside another markup,
Michael Käppler <=