[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: two-column dialogue markup function(s)
From: |
Kieren MacMillan |
Subject: |
Re: two-column dialogue markup function(s) |
Date: |
Fri, 27 Dec 2013 10:39:12 -0500 |
Hi David,
> By using a non-predefined name for that kind of thing.
Hmmmm… I was trying that, and getting “undeclared variable” warnings.
Anyway, it seems to work now.
%%%% BEGIN SNIPPET
\version "2.17.97"
#(define-markup-command (mm-feed layout props amount) (number?)
(let ((o-s (ly:output-def-lookup layout 'output-scale)))
(ly:make-stencil "" '(0 . 0) (cons 0 (abs (/ amount o-s))))))
#(define-markup-command (put-mm layout props dir amount arg)
(ly:dir? number? markup?) (interpret-markup layout props
(markup #:put-adjacent Y dir arg #:mm-feed amount)))
#(define-markup-command (dialogue layout props charname text) (markup?
markup-list?)
#:properties ((column-width 40)
(bline-skip 2.2)
(char-skip 3.5)
(f-size 9))
(interpret-markup layout props
#{ \markup \abs-fontsize #f-size \override #`(baseline-skip . ,bline-skip)
\line {
\bold \concat { #charname : }
\hspace #1
\override #`(line-width . ,column-width) \put-mm #DOWN #char-skip
\wordwrap #text } #}))
\markup \fill-line {
\hcenter-in #54 \left-column {
\dialogue Cop { Much better. Now, miss— }
\dialogue Jill { Oh, you can call me ‘Jill’, officer! }
\dialogue Cop { Of course I can, miss. I understand you were at the scene
of the crime— }
\dialogue Jill { Oh no, I wasn’t actually there. I read it! }
\dialogue Cop { Fine, miss. I understand you ‘read’ the scene of the crime—
}
}
\hcenter-in #54 \left-column {
\dialogue Jill { And then I imagined the whole thing, just like my Grandma
taught me to do when I was too young to read. }
\dialogue Cop { So essentially you were at the scene of the crime. }
\dialogue Jill { I guess you could say that… Oh, it was horrible. Just
awful, officer! Those poor little pigs! }
}
}
%%%% BEGIN SNIPPET
Next questions:
1. Is there an easy way to make the dialogue block left-aligned (i.e., as if it
were “tabbed” in a word processor)? I could hand-code an \hcenter-in width
based on the widest character name, but would love a more automated solution.
2. Any other improvements anyone can think of? I’d like to make this function
(-set) dead-simple for others to drop in and use.
Thanks,
Kieren.