Re: tweaks don't apply to post-function grob

2017-08-15 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David,
>
>> As long as you refuse to answer the question I have repeated
>> at least 3 times by now, there is no implementable specification.
>> 
>> You have again _completely_ failed to specify what you actually expect
>> self-alignment-X to do over its range of values in the context of \dynText .
>
> I expect (have *always* expected) self-alignment-X to do exactly what
> it currently does over its range of values in the context of \dynText:
> LEFT should left-align the grob, CENTER should center-align the grob,
> and RIGHT should right-align the grob.

To quote from the original mail starting this thread:

Hi all,

In the snippet below, I want to tweak a dynamic grob created using
Shevek's dynText function
(cf. http://lists.gnu.org/archive/html/lilypond-user/2017-07/msg00043.html).
But unfortunately, tweaks don't seem to affect it.

How can I change the function such that I can still apply tweaks
(X-offset, self-alignment-X, etc.) to the combined dynamic-text grob
"at runtime"?

%%%  SNIPPET BEGINS
\version "2.19.64"

[...]

{ c''1-\tweak self-alignment-X #RIGHT \dynText "mp" "test" }
%%%  SNIPPET ENDS


> If that doesn't answer your question, I too must give up.

That makes two of us.

-- 
David Kastrup

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hi David,

> As long as you refuse to answer the question I have repeated
> at least 3 times by now, there is no implementable specification.
> 
> You have again _completely_ failed to specify what you actually expect
> self-alignment-X to do over its range of values in the context of \dynText .

I expect (have *always* expected) self-alignment-X to do exactly what it 
currently does over its range of values in the context of \dynText: LEFT should 
left-align the grob, CENTER should center-align the grob, and RIGHT should 
right-align the grob.

If that doesn't answer your question, I too must give up.

Thanks,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David,
>
>> you still fail to specify _what_ you actually want.
>
> Sigh. I have specified exactly what I want. Several times. I'll do it
> again, in yet another wording, hoping you find this more clear:

I give up.  As long as you refuse to answer the question I have repeated
at least 3 times by now, there is no implementable specification.

You have again _completely_ failed to specify what you actually expect
self-alignment-X to do over its range of values in the context of
\dynText .

> (Note that I have intentionally left out the post-hoc "tweak using the
> edition-engraver" portion of my process, since that part seems to be
> confusing you.)

Rather I suspect that it excites you to a degree where you again and
again and again forget what I am asking.  It's irrelevant to the issue
at hand.

>> Without such a specification, there will be no code doing what you
>> want because you just leave far too much in the open.
>
> It seems pretty cut and dried to me. What is unclear about the 2-point
> specification I gave, above?

It doesn't specify what the different possible values of
self-alignment-X are supposed to do, and your request was that
self-alignment-X was to be heeded.

-- 
David Kastrup

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hi David,

> you still fail to specify _what_ you actually want.

Sigh. I have specified exactly what I want. Several times. I'll do it again, in 
yet another wording, hoping you find this more clear:

1. I want a function which combines text and dynamics (as both \dynamic and 
\dynText do).

2. I want that function to set the [default] alignment such that combo dynamics 
with leading *dynamic* text are aligned as if there was no appended text (which 
\dynText does well, but \dynamic does not), and combo dynamics which have 
leading *normal" text are left-aligned with the left-edge of the notehead 
(which both functions do well).

Essentially, I want the dynamic alignment as given by \dynText with the 
interface given by \dynamic.

(Note that I have intentionally left out the post-hoc "tweak using the 
edition-engraver" portion of my process, since that part seems to be confusing 
you.)

> Without such a specification, there will be no code doing what you want 
> because you just leave far too much in the open.

It seems pretty cut and dried to me. What is unclear about the 2-point 
specification I gave, above?

Thanks,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David,
>
>  I have no idea how you actually call "seems to work",
>
>  namely just _how_ you want self-alignment-X to get factored in,
>
>  considering that the whole point of the dynText function is
>  to figure out an alignment yielding a text-dependent reference point.
>
> Sorry I haven't been clear.
>
> Here is a concrete description/example of what I want, and what I
> would say "works":
>
> 1. Attached is a screenshot of a current score I'm engraving.
>
> 2. I've used \dynText to create the dynamic "mp intensely".
>
> 3. Since the layout is such that this falls at the very end of a
> system, it messes up the horizontal spacing.
>
> 4. Using the edition-engraver, I'd like to set self-alignment-X =
> #RIGHT (which would allow the note spacing to normalize) and then use
> either X-offset or extra-offset to nudge the dynamic back to the right
> (to approximate the "proper" alignment). If I can do that, the
> mechanism (i.e., function + post-hoc tweak) "works".

Sigh.  I repeat: _what_ values of self-alignment-X should move the
reference point _where_ in "somewhat f"?  The default would be to have
-1 be the left border of the whole text, +1 the right border, 0 the
_center_ (and _not_ the middle of t and f).

You say you want self-alignment-X as +1 refer to the right border.  You
can already have that by just reverting X-offset to its default and then
using self-alignment-X in the old manner.

So apparently that is _not_ what you want, but you still fail to specify
_what_ you actually want.  Without such a specification, there will be
no code doing what you want because you just leave far too much in the
open.

> Although I clearly did not communicate my intention well enough, I
> knew *exactly* what I wanted before I started poking around.

You have a hand-waving idea about a border case and want to be able to
fudge your way around from that.  That's too vague for casting into a
computer-comprehensible form.

-- 
David Kastrup

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hello David (et al.),

> Using the edition-engraver, I'd like to set self-alignment-X = #RIGHT (which 
> would allow the note spacing to normalize) and then use either X-offset or 
> extra-offset to nudge the dynamic back to the right (to approximate the 
> "proper" alignment). If I can do that, the mechanism (i.e., function + 
> post-hoc tweak) "works".

As it turns out, I can get the same effect by setting X-extent = 
#empty-interval (so that the note-spacing ignores it) and then using 
extra-offset to nudge the dynamic back [almost] in place. That will do for my 
current needs… though I will continue to poke around and see if I can improve 
the \dynamic and \dynText function(s) in any way.

Thanks for the help,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hi David,

> I have no idea how you actually call "seems to work",
> namely just _how_ you want self-alignment-X to get factored in,
> considering that the whole point of the dynText function is
> to figure out an alignment yielding a text-dependent reference point.

Sorry I haven't been clear.

Here is a concrete description/example of what I want, and what I would say 
"works":

1. Attached is a screenshot of a current score I'm engraving.

2. I've used \dynText to create the dynamic "mp intensely".

3. Since the layout is such that this falls at the very end of a system, it 
messes up the horizontal spacing.

4. Using the edition-engraver, I'd like to set self-alignment-X = #RIGHT (which 
would allow the note spacing to normalize) and then use either X-offset or 
extra-offset to nudge the dynamic back to the right (to approximate the 
"proper" alignment). If I can do that, the mechanism (i.e., function + post-hoc 
tweak) "works".

> that is something you need to figure out before even starting to "poke 
> around".

Although I clearly did not communicate my intention well enough, I knew 
*exactly* what I wanted before I started poking around.

Thanks,
Kieren.




Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info 
‣ email: i...@kierenmacmillan.info 

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David (et al.),
>
>>> Can \dynText or similar be fashioned in such a way that leaves open
>>> the possibility of [effectively] tweaking the grob later in the
>>> process?
>> 
>> I repeat: If you want self-alignment-X to be heeded in there in some
>> manner, you need to incorporate it in the callback for the offset.
>
> I do appreciate the "teach a man to fish" approach…
>
> I've poked around at the \dynText function, and the \dynamic function
> in OpenLilyLib (see snippet, below, for original version), but have
> been as yet unable to incorporate self-alignment-X into the
> callback(s) for the offset in a way that seems to work.

I don't see what you tried.  And I have no idea how you actually call
"seems to work", namely just _how_ you want self-alignment-X to get
factored in, considering that the whole point of the dynText function is
to figure out an alignment yielding a text-dependent reference point.

So maybe you should say just what values of self-alignment-X you want to
lead to what alignment points when given a text like "somewhat f".

So far I have seen nothing in the way of spelling out what you actually
_want_.  Well, you want a dial to fiddle with, but just what values
should lead to what results without losing the whole point of dynText's
calculation is nothing you bothered to specify.

And of course that is something you need to figure out before even
starting to "poke around".

-- 
David Kastrup

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hi David (et al.),

>> Can \dynText or similar be fashioned in such a way that leaves open
>> the possibility of [effectively] tweaking the grob later in the
>> process?
> 
> I repeat: If you want self-alignment-X to be heeded in there in some
> manner, you need to incorporate it in the callback for the offset.

I do appreciate the "teach a man to fish" approach…

I've poked around at the \dynText function, and the \dynamic function in 
OpenLilyLib (see snippet, below, for original version), but have been as yet 
unable to incorporate self-alignment-X into the callback(s) for the offset in a 
way that seems to work.

Any further help or pointers (e.g., to a callback function which *does* 
incorporate self-alignment-X) would be welcome.

Thanks,
Kieren.

%%%  SNIPPET BEGINS
\version "2.19.64"

#(use-modules (ice-9 regex))

dynamic =
#(define-event-function (text) (markup?)
   (if (string? text)
   (let* ((underscores-replaced
   (string-map
(lambda (x) (if (eq? x #\_) #\space x))
text))
  (split-text (string-split underscores-replaced #\space))
  (formatted (map
  (lambda (word)
(if (string-match "^[mrzfps]*$" word)
(markup #:dynamic word)
(markup #:normal-text #:fontsize 0.625 #:italic 
word)))
  split-text)))
 #{
   -\tweak X-offset #0
   #(make-dynamic-script (make-line-markup formatted))
 #})

   ;; user provided a full-blown markup, so we don't mess with it:
   #{
 #(make-dynamic-script (markup #:normal-text text))
   #}))

{ c''1-\tweak self-alignment-X #RIGHT -\dynamic "p (non cresc.)" }
%%%  SNIPPET ENDS



Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David,
>
>> The tweak applies fine but self-alignment-X is consulted in the normal
>> callback for X-offset which has been replaced by a callback using the
>> formula (- 1 (/ width 2)) .  If you want self-alignment-X to be heeded
>> in there in some manner, you need to incorporate it in the callback for
>> the offset.
>
> Thanks for the explanation.
>
> The problem is, I want to eat my cake and have it too: I want a
> function (cf. \dynText) which combines a dynamic text with a piece of
> normal text and automatically sets the correct alignment (i.e., with
> the dynamic portion aligned as if there were no subsequent normal
> text), but I want to be able to manually tweak it afterwards (to avoid
> collisions, improve score aesthetics, etc.). Unfortunately, that
> "layout-time" tweak — which may be different for different "editions"
> — cannot be cooked into the function without (e.g.) tagging or similar
> content-presentation mixing, which I'd desperately like to avoid.
>
> Can \dynText or similar be fashioned in such a way that leaves open
> the possibility of [effectively] tweaking the grob later in the
> process?

I repeat: If you want self-alignment-X to be heeded in there in some
manner, you need to incorporate it in the callback for the offset.

-- 
David Kastrup

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


Re: tweaks don't apply to post-function grob

2017-08-15 Thread Kieren MacMillan
Hi David,

> The tweak applies fine but self-alignment-X is consulted in the normal
> callback for X-offset which has been replaced by a callback using the
> formula (- 1 (/ width 2)) .  If you want self-alignment-X to be heeded
> in there in some manner, you need to incorporate it in the callback for
> the offset.

Thanks for the explanation.

The problem is, I want to eat my cake and have it too: I want a function (cf. 
\dynText) which combines a dynamic text with a piece of normal text and 
automatically sets the correct alignment (i.e., with the dynamic portion 
aligned as if there were no subsequent normal text), but I want to be able to 
manually tweak it afterwards (to avoid collisions, improve score aesthetics, 
etc.). Unfortunately, that "layout-time" tweak — which may be different for 
different "editions" — cannot be cooked into the function without (e.g.) 
tagging or similar content-presentation mixing, which I'd desperately like to 
avoid.

Can \dynText or similar be fashioned in such a way that leaves open the 
possibility of [effectively] tweaking the grob later in the process?

Thanks,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: tweaks don't apply to post-function grob

2017-08-14 Thread David Kastrup
Kieren MacMillan  writes:

>
> In the snippet below, I want to tweak a dynamic grob created using Shevek's 
> dynText function (cf. 
> http://lists.gnu.org/archive/html/lilypond-user/2017-07/msg00043.html). But 
> unfortunately, tweaks don't seem to affect it.
>
> How can I change the function such that I can still apply tweaks (X-offset, 
> self-alignment-X, etc.) to the combined dynamic-text grob "at runtime"?

> dynText = #(define-event-function (parser location dyn expr)
>  (markup? markup?)
[...]
>#{
>  \tweak DynamicText.X-offset #offset
>  #(make-dynamic-script mark)
>#}
>)
>  )
>
> { c''1-\tweak self-alignment-X #RIGHT \dynText "mp" "test" }
> %%%  SNIPPET ENDS

The tweak applies fine but self-alignment-X is consulted in the normal
callback for X-offset which has been replaced by a callback using the
formula (- 1 (/ width 2)) .  If you want self-alignment-X to be heeded
in there in some manner, you need to incorporate it in the callback for
the offset.

-- 
David Kastrup

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


tweaks don't apply to post-function grob

2017-08-14 Thread Kieren MacMillan
Hi all,

In the snippet below, I want to tweak a dynamic grob created using Shevek's 
dynText function (cf. 
http://lists.gnu.org/archive/html/lilypond-user/2017-07/msg00043.html). But 
unfortunately, tweaks don't seem to affect it.

How can I change the function such that I can still apply tweaks (X-offset, 
self-alignment-X, etc.) to the combined dynamic-text grob "at runtime"?

Thanks,
Kieren. 

%%%  SNIPPET BEGINS
\version "2.19.64"

dynText = #(define-event-function (parser location dyn expr)
 (markup? markup?)
 (let* (
 (mark #{ \markup { \dynamic $dyn \hspace #0.2 \normal-text 
\fontsize #0.625 \italic $expr } #})
 (offset (lambda (grob)
   (let* (
   (layout (ly:grob-layout grob))
   (props (ly:grob-alist-chain grob
(ly:output-def-lookup layout
  'text-font-defaults)))
   (target-X-extent
(ly:stencil-extent

 (ly:text-interface::interpret-markup 
layout props dyn)
 X))
   (width (abs
   (- (cdr target-X-extent) (car 
target-X-extent
   )
 (display target-X-extent)
 (- 1 (/ width 2))
 )
   )
   )
 )
   #{
 \tweak DynamicText.X-offset #offset
 #(make-dynamic-script mark)
   #}
   )
 )

{ c''1-\tweak self-alignment-X #RIGHT \dynText "mp" "test" }
%%%  SNIPPET ENDS



Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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