]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
* Unify fetaDynamic and fetaNumber into one fetaText encoding
[lilypond.git] / scm / define-markup-commands.scm
index 302b08fbc7dbd28b1a0840fee0cce831ff1822dc..8d4d749770d129975a80113fce9fee9c9d6b5454 100644 (file)
@@ -1784,7 +1784,7 @@ may be any property supported by @rinternals{font-interface},
 }
 @end lilypond"
   (interpret-markup layout
-                    (cons '((font-size . -5) (font-encoding . fetaNumber)) props)
+                    (cons '((font-size . -5) (font-encoding . fetaText)) props)
                     arg))
 
 (define-markup-command (abs-fontsize layout props size arg)
@@ -1912,7 +1912,7 @@ some punctuation; it has no letters.
   }
 }
 @end lilypond"
-  (interpret-markup layout (prepend-alist-chain 'font-encoding 'fetaNumber props) arg))
+  (interpret-markup layout (prepend-alist-chain 'font-encoding 'fetaText props) arg))
 
 (define-markup-command (roman layout props arg)
   (markup?)
@@ -2117,7 +2117,7 @@ done in a different font.  The recommended font for this is bold and italic.
 }
 @end lilypond"
   (interpret-markup
-   layout (prepend-alist-chain 'font-encoding 'fetaDynamic props) arg))
+   layout (prepend-alist-chain 'font-encoding 'fetaText props) arg))
 
 (define-markup-command (text layout props arg)
   (markup?)
@@ -2560,7 +2560,7 @@ and continue with double letters.
          ; backward slashes might use slope and point in the other direction!
          (dy (* mag (if forward 0.4 -0.4)))
          (number-stencil (interpret-markup layout
-                                           (prepend-alist-chain 'font-encoding 'fetaNumber props)
+                                           (prepend-alist-chain 'font-encoding 'fetaText props)
                                            (number->string num)))
          (num-x (horizontal-slash-interval num forward (ly:stencil-extent number-stencil X) mag))
          (center (interval-center (ly:stencil-extent number-stencil Y)))
@@ -2646,7 +2646,7 @@ figured bass notation.
       stroke")
 
 (define-markup-command (eyeglasses layout props)
-  () 
+  ()
   #:category other
   "Prints out eyeglasses, indicating strongly to look at the conductor.
 @lilypond[verbatim,quote]
@@ -3149,6 +3149,53 @@ Draw vertical brackets around @var{arg}.
         (m (interpret-markup layout props arg)))
     (bracketify-stencil m Y th (* 2.5 th) th)))
 
+(define-markup-command (parenthesize layout props arg)
+  (markup?)
+  #:category graphic
+  #:properties ((angularity 0)
+               (padding)
+               (size 1)
+               (thickness 1)
+               (width 0.25))
+  "
+@cindex placing parentheses around text
+
+Draw parentheses around @var{arg}.  This is useful for parenthesizing
+a column containing several lines of text.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\line {
+    \\parenthesize {
+      \\column {
+        foo
+        bar
+      }
+    }
+    \\override #'(angularity . 2) {
+      \\parenthesize {
+        \\column {
+          bah
+          baz
+        }
+      }
+    }
+  }
+}
+@end lilypond"
+  (let* ((markup (interpret-markup layout props arg))
+        (scaled-width (* size width))
+        (scaled-thickness
+         (* (chain-assoc-get 'line-thickness props 0.1)
+            thickness))
+        (half-thickness
+         (min (* size 0.5 scaled-thickness)
+              (* (/ 4 3.0) scaled-width)))
+        (padding (chain-assoc-get 'padding props half-thickness)))
+    (parenthesize-stencil
+     markup half-thickness scaled-width angularity padding)))
+
+\f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Delayed markup evaluation
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;