X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdefine-grobs.scm;h=9e213c6daad1d7b52ea41877447230a7a13d186f;hb=b0d46fc70caa2d29330ba0fb8102d36515c97b9f;hp=8b9564f41e1776e00814887a7d4516b95dba4465;hpb=a339f8b9865b0f02febd351ba494129d414fb568;p=lilypond.git diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 8b9564f41e..9e213c6daa 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -36,6 +36,7 @@ (Y-extent . ,ly:accidental-interface::height) (meta . ((class . Item) (interfaces . (accidental-interface + inline-accidental-interface font-interface)))))) (AccidentalCautionary @@ -48,6 +49,7 @@ (Y-extent . ,ly:accidental-interface::height) (meta . ((class . Item) (interfaces . (accidental-interface + inline-accidental-interface font-interface)))))) (AccidentalPlacement @@ -78,6 +80,7 @@ (side-axis . ,Y) (staff-padding . 0.25) (stencil . ,ly:accidental-interface::print) + (use-skylines . #t) (X-extent . ,ly:accidental-interface::width) (X-offset . ,(ly:make-simple-closure `(,+ @@ -234,6 +237,7 @@ (break-visibility . ,begin-of-line-visible) (direction . ,UP) + (extra-spacing-width . (+inf.0 . -inf.0)) (font-family . roman) (font-size . -2) (non-musical . #t) @@ -347,6 +351,14 @@ (beaming . ,ly:beam::calc-beaming) (clip-edges . #t) + (collision-interfaces . (beam-interface + clef-interface + flag-interface + inline-accidental-interface + key-signature-interface + note-head-interface + stem-interface + time-signature-interface)) (concaveness . ,ly:beam::calc-concaveness) (cross-staff . ,ly:beam::calc-cross-staff) (damping . 1) @@ -372,15 +384,7 @@ (gap . 0.8) (neutral-direction . ,DOWN) - (positions . ,(ly:make-simple-closure - (ly:make-simple-closure - (list chain-grob-member-functions - `(,cons 0 0) - ly:beam::calc-least-squares-positions - ly:beam::slope-damping - ly:beam::shift-region-to-valid - ly:beam::quanting - )))) + (positions . ,ly:beam::quanting) ;; this is a hack to set stem lengths, if positions is set. (quantized-positions . ,ly:beam::set-stem-lengths) @@ -518,7 +522,7 @@ (key-signature . (minimum-space . 3.5)) (time-signature . (minimum-space . 4.2)) (first-note . (minimum-fixed-space . 5.0)) - (next-note . (extra-space . 0.5)) + (next-note . (extra-space . 1.0)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) (Y-offset . ,ly:staff-symbol-referencer::callback) @@ -584,7 +588,7 @@ (time-signature . (minimum-space . 4.2)) (custos . (minimum-space . 0.0)) (first-note . (minimum-fixed-space . 3.0)) - (next-note . (extra-space . 0.5)) + (next-note . (extra-space . 1.0)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) (Y-offset . ,ly:staff-symbol-referencer::callback) @@ -611,7 +615,7 @@ (key-signature . (minimum-space . 3.5)) (time-signature . (minimum-space . 4.2)) (first-note . (minimum-fixed-space . 5.0)) - (next-note . (extra-space . 0.5)) + (next-note . (extra-space . 1.0)) (right-edge . (extra-space . 0.5)))) (stencil . ,ly:clef::print) (Y-offset . ,ly:staff-symbol-referencer::callback) @@ -795,10 +799,12 @@ (left-bound-info . ,ly:line-spanner::calc-left-bound-info-and-text) + (minimum-length . 2.0) ;; make sure the spanner doesn't get too close to notes (minimum-Y-extent . (-1 . 1)) (right-bound-info . ,ly:line-spanner::calc-right-bound-info) + (springs-and-rods . ,ly:spanner::set-spacing-rods) (stencil . ,ly:line-spanner::print) (style . dashed-line) (meta . ((class . Spanner) @@ -844,7 +850,7 @@ ;; sync with TextScript (?) (avoid-slur . around) - (cross-staff . ,ly:side-position-interface::calc-cross-staff) + (cross-staff . ,script-or-side-position-cross-staff) (direction . ,ly:script-interface::calc-direction) (font-encoding . fetaText) (font-size . -5) ; don't overlap when next to heads. @@ -865,14 +871,27 @@ text-interface text-script-interface)))))) + (Flag + . ( + (stencil . ,ly:flag::print) + (X-extent . ,ly:flag::width) + (X-offset . ,ly:flag::calc-x-offset) + (Y-offset . ,ly:flag::calc-y-offset) + (meta . ((class . Item) + (interfaces . (flag-interface + font-interface)))))) + (FootnoteItem . ( (annotation-balloon . #f) (annotation-line . #t) + (automatically-numbered . ,(grob::calc-property-by-copy 'automatically-numbered)) (break-visibility . ,inherit-y-parent-visibility) + (footnote . #t) (footnote-text . ,(grob::calc-property-by-copy 'footnote-text)) (stencil . ,ly:balloon-interface::print) (text . ,(grob::calc-property-by-copy 'text)) + (X-extent . #f) (Y-extent . #f) (X-offset . ,(grob::calc-property-by-copy 'X-offset)) (Y-offset . ,(grob::calc-property-by-copy 'Y-offset)) @@ -886,10 +905,13 @@ . ( (annotation-balloon . #f) (annotation-line . #t) + (automatically-numbered . ,(grob::calc-property-by-copy 'automatically-numbered)) + (footnote . #t) (footnote-text . ,(grob::calc-property-by-copy 'footnote-text)) - (spanner-placement . LEFT) + (spanner-placement . ,LEFT) (stencil . ,ly:balloon-interface::print-spanner) (text . ,(grob::calc-property-by-copy 'text)) + (X-extent . #f) (Y-extent . #f) (X-offset . ,(grob::calc-property-by-copy 'X-offset)) (Y-offset . ,(grob::calc-property-by-copy 'Y-offset)) @@ -906,6 +928,7 @@ (fret-diagram-details . ((finger-code . below-string))) (stencil . ,fret-board::calc-stencil) (extra-spacing-height . (0.2 . -0.2)) + (extra-spacing-width . (-0.5 . 0.5)) (meta . ((class . Item) (interfaces . (chord-name-interface font-interface @@ -916,16 +939,19 @@ (Glissando . ( (after-line-breaking . ,ly:spanner::kill-zero-spanned-time) - (bound-details . ((right . ((attach-dir . ,CENTER) - (padding . 1.5) + (bound-details . ((right . ((attach-dir . ,LEFT) + (end-on-accidental . #t) + (padding . 0.5) )) - (left . ((attach-dir . ,CENTER) - (padding . 1.5) + (left . ((attach-dir . ,RIGHT) + (padding . 0.5) )) )) (gap . 0.5) (left-bound-info . ,ly:line-spanner::calc-left-bound-info) + (normalized-endpoints . ,ly:spanner::calc-normalized-endpoints) (right-bound-info . ,ly:line-spanner::calc-right-bound-info) + (simple-Y . #t) (stencil . ,ly:line-spanner::print) (style . line) (X-extent . #f) @@ -1058,7 +1084,7 @@ (right-edge . (extra-space . 0.5)) (first-note . (fixed-space . 2.5)))) (stencil . ,ly:key-signature-interface::print) - (extra-spacing-width . (0.0 . 0.5)) + (extra-spacing-width . (0.0 . 1.0)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -1082,7 +1108,7 @@ (right-edge . (extra-space . 0.5)) (first-note . (fixed-space . 2.5)))) (stencil . ,ly:key-signature-interface::print) - (extra-spacing-width . (0.0 . 0.5)) + (extra-spacing-width . (0.0 . 1.0)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) (interfaces . (break-aligned-interface @@ -1156,7 +1182,6 @@ ;; a tuplet bracket. (connect-to-neighbor . ,ly:tuplet-bracket::calc-connect-to-neighbors) - (control-points . ,ly:tuplet-bracket::calc-control-points) (direction . ,UP) (edge-height . (0.7 . 0.7)) (padding . 2.0) @@ -1165,6 +1190,7 @@ (staff-padding . 0.25) (stencil . ,ly:tuplet-bracket::print) (thickness . 1.6) + (X-positions . ,ly:tuplet-bracket::calc-x-positions) (meta . ((class . Spanner) (interfaces . (line-interface tuplet-bracket-interface)))))) @@ -1181,6 +1207,7 @@ (LyricHyphen . ( + (after-line-breaking . ,ly:spanner::kill-zero-spanned-time) (dash-period . 10.0) (height . 0.42) (length . 0.66) @@ -1252,7 +1279,7 @@ (MensuralLigature . ( (stencil . ,ly:mensural-ligature::print) - (thickness . 1.4) + (thickness . 1.3) (meta . ((class . Spanner) (interfaces . (font-interface mensural-ligature-interface)))))) @@ -1277,7 +1304,6 @@ (self-alignment-X . ,LEFT) (break-align-symbols . (time-signature)) (non-break-align-symbols . (multi-measure-rest-interface)) - (non-musical . #t) (meta . ((class . Item) (interfaces . (break-alignable-interface font-interface @@ -1290,12 +1316,14 @@ . ( (expand-limit . 10) (hair-thickness . 2.0) + (round-up-exceptions . ()) (padding . 1) (spacing-pair . (break-alignment . break-alignment)) (springs-and-rods . ,ly:multi-measure-rest::set-spacing-rods) - (staff-position . 0) (stencil . ,ly:multi-measure-rest::print) (thick-thickness . 6.6) + ;; See Wanske pp. 125 + (usable-duration-logs . ,(iota 4 -3)) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Spanner) (interfaces . (font-interface @@ -1397,6 +1425,7 @@ (NoteColumn . ( (axes . (,X ,Y)) + (bound-alignment-interfaces . (rhythmic-head-interface stem-interface)) (horizontal-skylines . ,ly:separation-item::calc-skylines) (skyline-vertical-padding . 0.15) (X-extent . ,ly:axis-group-interface::width) @@ -1423,6 +1452,7 @@ (interfaces . (font-interface gregorian-ligature-interface ledgered-interface + ligature-head-interface mensural-ligature-interface note-head-interface rhythmic-grob-interface @@ -1500,6 +1530,7 @@ (allow-loose-spacing . #t) (axes . (,X)) (before-line-breaking . ,ly:paper-column::before-line-breaking) + (bound-alignment-interfaces . (note-column-interface)) (horizontal-skylines . ,ly:separation-item::calc-skylines) (keep-inside-line . #t) ;; (stencil . ,ly:paper-column::print) @@ -1572,6 +1603,7 @@ (height-limit . 2.0) (minimum-length . 1.5) (ratio . 0.333) + (spanner-id . "") (springs-and-rods . ,ly:spanner::set-spacing-rods) (stencil . ,ly:slur::print) (thickness . 1.1) @@ -1693,9 +1725,11 @@ (side-axis . ,Y) ;; padding set in script definitions. + (slur-padding . 0.2) (staff-padding . 0.25) (stencil . ,ly:script-interface::print) + (use-skylines . #t) (X-offset . ,script-interface::calc-x-offset) (Y-offset . ,ly:side-position-interface::y-aligned-side) (meta . ((class . Item) @@ -1726,6 +1760,7 @@ (line-thickness . 0.8) (minimum-length . 1.5) (ratio . 0.25) + (spanner-id . "") (springs-and-rods . ,ly:spanner::set-spacing-rods) (stencil . ,ly:slur::print) (thickness . 1.2) @@ -1801,14 +1836,22 @@ (non-musical . #t) (stencil . ,ly:span-bar::print) (X-extent . ,ly:span-bar::width) - (Y-extent . ,ly:axis-group-interface::height) + (Y-extent . #f) (meta . ((class . Item) - (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common) - (pure-relevant-grobs . ,ly:axis-group-interface::calc-pure-relevant-grobs))) (interfaces . (bar-line-interface font-interface span-bar-interface)))))) + (SpanBarStub + . ( + (elements-filtered . ,ly:pure-from-neighbor-interface::filter-elements) + (X-extent . ,grob::x-parent-width) + (Y-extent . ,span-bar-stub::height) + (meta . ((class . Item) + (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common) + (pure-relevant-grobs . ,ly:axis-group-interface::calc-pure-relevant-grobs))) + (interfaces . (pure-from-neighbor-interface)))))) + (StaffGrouper . ( (staff-staff-spacing . ((basic-distance . 9) @@ -1893,12 +1936,11 @@ (direction . ,ly:stem::calc-direction) (duration-log . ,stem::calc-duration-log) - (flag . ,ly:stem::calc-flag) - (length . ,ly:stem::calc-length) + (length . ,stem::length) (neutral-direction . ,DOWN) (positioning-done . ,ly:stem::calc-positioning-done) - (stem-end-position . ,ly:stem::calc-stem-end-position) (stem-info . ,ly:stem::calc-stem-info) + (stem-begin-position . ,ly:stem::calc-stem-begin-position) (stencil . ,ly:stem::print) (thickness . 1.3) (X-extent . ,ly:stem::width) @@ -1906,8 +1948,7 @@ (Y-extent . ,ly:stem::height) (Y-offset . ,ly:staff-symbol-referencer::callback) (meta . ((class . Item) - (interfaces . (font-interface - stem-interface)))))) + (interfaces . (stem-interface)))))) (StemTremolo . ( @@ -1917,13 +1958,14 @@ (stencil . ,ly:stem-tremolo::print) (style . ,ly:stem-tremolo::calc-style) (X-extent . ,ly:stem-tremolo::width) - (Y-extent . ,ly:stem-tremolo::height) + (Y-offset . ,ly:stem-tremolo::calc-y-offset) (meta . ((class . Item) (interfaces . (stem-tremolo-interface)))))) (StringNumber . ( (avoid-slur . around) + (cross-staff . ,script-or-side-position-cross-staff) (font-encoding . fetaText) (font-size . -5) ; don't overlap when next to heads. (padding . 0.5) @@ -2108,7 +2150,7 @@ (TextScript . ( (avoid-slur . around) - (cross-staff . ,ly:script-interface::calc-cross-staff) + (cross-staff . ,script-or-side-position-cross-staff) (direction . ,DOWN) (extra-spacing-width . (+inf.0 . -inf.0)) (outside-staff-priority . 450) @@ -2216,6 +2258,7 @@ (break-align-anchor-alignment . ,LEFT) (break-visibility . ,all-visible) (extra-spacing-height . (-1.0 . 1.0)) + (extra-spacing-width . (0.0 . 0.8)) (non-musical . #t) (space-alist . ( (cue-clef . (extra-space . 1.5)) @@ -2242,6 +2285,7 @@ (meta . ((class . Item) (interfaces . (accidental-interface font-interface + inline-accidental-interface side-position-interface trill-pitch-accidental-interface)))))) @@ -2307,7 +2351,6 @@ (TupletBracket . ( (connect-to-neighbor . ,ly:tuplet-bracket::calc-connect-to-neighbors) - (control-points . ,ly:tuplet-bracket::calc-control-points) (cross-staff . ,ly:tuplet-bracket::calc-cross-staff) (direction . ,ly:tuplet-bracket::calc-direction) (edge-height . (0.7 . 0.7)) @@ -2318,6 +2361,7 @@ (staff-padding . 0.25) (stencil . ,ly:tuplet-bracket::print) (thickness . 1.6) + (X-positions . ,ly:tuplet-bracket::calc-x-positions) (meta . ((class . Spanner) (interfaces . (line-interface @@ -2327,10 +2371,13 @@ . ( (avoid-slur . inside) (cross-staff . ,ly:tuplet-number::calc-cross-staff) + (direction . ,tuplet-number::calc-direction) (font-shape . italic) (font-size . -2) (stencil . ,ly:tuplet-number::print) (text . ,tuplet-number::calc-denominator-text) + (X-offset . ,ly:tuplet-number::calc-x-offset) + (Y-offset . ,ly:tuplet-number::calc-y-offset) (meta . ((class . Spanner) (interfaces . (font-interface text-interface @@ -2550,6 +2597,13 @@ ly:note-head::print ly:dots::print ly:clef::print + ly:flag::print + default-flag + normal-flag + mensural-flag + no-flag + modern-straight-flag + old-straight-flag ly:key-signature-interface::print ly:percent-repeat-item-interface::beat-slash ly:text-interface::print @@ -2565,6 +2619,7 @@ (,ly:arpeggio::brew-chord-bracket . ,ly:arpeggio::pure-height) (,ly:arpeggio::brew-chord-slur . ,ly:arpeggio::pure-height) (,ly:hairpin::print . ,ly:hairpin::pure-height) + (,ly:stem-tremolo::print . ,ly:stem-tremolo::pure-height) (,ly:volta-bracket-interface::print . ,volta-bracket-interface::pure-height))) ;; ly:grob::stencil-extent is safe if the print callback is safe too @@ -2590,6 +2645,7 @@ (,ly:accidental-interface::height . ,ly:accidental-interface::pure-height) (,ly:axis-group-interface::calc-staff-staff-spacing . ,ly:axis-group-interface::calc-pure-staff-staff-spacing) (,ly:axis-group-interface::height . ,ly:axis-group-interface::pure-height) + (,ly:beam::rest-collision-callback . ,ly:beam::pure-rest-collision-callback) (,ly:grob::stencil-height . ,pure-stencil-height) (,ly:hara-kiri-group-spanner::y-extent . ,ly:hara-kiri-group-spanner::pure-height) (,ly:rest-collision::force-shift-callback-rest . ,pure-chain-offset-callback) @@ -2598,13 +2654,19 @@ (,ly:side-position-interface::y-aligned-side . ,ly:side-position-interface::pure-y-aligned-side) (,ly:slur::height . ,ly:slur::pure-height) (,ly:slur::outside-slur-callback . ,ly:slur::pure-outside-slur-callback) + (,span-bar-stub::height . ,ly:axis-group-interface::pure-height) + (,ly:stem::calc-stem-begin-position . ,ly:stem::pure-calc-stem-begin-position) + (,ly:stem::calc-stem-end-position . ,ly:stem::pure-calc-stem-end-position) + (,stem::length . ,stem::pure-length) (,ly:stem::height . ,ly:stem::pure-height) + (,ly:stem-tremolo::calc-y-offset . ,ly:stem-tremolo::pure-calc-y-offset) (,ly:system::height . ,ly:system::calc-pure-height))) (define pure-functions (list parenthesize-elements laissez-vibrer::print + ly:flag::calc-y-offset ly:rest::y-offset-callback ly:staff-symbol-referencer::callback ly:staff-symbol::height)) @@ -2613,6 +2675,7 @@ (let ((extent-callback (ly:grob-property-data grob 'Y-extent))) (not (eq? #f (or + (ly:unpure-pure-container? extent-callback) (pair? extent-callback) (memq extent-callback pure-functions) (and @@ -2624,16 +2687,29 @@ (assq stencil pure-print-to-height-conversions) (ly:stencil? stencil))))))))) +;; hideous code dup below - to be cleaned up when call pure functino +;; is eliminated and lilypond works entirely from unpure-pure-containers + (define-public (call-pure-function unpure args start end) - (if (ly:simple-closure? unpure) - (ly:eval-simple-closure (car args) unpure start end) - (if (not (procedure? unpure)) - unpure - (if (memq unpure pure-functions) - (apply unpure args) - (let ((pure (assq unpure pure-conversions-alist))) - (if pure - (apply (cdr pure) - (append - (list (car args) start end) - (cdr args))))))))) + (if (ly:unpure-pure-container? unpure) + (let ((unpure (ly:unpure-pure-container-pure-part unpure))) + (if (ly:simple-closure? unpure) + (ly:eval-simple-closure (car args) unpure start end) + (if (not (procedure? unpure)) + unpure + (apply unpure + (append + (list (car args) start end) + (cdr args)))))) + (if (ly:simple-closure? unpure) + (ly:eval-simple-closure (car args) unpure start end) + (if (not (procedure? unpure)) + unpure + (if (memq unpure pure-functions) + (apply unpure args) + (let ((pure (assq unpure pure-conversions-alist))) + (if pure + (apply (cdr pure) + (append + (list (car args) start end) + (cdr args))))))))))