From a11070b040c3fc20ecbcde5306616c04d884caad Mon Sep 17 00:00:00 2001 From: hanwen Date: Mon, 20 Mar 2006 14:45:44 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ input/test/instrument-name-align.ly | 31 +++++++++++++++++++++++++++++ scm/define-markup-commands.scm | 14 ++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 input/test/instrument-name-align.ly diff --git a/ChangeLog b/ChangeLog index ca2ee7c359..a1ec58a0ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-03-20 Han-Wen Nienhuys + * 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 index 0000000000..cad9544e3f --- /dev/null +++ b/input/test/instrument-name-align.ly @@ -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 + } + +>> diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index a127c9030f..3485ef8b8b 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -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 -- 2.39.5