lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lines to edges of \center-column


From: caagr98
Subject: Re: Lines to edges of \center-column
Date: Sun, 23 Apr 2017 00:56:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

This is great, thanks! I was trying to mess around with \hbracket and \whiteout, but this is far better.

Just a few questions:
Is it possible to scale the protrusions (and other things) by font size?
How can I change the color of the lines?
What does "mols" mean?


On 04/23/17 00:34, David Nalesnik wrote:
On Sat, Apr 22, 2017 at 3:22 PM,  <address@hidden> wrote:
Is there some way to make a center-column draw lines from slightly outside
the text to the edges of the column (see example)?

In this specific case, I have both English and Japanese names for stuff, and
without those lines, I think it's a bit unclear exactly what part the
Japanese refers to.

```
subtitle = \markup \bold \large \line {
   "from"
   \center-column {
     "Legend of Heroes"
     \smaller \smaller \smaller
     "英雄伝説"
   }
   "VI:"
   \center-column {
     "Trails in the Sky"
     \smaller \smaller \smaller
     "空の軌跡"
   }
}
```

Try this:

\version "2.19.59"

% based on general-column from scm/define-markup-commands.scm
#(define (general-column align-dir baseline mols)
    (let* ((aligned-mols
            (map (lambda (x) (ly:stencil-aligned-to x X align-dir))
              mols))
           (max-extent (ly:stencil-extent (car aligned-mols) X))
           (aligned-mols
            (cons (car aligned-mols)
              (map (lambda (x)
                     (let ((stil-ext (ly:stencil-extent x X)))
                       (ly:stencil-add
                        (make-line-stencil 0.1 (car max-extent) 0 (1-
(car stil-ext)) 0)
                        (make-line-stencil 0.1 (1+ (cdr stil-ext)) 0
(cdr max-extent) 0)
                        (make-line-stencil 0.1 (car max-extent) 0 (car
max-extent) 1.5)
                        (make-line-stencil 0.1 (cdr max-extent) 0 (cdr
max-extent) 1.5)
                        x)))
                (cdr aligned-mols))))
           (stacked-stencil (stack-lines -1 0.0 baseline aligned-mols))
           (stacked-extent (ly:stencil-extent stacked-stencil X)))
      (ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X)))

#(define-markup-command (center-column layout props args)
    (markup-list?)
    #:category align
    #:properties ((baseline-skip))
    (general-column CENTER baseline-skip (interpret-markup-list layout
props args)))

\header {
   subtitle = \markup \bold \large \line {
     "from"
     \center-column {
       "Legend of Heroes"
       \smaller \smaller \smaller
       "英雄伝説"
       "英雄伝説"
       \huge
       "英雄伝説"
     }
     "VI:"
     \center-column {
       "Trails in the Sky"
       \smaller \smaller \smaller
       "空の軌跡"
     }
   }
}

{ c }

You might want to adjust some of the hard-coded values
(line-thickness, length of "protrusions," offset of bracket from
text), but this should get you started.

-David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]