]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
Add $current-book and $current-bookpart parser variables
[lilypond.git] / scm / define-markup-commands.scm
index e9537744660d4b3623341c44f27c1b716f834d4b..53d71aa91651945e998379871719411092b2cf9d 100644 (file)
@@ -1003,7 +1003,7 @@ the line width, where @var{X} is the number of staff spaces.
 @lilypond[verbatim,quote]
 \\header {
   title = \"My title\"
-  description = \"Lorem ipsum dolor sit amet, consectetur adipisicing
+  myText = \"Lorem ipsum dolor sit amet, consectetur adipisicing
     elit, sed do eiusmod tempor incididunt ut labore et dolore magna
     aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco
     laboris nisi ut aliquip ex ea commodo consequat.\"
@@ -1014,7 +1014,7 @@ the line width, where @var{X} is the number of staff spaces.
     \\column {
       \\fill-line { \\fromproperty #'header:title }
       \\null
-      \\wordwrap-field #'header:descr
+      \\wordwrap-field #'header:myText
     }
   }
 }
@@ -1037,7 +1037,7 @@ the line width, where @var{X} is the number of staff spaces.
 @lilypond[verbatim,quote]
 \\header {
   title = \"My title\"
-  description = \"Lorem ipsum dolor sit amet, consectetur adipisicing
+  myText = \"Lorem ipsum dolor sit amet, consectetur adipisicing
     elit, sed do eiusmod tempor incididunt ut labore et dolore magna
     aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco
     laboris nisi ut aliquip ex ea commodo consequat.\"
@@ -1048,7 +1048,7 @@ the line width, where @var{X} is the number of staff spaces.
     \\column {
       \\fill-line { \\fromproperty #'header:title }
       \\null
-      \\justify-field #'header:description
+      \\justify-field #'header:myText
     }
   }
 }
@@ -2314,7 +2314,7 @@ Draw @var{arg} in color specified by @var{color}.
     (ly:make-stencil (list 'color color (ly:stencil-expr stil))
                     (ly:stencil-extent stil X)
                     (ly:stencil-extent stil Y))))
-\f
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; glyphs
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2595,9 +2595,67 @@ figured bass notation.
 \\markup { \\eyeglasses }
 @end lilypond"
   (interpret-markup layout props
-    (make-with-dimensions-markup '(-0.55 . 2.9) '(0.4 . 2.4)
+    (make-with-dimensions-markup '(-0.61 . 3.22) '(0.2 . 2.41)
       (make-postscript-markup eyeglassesps))))
 
+(define-builtin-markup-command (left-brace layout props size)
+  (number?)
+  other
+  ()
+  "
+A feta brace in point size @var{size}.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\left-brace #35
+  \\hspace #2
+  \\left-brace #45
+}
+@end lilypond"
+  (let* ((font (ly:paper-get-font layout
+                                  (cons '((font-encoding . fetaBraces)
+                                          (font-name . #f))
+                                        props)))
+        (glyph-count (1- (ly:otf-glyph-count font)))
+         (scale (ly:output-def-lookup layout 'output-scale))
+         (scaled-size (/ (ly:pt size) scale))
+         (glyph (lambda (n)
+                  (ly:font-get-glyph font (string-append "brace"
+                                                        (number->string n)))))
+        (get-y-from-brace (lambda (brace)
+                            (interval-length
+                             (ly:stencil-extent (glyph brace) Y))))
+         (find-brace (binary-search 0 glyph-count get-y-from-brace scaled-size))
+         (glyph-found (glyph find-brace)))
+
+    (if (or (null? (ly:stencil-expr glyph-found))
+           (< scaled-size (interval-length (ly:stencil-extent (glyph 0) Y)))
+           (> scaled-size (interval-length
+                           (ly:stencil-extent (glyph glyph-count) Y))))
+        (begin
+          (ly:warning (_ "no brace found for point size ~S ") size)
+          (ly:warning (_ "defaulting to ~S pt")
+                     (/ (* scale (interval-length
+                                  (ly:stencil-extent glyph-found Y)))
+                        (ly:pt 1)))))
+    glyph-found))
+
+(define-builtin-markup-command (right-brace layout props size)
+  (number?)
+  other
+  ()
+  "
+A feta brace in point size @var{size}, rotated 180 degrees.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\right-brace #45
+  \\hspace #2
+  \\right-brace #35
+}
+@end lilypond"
+  (interpret-markup layout props (markup #:rotate 180 #:left-brace size)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; the note command.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2975,7 +3033,7 @@ Set @var{arg} in subscript with a normal font size.
    (interpret-markup layout props arg)
    (* -0.5 baseline-skip)
    Y))
-\f
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; brackets.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3021,7 +3079,7 @@ Draw vertical brackets around @var{arg}.
   (let ((th 0.1) ;; todo: take from GROB.
         (m (interpret-markup layout props arg)))
     (bracketify-stencil m Y th (* 2.5 th) th)))
-\f
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Delayed markup evaluation
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3054,7 +3112,7 @@ when @var{label} is not found."
                                    (markup #:concat (#:hspace gap page-markup)))))))
      x-ext
      y-ext)))
-\f
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Markup list commands
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;