]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/test/instrument-name-align.ly: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 20 Mar 2006 14:45:44 +0000 (14:45 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 20 Mar 2006 14:45:44 +0000 (14:45 +0000)
* scm/define-markup-commands.scm (hcenter-in): add hcenter-in.

* input/test/instrument-name-align.ly: new file. Document how to
align instrument names.

ChangeLog
input/test/instrument-name-align.ly [new file with mode: 0644]
scm/define-markup-commands.scm

index ca2ee7c3599994a01531f9a9dbe1bc0db18295b2..a1ec58a0ad3061a837a0b5e4151b380b0060020e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2006-03-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * input/test/instrument-name-align.ly: new file.
+
+       * scm/define-markup-commands.scm (hcenter-in): add hcenter-in.
+
+       * input/test/instrument-name-align.ly: new file. Document how to
+       align instrument names.
+
        * lily/mark-engraver.cc: remove properties.
 
        * scm/define-context-properties.scm
diff --git a/input/test/instrument-name-align.ly b/input/test/instrument-name-align.ly
new file mode 100644 (file)
index 0000000..cad9544
--- /dev/null
@@ -0,0 +1,31 @@
+
+\header {
+
+
+  texidoc = "instrument names may be aligned manually by putting the
+names in padded boxes with @code{\markup}."
+
+
+}
+
+\version "2.7.39"
+
+\paper {
+  line-width = 15\cm
+}
+
+
+\new StaffGroup \relative
+<<
+  \new Staff {
+    \set Staff. instrument
+    = \markup { \hcenter-in #10 "blabla" }
+    c1 c1
+  } 
+  \new Staff {
+    \set Staff. instrument
+    = \markup { \hcenter-in #10 "blo" }
+    c1 c1
+  } 
+  
+>>
index a127c9030f2046a63db5ef005649dffeeb1b71aa..3485ef8b8bb411c79169d9d8e52873c2ff90e1fa 100644 (file)
@@ -679,7 +679,8 @@ alignment accordingly."
                     x y)))
 
 
-(define-markup-command (pad-to-box layout props x-ext y-ext arg) (number-pair? number-pair? markup?)
+(define-markup-command (pad-to-box layout props x-ext y-ext arg)
+  (number-pair? number-pair? markup?)
   "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space"
 
   (let*
@@ -692,6 +693,17 @@ alignment accordingly."
                     (interval-union y-ext y))))
 
 
+(define-markup-command (hcenter-in layout props length arg)
+  (number? markup?)
+  "Center @var{arg} horizontally within a box of extending
+@var{length}/2 to the left and right."
+
+  (interpret-markup layout props
+                   (make-pad-to-box-markup
+                    (cons (/ length -2) (/ length 2))
+                    '(0 . 0)
+                    (make-hcenter-markup arg))))
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; property