Re: Right aligned text in header

2018-03-13 Thread Br. Samuel Springuel

On 3/13/18 5:02 PM, Thomas Morley wrote:

Hi,

do you mean like below?
Based on
http://lsr.di.unimi.it/LSR/Item?u=1=765

#(define (general-column align-dir baseline mols)
   (let* ((aligned-mols
(map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
 (stack-lines -1 0.0 baseline aligned-mols)))

#(define-markup-command (my-wordwrap-field layout props symbol)
   (symbol?)
   #:category align
   #:properties ((baseline-skip)
 (align-dir LEFT))
   (let* ((m (chain-assoc-get symbol props)))
 (if (string? m)
 (general-column align-dir baseline-skip
   (wordwrap-string-internal-markup-list layout props #f m))
 empty-stencil)))


RIGHT instead of LEFT in this and then it does what I want.  Thanks.


--
✝
Br. Samuel, OSB
St. Anselm’s Abbey
Washington, DC
(R. Padraic Springuel)

PAX ☧ ΧΡΙΣΤΟΣ

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Right aligned text in header

2018-03-13 Thread Thomas Morley
2018-03-13 20:31 GMT+01:00 Br. Samuel Springuel :
> I'm creating a custom bookTitleMarkup for a project I'm working on and have
> some lines which are setup like `meter` and `arranger` in the default
> template (two blocks of text, one flushed left the other right, on the same
> line).
>
> However, on one of those lines the header properties to be used may be very
> long and thus I need to force word wrapping to less than the full line width
> for each field.  On the left side, that is not a problem, I just use
> `\override #'(line-width . 30) \wordwrap-field`.  However, on the right side
> this doesn't work because the wrapping of the text within the field is left
> aligned inside its box (which is right aligned on the line).  What I'd like
> is for the wrapped text to be right aligned inside its box.  I tried
> changing `text-direction` to -1, and this did change the alignment, but also
> reversed the word order on each line.
>
> Is there an equivalent for `\wordwrap-field` that will flush right the text
> (much like `\justify-field` leads to it being justified)?
>
> %%% Begin Snippet %%%
> \paper  {
> % custom title layout
> bookTitleMarkup = \markup { \column {
> \fill-line { \fromproperty #'header:title }
> \fill-line {
> \fromproperty #'header:meter
> \fromproperty #'header:tune
> }
> \fill-line {
> \fromproperty #'header:poet
> \fromproperty #'header:composer
> }
> \fill-line {
> { \override #'(line-width . 30) \wordwrap-field
> #'header:poet_copyright }
> { \override #'(line-width . 30) \wordwrap-field
> #'header:tune_copyright }
> }
> }}
> scoreTitleMarkup = {}
> }
>
> \header {
> title = "Title of song (from lyrics)"
> meter = "8.8.8.8"
> tune = "name of tune"
> poet = "Poet"
> composer = "Composer"
> poet_copyright = "A sometimes long statement indicating at least the
> year of the copyright.  Should be flushed left."
> tune_copyright = "Also may be long and in need of wrapping.  Should be
> flushed right."
> }
>
> \new Staff
> {
>   \new Voice = "mel" { c' }
> }
>
> %%% End Snippet %%



Hi,

do you mean like below?
Based on
http://lsr.di.unimi.it/LSR/Item?u=1=765

#(define (general-column align-dir baseline mols)
  (let* ((aligned-mols
   (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
(stack-lines -1 0.0 baseline aligned-mols)))

#(define-markup-command (my-wordwrap-field layout props symbol)
  (symbol?)
  #:category align
  #:properties ((baseline-skip)
(align-dir LEFT))
  (let* ((m (chain-assoc-get symbol props)))
(if (string? m)
(general-column align-dir baseline-skip
  (wordwrap-string-internal-markup-list layout props #f m))
empty-stencil)))


\paper  {
% custom title layout
bookTitleMarkup = \markup { \column {
\fill-line { \fromproperty #'header:title }
\fill-line {
\fromproperty #'header:meter
\fromproperty #'header:tune
}
\fill-line {
\fromproperty #'header:poet
\fromproperty #'header:composer
}
\fill-line {
{
  \override #'(line-width . 30)
  \wordwrap-field #'header:poet_copyright
}
{
  \override #'(line-width . 30)
  \override #'(align-dir . 1)
  \my-wordwrap-field #'header:tune_copyright
}
}
}}
scoreTitleMarkup = {}
}

\header {
title = "Title of song (from lyrics)"
meter = "8.8.8.8"
tune = "name of tune"
poet = "Poet"
composer = "Composer"
poet_copyright = "A sometimes long statement indicating at least the year
of the copyright.  Should be flushed left."
tune_copyright = "Also may be long and in need of wrapping.
Should be flushed right."
}

\new Staff
{
  \new Voice = "mel" { c' }
}


Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user