]> 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)
committerNeil Puttock <n.puttock@gmail.com>
Mon, 20 Jul 2009 19:08:03 +0000 (20:08 +0100)
(cherry picked from commit 829b576a30e1f53859a079a5be76c71a0fd901b6)

scm/fret-diagrams.scm

index ce627b50fe137d2e218148aa101a61c1ab103d40..cb7ee6dbaab29999f1fe803d69432ba01f896556 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