On Sat, Apr 22, 2017 at 3:22 PM,  <caag...@gmail.com> 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

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

Reply via email to