[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Baseline align in TextSpanner
From: Davide Liessi <davide.liessi () gmail ! com>
Date: 2018-09-28 6:25:39
Message-ID: CAOXn3bqOOcn8x5hTpw4pzAEnxCG4xez08jgMmJXiL-rzMz2Q4Q () mail ! gmail ! com
[Download RAW message or body]
Hi all.
I want to align TextSpanner texts to baseline.
I'm trying to use the code provided by Thomas Morley / Harm in
http://lists.gnu.org/archive/html/lilypond-user/2016-10/msg00365.html
which works very well e.g. with \tempo, but applying \test to
TextSpanner.bound-details.left.text has no effect.
I also tried replacing ly:line-spanner::print in TextSpanner.stencil
with a new function but I couldn't make it work.
An example follows, including Harm's code.
Is there a way to adapt it to my case?
Best wishes.
Davide
\version "2.19.82"
#(define (lists-map function ls)
"Apply @var{function} to @var{ls} and all of it sublists.
First it recurses over the children, then the function is applied to
@var{ls}."
(if (list? ls)
(set! ls (map (lambda (y) (lists-map function y)) ls))
ls)
(function ls))
#(define test-proc
(lambda (e)
(if (and (list? e) (member 'glyph-string e))
(begin
(for-each
(lambda (x)
(begin
(set-car! (cadr x) 0)
x))
(cadr (last e)))
e)
e)))
#(define-markup-command (test layout props glyph-name)
(markup?)
(let* ((stil (interpret-markup layout props glyph-name))
(new-stile-expr
(lists-map
test-proc
(ly:stencil-expr stil))))
(ly:make-stencil
new-stile-expr
(ly:stencil-extent stil X)
;(cons 0 (cdr (ly:stencil-extent stil Y)))
(ly:stencil-extent stil Y)
)))
{
\override TextSpanner.bound-details.left.text = \markup { \test "a" }
b2\startTextSpan b2\stopTextSpan
\override TextSpanner.bound-details.left.text = \markup { \test "p" }
b2\startTextSpan b2\stopTextSpan
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic