]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / scm / define-markup-commands.scm
index c5ee47382fd03768df660358db9ec6efd4f4ac80..1a940b13834e8c2dd79b0b60a367b82c9a1b28f2 100644 (file)
@@ -118,6 +118,12 @@ circle of diameter 0 (ie sharp corners)."
   (ly:round-filled-box
    xext yext blot))
 
+(define-markup-command (rotate layout props ang arg) (number? markup?)
+  "Rotate object with @var{ang} degrees around its center."
+  (let* ((stil (interpret-markup layout props arg)))
+    (ly:stencil-rotate stil ang 0 0)))
+
+
 (define-markup-command (whiteout layout props arg) (markup?)
   "Provide a white underground for @var{arg}"
   (let* ((stil (interpret-markup layout props
@@ -1169,21 +1175,20 @@ figured bass notation"
          (stem-length (*  size-factor (max 3 (- log 1))))
          (head-glyph-name (get-glyph-name font (get-glyph-name-candidates dir log style)))
          (head-glyph (ly:font-get-glyph font head-glyph-name))
-        (attach-indices (offset-scale
-                         (ly:note-head::stem-attachment font head-glyph-name) dir))
-        
+        (attach-indices (ly:note-head::stem-attachment font head-glyph-name))
          (stem-thickness (* size-factor 0.13))
          (stemy (* dir stem-length))
          (attach-off (cons (interval-index
                            (ly:stencil-extent head-glyph X)
-                           (car attach-indices))
-                          (interval-index
-                           (ly:stencil-extent head-glyph Y)
-                           (cdr attach-indices))))
-
+                           (* dir (car attach-indices)))
+                          (* dir       ; fixme, this is inconsistent between X & Y.
+                             (interval-index
+                              (ly:stencil-extent head-glyph Y)
+                              (cdr attach-indices)))))
          (stem-glyph (and (> log 0)
                          (ly:round-filled-box
-                          (ordered-cons (car attach-off) (+ (car attach-off)  (* (- dir) stem-thickness)))
+                          (ordered-cons (car attach-off)
+                                        (+ (car attach-off)  (* (- dir) stem-thickness)))
                           (cons (min stemy (cdr attach-off))
                                 (max stemy (cdr attach-off)))
                           (/ stem-thickness 3))))
@@ -1202,7 +1207,7 @@ figured bass notation"
                                          (string-append "flags."
                                                         (if (> dir 0) "u" "d")
                                                         (number->string log)))
-                       (cons (+ attachx (/ stem-thickness 2)) stemy)))))
+                       (cons (+ (car attach-off) (/ stem-thickness 2)) stemy)))))
     (if flaggl
         (set! stem-glyph (ly:stencil-add flaggl stem-glyph)))
     (if (ly:stencil? stem-glyph)
@@ -1262,6 +1267,17 @@ A negative @var{amount} indicates raising, see also @code{\\raise}.
                             (- amount) Y))
 
 
+(define-markup-command (translate-scaled layout props offset arg) (number-pair? markup?)
+  "Translate @var{arg} by @var{offset}, scaling the offset by the @code{font-size}."
+
+  (let*
+      ((factor (magstep (chain-assoc-get 'font-size props 0)))
+       (scaled (cons (* factor (car offset))
+                    (* factor (cdr offset)))))
+    
+  (ly:stencil-translate (interpret-markup layout props arg)
+                       scaled)))
+
 (define-markup-command (raise layout props amount arg) (number? markup?)
   "
 Raise @var{arg}, by the distance @var{amount}.