]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix fret diagram xo string offsets
authorCarl Sorensen <c_sorensen@byu.edu>
Thu, 14 May 2009 11:58:19 +0000 (05:58 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Thu, 14 May 2009 12:39:14 +0000 (06:39 -0600)
scm/fret-diagrams.scm

index a37c490aa9880facbe4b49ac787a4bd0a2a296b1..992c94941aa1ddd8e29c39e89ed516a768e05849 100644 (file)
@@ -293,6 +293,19 @@ with magnification @var{mag} of the string @var{text}."
         (else
           (cons string-coordinate (- fret-coordinate)))))
 
+    (define (stencil-coordinate-offset fret-offset string-offset)
+      "Return a pair @code{(x-offset . y-offstet)}
+      for translation in stencil coordinate system."
+      (cond
+        ((eq? orientation 'landscape)
+         (cons fret-offset (- string-offset)))
+        ((eq? orientation 'opposing-landscape)
+         (cons (- fret-offset) string-offset))
+        (else
+          (cons string-offset (- fret-offset)))))
+
+
+
     (define (make-bezier-sandwich-list start stop base height
                                        half-thickness)
       "Make the argument list for a bezier sandwich from
@@ -642,6 +655,7 @@ fret-diagram overall parameters."
          (if (null? restlist)
            positioned-glyph
            (ly:stencil-add
+             positioned-glyph
              (draw-xo restlist)))))
 
        (define (draw-capo fret)
@@ -734,18 +748,19 @@ at @var{fret}."
              (xo-stencil (draw-xo xo-list))
              (xo-fret-offset
                (stencil-fretboard-offset
-                 xo-stencil 'fret orientation)))
+                 xo-stencil 'fret orientation))
+             (xo-stencil-offset
+              (stencil-coordinate-offset
+               (- diagram-fret-top 
+                  xo-fret-offset
+                  (* size xo-padding))
+               0)))
         (set! fret-diagram-stencil
           (ly:stencil-add
             fret-diagram-stencil
             (ly:stencil-translate
               xo-stencil
-              (stencil-coordinates
-                (- diagram-fret-top
-                   xo-fret-offset
-                   (* size xo-padding))
-                0)))))) ; no string offset
-
+              xo-stencil-offset)))))
     (if (> capo-fret 0)
       (set! fret-diagram-stencil
         (ly:stencil-add