Hi Kieren and all, On Fri, May 1, 2015 at 3:28 PM, Kieren MacMillan < kieren_macmil...@sympatico.ca> wrote:
> Hi David, > > This looks pretty amazing so far — thanks for the great work! > > When I try to apply it to a score with edition-engraver tweaks, it doesn’t > seem to colour anything tweaked using the EE. > It does seem to colour things tweaked otherwise (e.g., in the “content”). > > Maybe I’m doing something wrong? I’m simply using > > \colorOverride \theScore > I expected this. You won't see any coloring for overrides from a \context block, and for overrides that come about through \voiceOne/\voiceTwo ... (though you can make these appear by commenting out line 28 (put a semicolon in front of it). Would you mind trying an extremely small score with the edition-engraver, something like (however you would set it up) \displayMusic { \override NoteHead.font-size = 2 c'' } (1) Does the font-size override show up in the console output? (2) If it does, is there an entry for 'grob-property-path? (If there is, commenting out the line mentioned above will work, though you may get stuff you don't care about like the overrides that are predefined for voices) %%%% In other news: **Attached please find a version that handles tweaks and overrides. It will also deal with \temporary, too.** The colors for tweaks and overrides are controlled by variables at the top of the file. It would be helpful to me if people could try it out with larger scores to see how it fares! Enjoy, David
\version "2.19.17" #(define (remove-first symbol alist) (let loop ((alist alist) (result '())) (cond ((null? alist) result) ((eq? (caar alist) symbol) (append result (cdr alist))) (else (loop (cdr alist) (append result (car alist))))))) #(define (grobs-with-stencils) (let loop ((all all-grob-descriptions) (result '())) (if (null? all) result (if (assoc-get 'stencil (cdar all)) (loop (cdr all) (cons (caar all) result)) (loop (cdr all) result))))) #(define (mark-tweak grob) (let* ((default (assoc-get (grob::name grob) all-grob-descriptions)) (after-line-return (assoc-get 'after-line-breaking default)) (props (ly:grob-basic-properties grob)) ;; Our procedure has been added to the head of grob's basic ;; properties. Let's not count it as a tweak! (props (remove (lambda (p) (and (procedure? (cdr p)) (eq? (procedure-name (cdr p)) 'mark-tweak))) props)) ;; Yuck. We should remove the _last_ entry in the alist. Good ;; enough for now. Just don't override Clef.glyph. (props (if (eq? (grob::name grob) 'Clef) (remove-first 'glyph props) props)) (diff (lset-difference eq? props default))) ;; Tweaks will not appear in the "basic properties" alist of our grob, but ;; we can find them through the music event which led to the grob. This ;; is available through the stream-event which caused our grob. (if (null? diff) (let* ((cause (event-cause grob)) (tweaks (and cause (ly:music-property (ly:event-property cause 'music-cause) 'tweaks)))) (if (pair? tweaks) (set! (ly:grob-property grob 'color) red))) (set! (ly:grob-property grob 'color) green)) ;; Return any default setting of after-line-breaking. after-line-return)) markAllAlteredGrobs = #(define-music-function (parser location) () (let loop ((grobs (grobs-with-stencils))) (if (null? grobs) #{ #} #{ \override #(list 'Score (car grobs) 'after-line-breaking) = #mark-tweak #(loop (cdr grobs)) #}))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \displayMusic { \voiceOne \once \override Staff.Clef.extra-offset = #'(0 . 2) c^"hi"_1 \clef "bass_8" c, \oneVoice \key d \major c, } \layout { \context { \Score \markAllAlteredGrobs } }
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user