lilypond-user
[Top][All Lists]
Advanced

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

Re: Stencil questions (adding text and defining line style)


From: Nathan Ho
Subject: Re: Stencil questions (adding text and defining line style)
Date: Wed, 21 Sep 2016 14:43:22 -0700
User-agent: Roundcube Webmail/1.1.2

On 2016-09-21 11:49, Urs Liska wrote:

Concretely I want to add a text element at a certain position to a
  (ly:stencil-add
construction.

Hi Urs,

grob-interpret-markup is the way to create text. You can position it with ly:stencil-translate, and add it to another stencil using ly:stencil-add:

(ly:stencil-add
  your-current-stencil
  (ly:stencil-translate
    (grob-interpret-markup
      grob
      (markup "Hey"))
    '(2 . 3)))

ly:stencil-combine-at-edge is also really handy if you want to position a stencil relative to bounding box of another one, like "place this thing vertically centered so its left edge is 0.1 staff spaces away from the right edge of this other thing."

The other thing I didn't find is: how can I create a dashed (or
otherwise styled) line stencil with make-line-stencil?

I don't think it's possible, but you can use draw-dashed-line / draw-dotted-line in a grob-interpret-markup.

More generally: how can I learn more about these things? Searching
lilypond.org seems to only point to snippets and no real explanations.

I've generally relied on examining examples in the LSR to learn about this sort of thing. The "Scheme functions" section of the Notation and Internals manuals is helpful, but a lot of the functions are not clearly documented, and they're definitely not presented in a manner that's conducive to step-by-step learning.

Since it's pretty tough to use stencils, as you can see I resort a lot to markups. They're not the perfect solution, but they're better documented and easier to use.


Nathan



reply via email to

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