lilypond-user
[Top][All Lists]
Advanced

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

Re: more custom articulations...


From: Thomas Morley
Subject: Re: more custom articulations...
Date: Fri, 5 Apr 2013 00:50:18 +0200

2013/4/4 luis jure <address@hidden>:
>
> 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



reply via email to

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