lilypond-user
[Top][All Lists]
Advanced

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

Re: Text alignment center of note head


From: Mats Bengtsson
Subject: Re: Text alignment center of note head
Date: Sun, 17 Jun 2007 12:26:03 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20061113 Debian/1.7.8-1sarge8

TiagoM wrote:

...

This is what I was looking for. But not yet all of it. I'd like to have the
text centered on the note head only when the text itself is centered (when
using \hcenter or \center-align or \halign #0).

Is it possible to add this \override property writen above inside a
\markup{}, just like when we change the font size: \markup {\override
#'(font-size . -5) "ABC"}?
You cannot do this setting from within a markup command,
as far as I know, but you can easily define a macro
centermarkup = {
\once \override TextScript #'self-alignment-X = #CENTER
\once \override TextScript #'X-offset =#(ly:make-simple-closure
                    `(,+
,(ly:make-simple-closure (list ly:self-alignment-interface::centered-on-x-parent)) ,(ly:make-simple-closure (list ly:self-alignment-interface::x-aligned-on-self))))
}

that you can use like

c^"Left aligned" \centermarkup c^"Centered" c^"Left aligned again"

Of course you can change the macro name to something shorter
if you want to save typing.

Anyway I think the centering commands should already center the text with
the center of the notehead. is there a reason why it isn't this way?
The alignment is done by aligning a reference point tied to the
note with a reference point tied to the markup. As long as you
have left aligned markups, I hope you agree that it makes sense
to have them left aligned with the note head, i.e. the reference
point of the note head is at the left edge, so that's why the
reference point of the note is not at the center by default.

I agree that it would be a nice feature, though.

  /Mats




reply via email to

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