lilypond-user
[Top][All Lists]
Advanced

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

Re: How to really center a text above a note?


From: Mats Bengtsson
Subject: Re: How to really center a text above a note?
Date: Mon, 29 Jun 2009 15:59:18 +0200
User-agent: Thunderbird 2.0.0.5 (X11/20070716)

A hint is to look at how the alignment is done for articulations, i.e. Script layout objects, where the X-offset property is the function script-interface::calc-x-offset defined in scm/output-lib.scm. It doesn't work to use that function directly for TextScript objects, but you can probably use it as a building block or at least as inspiration for a similar function for TextScript objects.

I figured this out when comparing to version 2.8, where the X-offset of Script objects indeed was calculated using ly:self-alignment-interface::centered-on-x-parent and yes, I have already tried to just replace this by script-interface::calc-x-offset in the code given below, so the solution is not that simple.

   /Mats

Trevor Bača wrote:
Second: there used to be a (somewhat more) direct way of specifying the point-on-notehead to which TextScripts would make reference during positioning. Here're some settings from 2006:


%%% BEGIN X-PARENT CENTERING SNIPPET %%%

\version "2.9.16"

textScriptCenterOnParent = \override TextScript #'X-offset =

      #(ly:make-simple-closure
        `(,+ ,(ly:make-simple-closure (list
 ly:self-alignment-interface::x-aligned-on-self))
      ,(ly:make-simple-closure (list
 ly:self-alignment-interface::centered-on-x-parent))))

\new Staff {
 \textScriptCenterOnParent
 \override TextScript #'self-alignment-X = #left
 c'4_\markup { MMM }
 \override TextScript #'self-alignment-X = #center
 c'4_\markup { MMM }
 \override TextScript #'self-alignment-X = #right
 c'4_\markup { MMM }
}

%%% END X-PARENT SNIPPET %%%


These are settings that I put together in September 2006 ...

   http://lists.gnu.org/archive/html/lilypond-user/2006-09/msg00088.html

... and, at that time, they worked great. See notehead-centering.png, reattached here for convenience.

(And I should also mention that I cobbled together the settings given above by looking at the settings for OctavateEight in define-grobs.scm rather blindly. But they worked great.)

But running that same code now (2.13.2) produces bizarre results. See weird-notehead-centering.png.

So, thinking about Michael's statement here ...

ML> I think the difference is that LyricTexts have NoteHeads as grob-parents,
while TextScripts have PaperColumns.

... is it possible that TextScripts *used to* have NoteHeads as grob-parents (at least in 2.9.16) and have since changed to have PaperColumns as grob parents, thus rendering the settings from 2.9.16 no longer functional?

Or is something else now going that would prevent calls to Self_alignment_interface::aligned_on_x_parent and centered_on_x_parent from working as they did previously?


Trevor.


--
Trevor Bača
address@hidden <mailto:address@hidden>

------------------------------------------------------------------------


------------------------------------------------------------------------

------------------------------------------------------------------------

_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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