lilypond-user
[Top][All Lists]
Advanced

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

Re: Grouping grobs


From: Jean Abou Samra
Subject: Re: Grouping grobs
Date: Wed, 17 Aug 2022 10:25:06 +0200



Le 16 août 2022 à 21:14, lilypond@lists.johnteskemusic.com a écrit :


Of course, happy to give more context. I primarily write graphic scores (but with western notation symbols). The score isn't always static, so I want to be able to manipulate fragments of music after generation.

In the past I have used my own program to place glyphs programmatically, which requires that I create my own notation<>glyph mappings and to have the engraving font installed/available to whoever views it.

When I saw that Lilypond produces shapes in SVG output, not glyphs, I was intrigued--and leveraging Lilypond's input over my own mapping is appealing as well.

I suppose one answer is keep my current system and outline the glyphs like Lilypond may be doing under the hood. Another is to make and group selections based on position, not an id attribute, from the current Lilypond output.



Thanks both for your explanations. Is it not possible to use attributes without collapsing different <g> tags into one? John, you have a command that does not work in a comment in your original example, and it does not work because markups are a standalone system for creating any graphics you like, where there are no grobs, but it is possible to implement a markup command that sets attributes as well. Untested (I’m on vacation), but I think this should work:

#(define-markup-command (with-output-attributes attrs arg) (list? markup?)
   (let ((stil (interpret-markup layout props arg)))
     (ly:make-stencil (list 'output-attributes attrs (ly:stencil-expr stil))
                                 (ly:stencil-extent stil X) (ly:stencil-extent stil Y))))


\markup \combine a \with-output-attributes #'((mylayer . 4)) { b c }






Hi,

I'm new to Lilypond and am trying to generate SVG output for use elsewhere. In general I'd like to create fragments of music and add ids to each group. So far I've seen that each grob is output as its own <g>--is there a way to group at a higher level, say markup, staff, etc.?

John
\version "2.22.2"
\markup {
    % with SVG output this is two <g>: notehead and dot
    % \override NoteHead.output-attributes.id = 123
    \note {4.} #0
}

There isn’t a simple way to do this. I wonder what leads you to this question, though. Could you explain the purpose for which you would like this type of output? There may be a different way to solve your problem. See also: https://en.m.wikipedia.org/wiki/XY_problem


reply via email to

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