lilypond-user
[Top][All Lists]
Advanced

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

Merging paper blocks


From: Urs Liska
Subject: Merging paper blocks
Date: Thu, 22 Mar 2018 16:22:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi all,

some time ago I got assistance for merging layout blocks that were stored in a list. The code I used (and which works, although I don't fully understand it) is something like this:

    ((layout-diffs
      (append-map
       (lambda (output-def)
         (lset-difference
          equal?
          (ly:output-find-context-def output-def)
          (ly:output-find-context-def $defaultlayout)))
       (a-list-holding-multiple-layout-expressions)))

    ;; apply `diff' to the default layout
    (for-each
     (lambda (x)
       (ly:output-def-set-variable! $defaultlayout (car x) (cdr x)))
     layout-diffs)

(I understand the concept of stripping the diffs from the layout expressions against the default layout and then applying each modification in turn. What I don't understand is that lupon inspection 'layout-diffs' seems to hold one expression for each *context modification* that isn't present in the default layout. So in my case there is one item for FiguredBass (which I understand), but no one for e.g. Voice or Staff (which I don't understand because there *are* corresponding entries in the layout blocks.)

Is there a similar approach to merge \paper {} blocks? I need this to create hierarchical styles (no, not for GSoC, but the experience should be transferable). When a \paper {} block is defined in a "common" file and then again in a "special" file (e.g. for "score" or "part") the later simply replaces the former. What I need is a way to store a \paper block in a variable and then update it with individual settings from other paper blocks.

Any pointers would be appreciated!
Urs



reply via email to

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