\version "2.17.22" % Uncomment the following line to show the skylines. %#(ly:set-option 'debug-skylines) %#(set-global-staff-size 10) % Note: In order to prevent "bleed-over" from one session to another, it is % recommended that .ly files using the following functions be processed % individually (rather than in a batch). %%%%%%%%%%%%%%%%%%%%%%%%%%% CREATE NEW EVENT CLASSES %%%%%%%%%%%%%%%%%%%%%%%%%%% % NOTE: The following definitions work as of version 2.17.22. If you are using % an earlier version, please see % https://codereview.appspot.com/10965043/diff/8001/input/regression/scheme-text-spanner.ly % to make necessary changes. #(define-event-class 'frame-event 'span-event) #(define-event-class 'frame-extender-event 'span-event) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MUSIC DESCRIPTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #(define frame-types '( (FrameEvent . ((description . "Signals where a frame starts and stops.") (types . (general-music frame-event span-event event)) )) )) #(define frame-extender-types '( (FrameExtenderEvent . ((description . "Signals where a frame extender line stops.") (types . (general-music frame-extender-event span-event event)) )) )) #(for-each (lambda (x) (set! x (map (lambda (x) (set-object-property! (car x) 'music-description (cdr (assq 'description (cdr x)))) (let ((lst (cdr x))) (set! lst (assoc-set! lst 'name (car x))) (set! lst (assq-remove! lst 'description)) (hashq-set! music-name-to-property-table (car x) lst) (cons (car x) lst))) x)) (set! music-descriptions (append x music-descriptions))) (list frame-types frame-extender-types)) #(set! music-descriptions (sort music-descriptions alist= (length siblings) 2) (eq? grob (first siblings))) (< (length siblings) 2)) (set! stil (ly:stencil-combine-at-edge stil X LEFT protrusion (- blot)))) ;; Right edge: (if (or (and (>= (length siblings) 2) (eq? grob (last siblings))) (< (length siblings) 2)) (set! stil (ly:stencil-combine-at-edge stil X RIGHT protrusion (- blot)))) ;; Text is only added to the first piece of a broken bracket. Possibly ;; the text should be added in parentheses to the pieces (as in a measure ;; count). 0.5 is a hardcoded padding value which controls the separation ;; between the text and the bracket. (if (or (and (>= (length siblings) 2) (eq? grob (first siblings))) (< (length siblings) 2)) (set! stil (ly:stencil-combine-at-edge stil Y dir text (* 0.5 staff-space)))) stil)) %%%%%%%%%%%%%%%%%%%%%%%%% PURE HEIGHT ESTIMATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % A pure height function is necessary so that the FrameBracket is taken into % account in page-breaking decisions. Without this function, the spacing engine % will fit too many systems on the page. The result is that an error will be % returned and the music will be compressed (regardless of collisions). #(define (frame-bracket-interface::pure-height grob start end) (let* ((text (ly:grob-property grob 'text)) (staff-space (ly:staff-symbol-staff-space grob)) (padding (* (ly:grob-property grob 'padding) staff-space)) (text-padding (* 0.5 staff-space)) ; distance between bracket and text ;; height of bracket "wings" (edge-height (* 1.0 staff-space)) (text-stil (grob-interpret-markup grob (markup text))) (text-stil-ext (ly:stencil-extent text-stil Y))) (cons (- (+ edge-height padding)) (+ text-padding (interval-length text-stil-ext))))) %%%%%%%%%%%%%%%%%%%%%%%%% ADD NEW GROB DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%% #(define (add-grob-definition grob-name grob-entry) (let* ((meta-entry (assoc-get 'meta grob-entry)) (class (assoc-get 'class meta-entry)) (ifaces-entry (assoc-get 'interfaces meta-entry))) (set-object-property! grob-name 'translation-type? list?) (set-object-property! grob-name 'is-grob? #t) (set! ifaces-entry (append (case class ((Item) '(item-interface)) ((Spanner) '(spanner-interface)) ((Paper_column) '((item-interface paper-column-interface))) ((System) '((system-interface spanner-interface))) (else '(unknown-interface))) ifaces-entry)) (set! ifaces-entry (uniq-list (sort ifaces-entry symbol> \layout { %ragged-right = ##t \context { \Global \grobdescriptions #all-grob-descriptions } \context { \Score \remove "Bar_number_engraver" proportionalNotationDuration = #(ly:make-moment 1 4) \override SpacingSpanner #'uniform-stretching = ##t } \context { \Staff \remove "Time_signature_engraver" } \context { \Voice %\override Beam.stencil = ##f %\override Stem.stencil = #point-stencil \consists \frameEngraver } }