[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: position text opposite stem direction
From: |
harm6 |
Subject: |
Re: position text opposite stem direction |
Date: |
Thu, 29 Dec 2011 15:19:58 -0800 (PST) |
Hi,
maaachseven wrote:
>
> Hello,
>
> Is there a way to automatically position note text opposite the note's
> stem direction? I can do it manually with \markup using the direction
> indicators ^ and _ , but I'm hoping there is a way to automate it. I
> thought the default direction indicator - might do help, but it defaults
> to below all of the time.
>
> Thank you so much!
>
try:
\version "2.14.2"
#(define (forced-dir grob)
(let* ((x-parent (ly:grob-parent grob X))
(elts (ly:grob-object x-parent 'elements))
(grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta)
'name)))
(stems (filter (lambda (x) (eq? 'Stem (grob-name x)))
(ly:grob-array->list elts)))
(stem (list-ref stems 0))
(stem-dir (ly:grob-property stem 'direction)))
(if (= stem-dir 1)
(ly:grob-set-property! grob 'direction -1)
(ly:grob-set-property! grob 'direction 1))))
\relative c' {
\textLengthOn
\override TextScript #'direction = #forced-dir
a4-\markup { \italic "TextScript"}
b'-\markup { \italic "TextScript"}
c'-\markup { \italic "TextScript"}
d,,-\markup { \italic "TextScript"}
e,-\markup { \italic "TextScript"}
f'-\markup { \italic "TextScript"}
g'-\markup { \italic "TextScript"}
a'-\markup { \italic "TextScript"}
b,,-\markup { \italic "TextScript"}
}
This is of course limited to TextScript. Are you considering other grobs
such as Fingering, StringNumber, StrokeFinger, too?
HTH,
Harm
--
View this message in context:
http://old.nabble.com/position-text-opposite-stem-direction-tp33050999p33052632.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.