]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
Release: bump Welcome versions.
[lilypond.git] / scm / define-markup-commands.scm
index d35689d7fe6f55a6cf788edd8d7592a9abcec559..3e7b2f2308f2e61d35282743328ded3e69d90a81 100644 (file)
@@ -383,7 +383,7 @@ Its appearance may be customized by overrides for @code{thickness},
     ;; The final stencil: lined-up bows
     (apply ly:stencil-add
       (map
-        (lambda (stil pt) (ly:stencil-translate stil pt))
+        ly:stencil-translate
         (circular-list init-bow-up init-bow-down)
         list-of-starts))))
 
@@ -1595,16 +1595,11 @@ equivalent to @code{\"fi\"}.
                         (cons arg result-list))))
                 '()
                 arg-list))
-
-  (interpret-markup layout
-                    (prepend-alist-chain 'word-space 0 props)
-                    (make-line-markup
-                     (make-override-lines-markup-list
-                      (cons 'word-space
-                            (chain-assoc-get 'word-space props))
-                      (if (markup-command-list? args)
-                          args
-                          (concat-string-args args))))))
+  (stack-stencil-line 0
+                      (interpret-markup-list layout props
+                                             (if (markup-command-list? args)
+                                                 args
+                                                 (concat-string-args args)))))
 
 (define (wordwrap-stencils stencils
                            justify base-space line-width text-dir)
@@ -2251,6 +2246,24 @@ Set the dimensions of @var{arg} to @var{x} and@tie{}@var{y}."
       `(delay-stencil-evaluation ,(delay expr))
       x y))))
 
+(define-markup-command (with-outline layout props outline arg)
+  (markup? markup?)
+  #:category other
+  "
+Print @var{arg} with the outline and dimensions of @var{outline}."
+  (ly:stencil-outline (interpret-markup layout props arg)
+                      (interpret-markup layout props outline)))
+
+(define-markup-command (with-dimensions-from layout props arg1 arg2)
+  (markup? markup?)
+  #:category other
+  "
+Print @var{arg2} with the dimensions of @var{arg1}."
+  (let* ((stil1 (interpret-markup layout props arg1))
+         (x (ly:stencil-extent stil1 0))
+         (y (ly:stencil-extent stil1 1)))
+    (interpret-markup layout props (markup #:with-dimensions x y arg2))))
+
 (define-markup-command (pad-around layout props amount arg)
   (number? markup?)
   #:category align
@@ -2323,10 +2336,7 @@ Add padding @var{amount} around @var{arg} in the X@tie{}direction.
   }
 }
 @end lilypond"
-  (let* ((m (interpret-markup layout props arg))
-         (x (ly:stencil-extent m X))
-         (y (ly:stencil-extent m Y)))
-    (ly:make-stencil (list 'transparent-stencil (ly:stencil-expr m)) x y)))
+  (ly:stencil-outline empty-stencil (interpret-markup layout props arg)))
 
 (define-markup-command (pad-to-box layout props x-ext y-ext arg)
   (number-pair? number-pair? markup?)
@@ -2627,6 +2637,7 @@ may be any property supported by @rinternals{font-interface},
 
 (define-markup-command (abs-fontsize layout props size arg)
   (number? markup?)
+  #:properties ((word-space 0.6) (baseline-skip 3))
   #:category font
   "Use @var{size} as the absolute font size (in points) to display @var{arg}.
 Adjusts @code{baseline-skip} and @code{word-space} accordingly.
@@ -2642,14 +2653,12 @@ Adjusts @code{baseline-skip} and @code{word-space} accordingly.
 @end lilypond"
   (let* ((ref-size (ly:output-def-lookup layout 'text-font-size 12))
          (text-props (list (ly:output-def-lookup layout 'text-font-defaults)))
-         (ref-word-space (chain-assoc-get 'word-space text-props 0.6))
-         (ref-baseline (chain-assoc-get 'baseline-skip text-props 3))
          (magnification (/ size ref-size)))
     (interpret-markup
      layout
      (cons
-      `((baseline-skip . ,(* magnification ref-baseline))
-        (word-space . ,(* magnification ref-word-space))
+      `((baseline-skip . ,(* magnification baseline-skip))
+        (word-space . ,(* magnification word-space))
         (font-size . ,(magnification->font-size magnification)))
       props)
      arg)))
@@ -3092,7 +3101,7 @@ normal text font, no matter what font was used earlier.
   #:category music
   "@var{glyph-name} is converted to a musical symbol; for example,
 @code{\\musicglyph #\"accidentals.natural\"} selects the natural sign from
-the music font.  See @ruser{The Feta font} for a complete listing of
+the music font.  See @ruser{The Emmentaler font} for a complete listing of
 the possible glyphs.
 
 @lilypond[verbatim,quote]
@@ -3691,17 +3700,18 @@ mensural-flags.  Both are supplied for convenience.
            (raw-length (if stem-up upflag-length downflag-length))
            (angle (if stem-up upflag-angle downflag-angle))
            (flag-length (+ (* raw-length factor) half-stem-thickness))
-           (flag-end (if (= angle 0)
-                         (cons flag-length (* half-stem-thickness dir))
-                         (polar->rectangular flag-length angle)))
+           (flag-end (polar->rectangular flag-length angle))
            (thickness (* flag-thickness factor))
            (thickness-offset (cons 0 (* -1 thickness dir)))
            (spacing (* -1 flag-spacing factor dir))
            (start (cons (- half-stem-thickness) (* half-stem-thickness dir)))
-           (points (list start
-                         flag-end
-                         (offset-add flag-end thickness-offset)
-                         (offset-add start thickness-offset)))
+           (raw-points
+             (list
+               '(0 . 0)
+               flag-end
+               (offset-add flag-end thickness-offset)
+               thickness-offset))
+           (points (map (lambda (coord) (offset-add coord start)) raw-points))
            (stencil (ly:round-filled-polygon points half-stem-thickness))
            ;; Log for 1/8 is 3, so we need to subtract 3
            (flag-stencil (buildflags stencil (- log 3) stencil spacing)))
@@ -3710,6 +3720,10 @@ mensural-flags.  Both are supplied for convenience.
   (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)
                                                  (font-name . #f))
                                                props)))
+         ;; default for text-font-size is 11
+         ;; hence we use (/ text-font-size 11) later, to ensure proper scaling
+         ;; of stem-length and thickness
+         (text-font-size (ly:output-def-lookup layout 'text-font-size 11))
          (size-factor (magstep font-size))
          (blot (ly:output-def-lookup layout 'blot-diameter))
          (head-glyph-name
@@ -3733,8 +3747,9 @@ mensural-flags.  Both are supplied for convenience.
          (attach-indices (ly:note-head::stem-attachment font head-glyph-name))
          (stem-length (* size-factor (max 3 (- log 1))))
          ;; With ancient-flags we want a tighter stem
-         (stem-thickness (* size-factor (if ancient-flags? 0.1 0.13)))
-         (stemy (* dir stem-length))
+         (stem-thickness
+           (* size-factor (/ text-font-size 11) (if ancient-flags? 0.1 0.13)))
+         (stemy (* dir (/ text-font-size 11) stem-length))
          (attach-off (cons (interval-index
                             (ly:stencil-extent head-glyph X)
                             (* (sign dir) (car attach-indices)))
@@ -3802,7 +3817,6 @@ mensural-flags.  Both are supplied for convenience.
                                     stem-thickness
                                     0))
                              (+ stemy flag-style-Y-corr))))))
-
     ;; If there is a flag on an upstem and the stem is short, move the dots
     ;; to avoid the flag.  16th notes get a special case because their flags
     ;; hang lower than any other flags.
@@ -4437,6 +4451,7 @@ Draw vertical brackets around @var{arg}.
                 (padding)
                 (size 1)
                 (thickness 1)
+                (line-thickness 0.1)
                 (width 0.25))
   "
 @cindex placing parentheses around text
@@ -4467,12 +4482,11 @@ a column containing several lines of text.
   (let* ((m (interpret-markup layout props arg))
          (scaled-width (* size width))
          (scaled-thickness
-          (* (chain-assoc-get 'line-thickness props 0.1)
-             thickness))
+          (* line-thickness thickness))
          (half-thickness
           (min (* size 0.5 scaled-thickness)
                (* (/ 4 3.0) scaled-width)))
-         (padding (chain-assoc-get 'padding props half-thickness)))
+         (padding (or padding half-thickness)))
     (parenthesize-stencil
      m half-thickness scaled-width angularity padding)))
 
@@ -4735,10 +4749,10 @@ Overriding @code{baseline-skip} to increase rows vertical distance.
     #'(0 1 0 -1)
     {
       \\underline { center-aligned right-aligned center-aligned left-aligned }
-      one \number 1 thousandth \number 0.001
-      eleven \number 11 hundredth \number 0.01
-      twenty \number 20 tenth \number 0.1
-      thousand \number 1000 one \number 1.0
+      one \\number 1 thousandth \\number 0.001
+      eleven \\number 11 hundredth \\number 0.01
+      twenty \\number 20 tenth \\number 0.1
+      thousand \\number 1000 one \\number 1.0
     }
 }
 @end lilypond