X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Foutput-lib.scm;h=0fbe9ee3c9ac086e682f3cc64c655d3ce5e00b33;hb=479fbddde9cc570b54e7be5798162ada05f279a2;hp=219a287cd1d55c921442f2419bfd3dc0a981731e;hpb=6d451df53791b15dc4707694deb3622b33299997;p=lilypond.git diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 219a287cd1..0fbe9ee3c9 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -56,6 +56,15 @@ (ly:text-interface::interpret-markup layout props text))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; cross-staff stuff + +(define-public (script-or-side-position-cross-staff g) + (or + (ly:script-interface::calc-cross-staff g) + (ly:side-position-interface::calc-cross-staff g))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; note heads @@ -63,6 +72,22 @@ (ly:duration-log (ly:event-property (event-cause grob) 'duration))) +(define-public (stem::length grob) + (let* ((ss (ly:staff-symbol-staff-space grob)) + (beg (ly:grob-property grob 'stem-begin-position)) + (beam (ly:grob-object grob 'beam))) + (if (null? beam) + (abs (- (ly:stem::calc-stem-end-position grob) beg)) + (begin + (ly:programming-error + "stem::length called but will not be used for beamed stem.") + 0.0)))) + +(define-public (stem::pure-length grob beg end) + (let* ((ss (ly:staff-symbol-staff-space grob)) + (beg (ly:grob-pure-property grob 'stem-begin-position 0 1000))) + (abs (- (ly:stem::pure-calc-stem-end-position grob 0 2147483646) beg)))) + (define-public (note-head::calc-duration-log grob) (min 2 (ly:duration-log @@ -120,6 +145,14 @@ and duration-log @var{log}." (if (< log 0) (string-append (number->string log) "mensural") (string-append (number->string log) (symbol->string style)))) + ((blackpetrucci) + (if (< log 0) + (string-append (number->string log) "blackmensural") + (string-append (number->string log) (symbol->string style)))) + ((semipetrucci) + (if (< log 0) + (string-append (number->string log) "semimensural") + (string-append (number->string log) "petrucci"))) ((neomensural) (string-append (number->string log) (symbol->string style))) (else @@ -236,6 +269,9 @@ and duration-log @var{log}." (define-public (inherit-x-parent-visibility grob) (let ((parent (ly:grob-parent grob X))) (ly:grob-property parent 'break-visibility all-invisible))) +(define-public (inherit-y-parent-visibility grob) + (let ((parent (ly:grob-parent grob X))) + (ly:grob-property parent 'break-visibility))) (define-public spanbar-begin-of-line-invisible #(#t #f #f)) @@ -313,13 +349,16 @@ and duration-log @var{log}." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Tuplets +(define-public (tuplet-number::calc-direction grob) + (ly:tuplet-bracket::calc-direction (ly:grob-object grob 'bracket))) + (define-public (tuplet-number::calc-denominator-text grob) (number->string (ly:event-property (event-cause grob) 'denominator))) (define-public (tuplet-number::calc-fraction-text grob) (let ((ev (event-cause grob))) - (format "~a:~a" + (format #f "~a:~a" (ly:event-property ev 'denominator) (ly:event-property ev 'numerator)))) @@ -349,7 +388,7 @@ and duration-log @var{log}." (den (if denominator denominator (ly:event-property ev 'denominator))) (num (if numerator numerator (ly:event-property ev 'numerator)))) - (format "~a:~a" den num))) + (format #f "~a:~a" den num))) ;; Print a tuplet fraction with note durations appended to the numerator and the ;; denominator @@ -371,10 +410,10 @@ and duration-log @var{log}." (num (if numerator numerator (ly:event-property ev 'numerator)))) (make-concat-markup (list - (make-simple-markup (format "~a" den)) + (make-simple-markup (format #f "~a" den)) (markup #:fontsize -5 #:note denominatornote UP) (make-simple-markup " : ") - (make-simple-markup (format "~a" num)) + (make-simple-markup (format #f "~a" num)) (markup #:fontsize -5 #:note numeratornote UP))))) @@ -453,6 +492,25 @@ and duration-log @var{log}." (+ c0 p)))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; annotations + +(define-public (numbered-footnotes int) + (markup #:tiny (number->string (+ 1 int)))) + +(define-public (symbol-footnotes int) + (define (helper symbols out idx n) + (if (< n 1) + out + (helper symbols + (string-append out (list-ref symbols idx)) + idx + (- n 1)))) + (markup #:tiny (helper '("*" "†" "‡" "§" "¶") + "" + (remainder int 5) + (+ 1 (quotient int 5))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; accidentals @@ -578,7 +636,7 @@ and duration-log @var{log}." (ly:stencil-translate-axis rp (+ (cdr x-ext) padding) X)))) -(define (parentheses-item::print me) +(define-public (parentheses-item::print me) (let* ((elts (ly:grob-object me 'elements)) (y-ref (ly:grob-common-refpoint-of-array me elts Y)) (x-ref (ly:grob-common-refpoint-of-array me elts X))