lilypond-devel
[Top][All Lists]
Advanced

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

Re: GSOC: change XY-extent to outer-XY-extent and inner-XY-extent (desig


From: Joe Neeman
Subject: Re: GSOC: change XY-extent to outer-XY-extent and inner-XY-extent (design - feedback requested)
Date: Mon, 18 Jun 2012 13:23:59 +0200


On Mon, Jun 18, 2012 at 12:12 PM, Janek Warchoł <address@hidden> wrote:
Hi all,

Summary: see attached explanation.png.

I've noticed problems with aligning grobs and markups correctly: issue
2451 (http://code.google.com/p/lilypond/issues/detail?id=2451), issue
2452 (http://code.google.com/p/lilypond/issues/detail?id=2452); there
are serious problems with markups (example attached) and other things.

The core of the problem is that XY-extents are currently related to
graphical size, not to the logical outlines.  I suggest that we change
this to have "outer" and "inner" extents; outer extents will contain
whole object and inner extents will contain only the part "which
matters".  This is a generalization of my idea for lyrics
(http://code.google.com/p/lilypond/issues/detail?id=2451#c1); see
attached explanation.png if you haven't already.

Hi Janek,

I think that what you propose can be done more generically using higher-order functions to build grob callbacks. This would have two main advantages that I can see: it would allow each grob to have more than one "core extent" to be used in different contexts, and it would allow those "core extents" to be referenced using meaningful names. Consider the example:

#(define (ly:aligned-on-X-parent-using sym)
 (lambda (grob)
  (let ((grob-extent (ly:grob-property grob sym))
   ...
   ;; do the alignment, but using the result of looking up 'sym instead of the grob's extent
)))

\override LyricText #'non-punctuation-extent = #(some-callback-that-computes-the-right-thing)
\override LyricText #'X-offset = #(ly:aligned-on-X-parent-using 'non-punctuation-extent)

If someone then decides that they also want numbers to be excluded, then they can write a non-punctuation-or-number-extent callback and do
\override LyricText #'X-offset = #(ly:aligned-on-X-parent-using 'non-punctuation-or-number-extent)
I think that we could provided a lot of functionality (and flexibility) by providing a selection of functions like ly:aligned-on-X-parent-using and a selection of callbacks to use them with.

Whatever design you pursue, I think it's worth keeping around the old X-extent and Y-extent names, if only so that there is no painful transition. Actually, it seems like extents are gradually being replaced by more accurate outlines (ie. skylines) anyway, but they are probably still useful for certain things.

Cheers,
Joe


reply via email to

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