]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
* scm/define-grobs.scm (all-grob-descriptions): reorganize in
[lilypond.git] / scm / output-lib.scm
index 9b24de88ecef092e4925259dc34dae2ba14ad046..5ef27d02c2c450985e659ee3e432798ad221fc0e 100644 (file)
 ;; The TabNoteHead tablatureFormat callback.
 ;; Compute the text grob-property
 (define-public (fret-number-tablature-format string tuning pitch)
-  (number->string
-   (- (ly:pitch-semitones pitch)
-      (list-ref tuning
-               ;; remove 1 because list index starts at 0 and guitar string at 1. 
-                (- string 1)))))
+  (make-whiteout-markup
+   (make-vcenter-markup  
+    (number->string
+     (- (ly:pitch-semitones pitch)
+       (list-ref tuning
+                 ;; remove 1 because list index starts at 0 and guitar string at 1. 
+                 (- string 1)))))))
 
 ;; The 5-string banjo has got a extra string, the fifth (duh), wich
 ;; starts at the fifth fret on the neck. Frets on the fifth string
 ;;   on the banjo neck.
 ;; We solve this by defining a new fret-number-tablature function:
 (define-public (fret-number-tablature-format-banjo string tuning pitch)
+  (make-whiteout-markup
+   (make-vcenter-markup  
     (let ((fret (- (ly:pitch-semitones pitch) (list-ref tuning (- string 1)))))
-        (number->string (cond
-            ((and (> fret 0) (= string 5))
-                (+ fret 5))
-            (else fret)))))
+      (number->string (cond
+                      ((and (> fret 0) (= string 5))
+                       (+ fret 5))
+                      (else fret)))))))
 
 (define-public (hammer-print-function grob)
   (let* ((note-collums (ly:grob-property grob 'note-columns))
@@ -278,3 +282,20 @@ centered, X==1 is at the right, X == -1 is at the left."
 (define-public darkcyan    '(0.5 0.5 0.0))
 (define-public darkmagenta '(0.5 0.0 0.5))
 (define-public darkyellow  '(0.0 0.5 0.5))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Pitch Trill Heads
+
+(define (parenthesize-elements grob)
+  (let*
+      ((elts (ly:grob-property grob 'elements))
+       (x-ext (ly:relative-group-extent elts grob X))
+       (font (ly:grob-default-font grob))
+       (lp (ly:font-get-glyph font "accidentals.leftparen"))
+       (rp (ly:font-get-glyph font "accidentals.rightparen"))
+       (padding 0.1))
+
+    (ly:stencil-add
+     (ly:stencil-translate-axis lp (- (car x-ext) padding) X)
+     (ly:stencil-translate-axis rp (+ (cdr x-ext) padding) X))
+  ))