Re: Non-standard ledger lines and articulations collisions

2018-01-11 Thread Paul Morris

On 01/11/2018 04:20 AM, David Kastrup wrote:


Or let grob-transformer do all of the work.


Thanks for the tip!  That's the perfect tool for the job.  And I can 
also use it for other cases where I have been using 
before-line-breaking.  For the archives, below is the example expanded 
to show ly:unpure-call and grob-transformer.


Paul

%%

\version "2.19.63"

m = {
  c'''
  c'''\fermata
  c'''\trill
  c'''-^
  c'''-.
  c'''\segno
}

% collisions ahead!
{
  \override Staff.StaffSymbol.ledger-extra = 2
  \m
}

% using ly:unpure-call
{
  \override Staff.StaffSymbol.ledger-extra = 2
  \override Staff.Script.Y-offset =
  #(lambda (grob)
 (+ 1 (ly:unpure-call side-position-interface::y-aligned-side grob)))
  \m
}

% using grob-transformer from scm/music-functions.scm
{
  \override Staff.StaffSymbol.ledger-extra = 2
  \override Staff.Script.Y-offset =
  #(grob-transformer
    'Y-offset
    (lambda (grob default-value) (+ 1 default-value)))
  \m
}

%%




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Non-standard ledger lines and articulations collisions

2018-01-11 Thread David Kastrup
Paul Morris  writes:

> On 01/10/2018 10:57 AM, David Kastrup wrote:
>
>> You are missing the difference between
>> ly:side-position-interface::y-aligned-side and
>> side-position-interface::y-aligned-side .
>>
>> The latter is defined in scm/output-lib.scm as
>>
>> (define-public side-position-interface::y-aligned-side
>>(ly:make-unpure-pure-container
>> ly:side-position-interface::y-aligned-side
>> ly:side-position-interface::pure-y-aligned-side))
>>
>>> So am I missing something or are the docs off for Script.Y-offset?
>> The docs are autogenerated and cannot be off with regard to listed
>> default values.
>>
>>> Is a call to "(ly:side-position-interface::y-aligned-side grob)"
>>> actually the default call to use?
>> You are better off with
>> (ly:pure-call side-position-interface::y-aligned-side grob start end)
>> or
>> (ly:unpure-call side-position-interface::y-aligned-side grob)
>> depending on what you need.
>>
>> Or of course calling ly:side-position-interface::y-aligned-side and
>> ly:side-position-interface::pure-y-aligned-side directly.
>
> Thank you David!  That clears up most of my confusion.  Should have
> realized there was a difference between those two procedures.  I'd
> still like to look further into what's going on with the
> unpure-pure-container stuff, as I currently only have a vague sense of
> it.  Then maybe I'll have a better handle on whether to use the pure
> or unpure call for this case. (Or, I wonder, if it would make sense to
> do wrapped/custom versions of both and then combine them with
> ly:make-unpure-pure-container , so it more closely parallels the
> default situation?)

Or let grob-transformer do all of the work.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Non-standard ledger lines and articulations collisions

2018-01-10 Thread Paul Morris

On 01/10/2018 10:57 AM, David Kastrup wrote:


You are missing the difference between
ly:side-position-interface::y-aligned-side and
side-position-interface::y-aligned-side .

The latter is defined in scm/output-lib.scm as

(define-public side-position-interface::y-aligned-side
   (ly:make-unpure-pure-container
ly:side-position-interface::y-aligned-side
ly:side-position-interface::pure-y-aligned-side))


So am I missing something or are the docs off for Script.Y-offset?

The docs are autogenerated and cannot be off with regard to listed
default values.


Is a call to "(ly:side-position-interface::y-aligned-side grob)"
actually the default call to use?

You are better off with
(ly:pure-call side-position-interface::y-aligned-side grob start end)
or
(ly:unpure-call side-position-interface::y-aligned-side grob)
depending on what you need.

Or of course calling ly:side-position-interface::y-aligned-side and
ly:side-position-interface::pure-y-aligned-side directly.


Thank you David!  That clears up most of my confusion.  Should have 
realized there was a difference between those two procedures.  I'd still 
like to look further into what's going on with the unpure-pure-container 
stuff, as I currently only have a vague sense of it.  Then maybe I'll 
have a better handle on whether to use the pure or unpure call for this 
case. (Or, I wonder, if it would make sense to do wrapped/custom 
versions of both and then combine them with 
ly:make-unpure-pure-container , so it more closely parallels the default 
situation?)


Thanks again,
Paul




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Non-standard ledger lines and articulations collisions

2018-01-10 Thread David Kastrup
Paul Morris  writes:

> Here's my specific question.  The docs say this for the Y-offset
> property of the Script object:
>
> |Y-offset| (number):
>
>|#ly:side-position-interface::y-aligned-side> #ly:side-position-interface::pure-y-aligned-side> >|
>
>The vertical amount that this object is moved relative to its Y-parent.
>
> http://lilypond.org/doc/v2.19/Documentation/internals/script
>
> But in the source code, in 'scm/define-grobs.scm', for the Script grob
> I see no mention of unpure-pure-container:
>
> (Y-offset . ,side-position-interface::y-aligned-side)

You are missing the difference between
ly:side-position-interface::y-aligned-side and
side-position-interface::y-aligned-side .

The latter is defined in scm/output-lib.scm as

(define-public side-position-interface::y-aligned-side
  (ly:make-unpure-pure-container
   ly:side-position-interface::y-aligned-side
   ly:side-position-interface::pure-y-aligned-side))

> So am I missing something or are the docs off for Script.Y-offset?

The docs are autogenerated and cannot be off with regard to listed
default values.

> Is a call to "(ly:side-position-interface::y-aligned-side grob)"
> actually the default call to use?

You are better off with
(ly:pure-call side-position-interface::y-aligned-side grob start end)
or
(ly:unpure-call side-position-interface::y-aligned-side grob)
depending on what you need.

Or of course calling ly:side-position-interface::y-aligned-side and
ly:side-position-interface::pure-y-aligned-side directly.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Non-standard ledger lines and articulations collisions

2018-01-10 Thread Paul Morris
Hi all,  I'm working on a work-around for a collision between ledger 
lines and articulations, for Clairnote an alternative notation system: 
http://clairnote.org/sn/  LilyPond does not currently take non-standard 
'extra' ledger lines into account when positioning articulations.  
Here's a minimal example with a proof of concept for a possible work-around:


%%

\version "2.19.63"

m = {
  c'''
  c'''\fermata
  c'''\trill
  c'''-^
  c'''-.
  c'''\segno
}

% collisions ahead!
{
  \override Staff.StaffSymbol.ledger-extra = 2
  \m
}

% wrap the usual Script.Y-offset procedure in another
% one to make an adjustment to what it returns, to
% avoid the collisions
{
  \override Staff.StaffSymbol.ledger-extra = 2
  \override Staff.Script.Y-offset =
  #(lambda (grob)
 (+ 1 (ly:side-position-interface::y-aligned-side grob)))
  \m
}

%%

Here's my specific question.  The docs say this for the Y-offset 
property of the Script object:


|Y-offset| (number):

   |# # >|

   The vertical amount that this object is moved relative to its Y-parent.

http://lilypond.org/doc/v2.19/Documentation/internals/script

But in the source code, in 'scm/define-grobs.scm', for the Script grob I 
see no mention of unpure-pure-container:


(Y-offset . ,side-position-interface::y-aligned-side)

I see other grob properties in that file that do have the 
unpure-pure-container pattern, like Rest.Y-extent:


(Y-extent . ,(ly:make-unpure-pure-container ly:rest::height 
ly:rest::pure-height))


So am I missing something or are the docs off for Script.Y-offset? Is a 
call to "(ly:side-position-interface::y-aligned-side grob)" actually the 
default call to use?


(On the other hand, maybe it would work to change the Y-parent of Script 
grobs to be the ledger lines grob in cases where there are ledger lines 
that are further from the staff than the furthest note head?)


Thanks,
-Paul
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user