]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
Scheme function to return a grob's name
[lilypond.git] / scm / output-lib.scm
index 1e40e19f667293cb8ab3c9348919093fd52f5fe5..7f956a54d574549efbf360575efc782ad817fb67 100644 (file)
 (define-public (grob::is-live? grob)
   (pair? (ly:grob-basic-properties grob)))
 
+(define-public (grob::name grob)
+  "Return the name of the grob @var{grob} as a symbol."
+  (assq-ref (ly:grob-property grob 'meta) 'name))
+
 (define-public (make-stencil-boxer thickness padding callback)
   "Return function that adds a box around the grob passed as argument."
   (lambda (grob)
@@ -1157,17 +1161,20 @@ parent or the parent has no setting."
 
 (define-public (script-interface::calc-x-offset grob)
   (ly:grob-property grob 'positioning-done)
-  (let* ((shift (ly:grob-property grob 'toward-stem-shift 0.0))
+  (let* ((shift-when-alone (ly:grob-property grob 'toward-stem-shift 0.0))
+         (shift-in-column (ly:grob-property grob 'toward-stem-shift-in-column))
+         (script-column (ly:grob-object grob 'script-column))
+         (shift (if (and (ly:grob? script-column) (number? shift-in-column))
+                    shift-in-column shift-when-alone))
          (note-head-location
           (ly:self-alignment-interface::aligned-on-x-parent grob))
          (note-head-grob (ly:grob-parent grob X))
          (stem-grob (ly:grob-object note-head-grob 'stem)))
 
     (+ note-head-location
-       ;; If the property 'toward-stem-shift is defined and the script
-       ;; has the same direction as the stem, move the script accordingly.
-       ;; Since scripts can also be over skips, we need to check whether
-       ;; the grob has a stem at all.
+       ;; If the script has the same direction as the stem, move the script
+       ;; in accordance with the value of 'shift'.  Since scripts can also be
+       ;; over skips, we need to check whether the grob has a stem at all.
        (if (ly:grob? stem-grob)
            (let ((dir1 (ly:grob-property grob 'direction))
                  (dir2 (ly:grob-property stem-grob 'direction)))
@@ -1364,7 +1371,7 @@ parent or the parent has no setting."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; measure counter
 
-(define (measure-counter-stencil grob)
+(define-public (measure-counter-stencil grob)
   "Print a number for a measure count.  The number is centered using
 the extents of @code{BreakAlignment} grobs associated with the left and
 right bounds of a @code{MeasureCounter} spanner.  Broken measures are