more custom articulations...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

more custom articulations...

luis jure

hello list,

with the help of the code provided by harm, i've been able to create my
own custom articulations, but i still have some problems i haven't been
able to solve on my own. the two more important right now are:

1.

studying script.scm i see that in the definition of each articulation
there's an expression of this form:

(script-stencil . (feta . ("lcomma" . "rcomma"))

is it possible to define an articulation using glyphs other than the
script glyphs? i mean glyphs in the feta font but belonging to arrowheads
or noteheads or flags or whatever.


2.

following harm's code, i learned to define articulations using a previously
defined custom stencil, thus:

(stencil . ,my-crazy-stil)

what i can't figure out is how can i define a pair of glyphs, to be used
for up- and down-stem notes, as in the default lilypond articulations
above?


thanks for any pointers.



best,


lj

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: more custom articulations...

Thomas Morley
2013/4/4 luis jure <[hidden email]>:

>
> hello list,
>
> with the help of the code provided by harm, i've been able to create my
> own custom articulations, but i still have some problems i haven't been
> able to solve on my own. the two more important right now are:
>
> 1.
>
> studying script.scm i see that in the definition of each articulation
> there's an expression of this form:
>
> (script-stencil . (feta . ("lcomma" . "rcomma"))
>
> is it possible to define an articulation using glyphs other than the
> script glyphs? i mean glyphs in the feta font but belonging to arrowheads
> or noteheads or flags or whatever.

I don't think so.

Quoting script-interface.cc:

Stencil
Script_interface::get_stencil (Grob *me, Direction d)
{
  SCM s = me->get_property ("script-stencil");
  assert (scm_is_pair (s));

  SCM key = scm_car (s);
  if (key == ly_symbol2scm ("feta"))
    {
      SCM name_entry = scm_cdr (s);
      SCM str = ((scm_is_pair (name_entry)) ? index_get_cell (name_entry, d)
                 : name_entry);
      return Font_interface::get_default_font (me)
             ->find_by_name ("scripts." + ly_scm2string (str));
    }
  else
    assert (false);

  return Stencil ();
}

Although I dont know C++ it seems to be clear that only glyphs from
feta with the scripts-prefix are allowed.
Here I've to drop the ball.

Therefore my use of stencil, _not_ script-stencil.

> 2.
>
> following harm's code, i learned to define articulations using a previously
> defined custom stencil, thus:
>
> (stencil . ,my-crazy-stil)
>
> what i can't figure out is how can i define a pair of glyphs, to be used
> for up- and down-stem notes, as in the default lilypond articulations
> above?

If you know the script-direction it is no problem.
Though, afaik, you _don't_ know it at the time the stencils are read.
I think the "Script_engraver" knows the direction and chooses the
correct glyph to create the correct Script-type.
But again, this is done after direction is known, I found no way to
create a stencil _and_ to get the direction from somewhere.

At least if you want  the stencil to be inserted in
default-script-alist, it _is_ possible to override Script-stencil
afterwards, sth like:
<not-working-pseudo-code>
\override Script #'stencil =
  (let ((dir (ly:grob-property grob 'direction)))
    (if (= dir 1)
        stencil-1
        stencil-2)))

Though, with this it would be superfluous to deal with default-script-alist.

> thanks for any pointers.
>
>
>
> best,
>
>
> lj

Sorry, to be of not ore help,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: more custom articulations...

ArnoldTheresius
Thomas Morley wrote
2013/4/4 luis jure <[hidden email]>:
...
> 2.
>
> following harm's code, i learned to define articulations using a previously
> defined custom stencil, thus:
>
> (stencil . ,my-crazy-stil)
>
> what i can't figure out is how can i define a pair of glyphs, to be used
> for up- and down-stem notes, as in the default lilypond articulations
> above?
...
> lj
..._______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Hello lj,

in the LSR "bold tenuto" (http://lsr.dsi.unimi.it/LSR/Item?id=858) you will find the exapmple of a global override of Script #stencil by a function which checks for which articulation type return a user defined stencil (direction dependent), and for all other articulations this function returns LILYPOND's default stencil function result.

ArnoldTheresius
Reply | Threaded
Open this post in threaded view
|

Re: more custom articulations...

Thomas Morley
2013/4/5 ArnoldTheresius <[hidden email]>:

> Thomas Morley wrote
>> 2013/4/4 luis jure &lt;
>
>> ljc@.com
>
>> &gt;:
>> ...
>>> 2.
>>>
>>> following harm's code, i learned to define articulations using a
>>> previously
>>> defined custom stencil, thus:
>>>
>>> (stencil . ,my-crazy-stil)
>>>
>>> what i can't figure out is how can i define a pair of glyphs, to be used
>>> for up- and down-stem notes, as in the default lilypond articulations
>>> above?
>> ...
>>> lj
>> ..._______________________________________________
>> lilypond-user mailing list
>
>> lilypond-user@
>
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> Hello lj,
>
> in the LSR "bold tenuto" (http://lsr.dsi.unimi.it/LSR/Item?id=858) you will
> find the exapmple of a global override of Script #stencil by a function
> which checks for which articulation type return a user defined stencil
> (direction dependent), and for all other articulations this function returns
> LILYPOND's default stencil function result.

Yep.
I completely forgot about it (and it was me, who appoved it :) )
Though, this is an override _after_ the stencil is created (as
mentioned in my previous mail).

-Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: more custom articulations...

luis jure
In reply to this post by Thomas Morley

on 2013-04-05 at 00:50 Thomas Morley wrote:

> Quoting script-interface.cc:
>
> Stencil
> Script_interface::get_stencil (Grob *me, Direction d)
> {
>   SCM s = me->get_property ("script-stencil");
>   assert (scm_is_pair (s));
>
>   SCM key = scm_car (s);
>   if (key == ly_symbol2scm ("feta"))
>     {
>       SCM name_entry = scm_cdr (s);
>       SCM str = ((scm_is_pair (name_entry)) ? index_get_cell
> (name_entry, d) : name_entry);
>       return Font_interface::get_default_font (me)
>              ->find_by_name ("scripts." + ly_scm2string (str));
>     }

hmm, i see that selecting from the "scripts." glyphs is "hardcoded", which
makes sense for standard articulations, of course. i wonder if could try
to modify it and still make it work...

anyway, reading the code i noticed an option that i had missed completely
when reading the docs: toward-stem-shift. this solves many of my problems.


> Sorry, to be of not ore help,

quite the contrary, you've been most helpful, as always. thank you.


best,

lj





_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: more custom articulations...

luis jure
In reply to this post by ArnoldTheresius

on 2013-04-05 at 00:58 ArnoldTheresius wrote:

> in the LSR "bold tenuto" (http://lsr.dsi.unimi.it/LSR/Item?id=858) you
> will find the exapmple of a global override of Script #stencil

great link, thank you, i hadn't checked the LSR.

i can't use this function in my case (at least i don't see how), but the
example is most instructive.

best,


lj


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user