Hi Harm,
many thanks for your advice!
The \table command was completely new to me.
Here is my current state of work:
#(define (mm->staff-spaces mm)
(let ((ss (ly:output-def-lookup $defaultpaper 'staff-space)))
(/ mm ss)))
#(define musiclist (list
#{ { \clef bass e'4 } #}
#{ { \clef treble a'2 } #}
#{ { \key as \major \clef alto es' } #}
#{ { \clef bass e'4 } #}
#{ { \clef treble a'2 } #}
#{ { \key as \major \clef alto es' } #}
#{ { \clef bass e'4 } #}
#{ { \clef treble a'2 } #}
#{ { \key as \major \clef alto es' } #}
))
\layout {
indent = #0
\context {
\Staff
\remove "Time_signature_engraver"
\remove "Bar_engraver"
\override StaffSymbol #'width = #(mm->staff-spaces 20)
}
}
#(define (make-score music)
(let* ((score (scorify-music music))
(layout (ly:output-def-clone $defaultlayout)))
(ly:score-add-output-def! score layout)
score))
#(define-markup-command (scoretomarkup layout props s)
(ly:score?)
(interpret-markup layout props (make-score-markup s)))
#(define-markup-list-command (scores-to-markup-list layout props scores)
(list?)
(map (lambda (s) (interpret-markup layout props s))
(map make-score-markup scores)))
#(define scores (map make-score musiclist))
\markuplist { \table #'(0 0 0) \scores-to-markup-list \scores }
Some new questions arose:
1. Is there an easier way of converting a list of music expressions into
markups? Did I miss some built-in function
that would do the job, too?
2. I stumbled upon some functions I was not able to find in the source code.
First I wanted to see how the built-in \score markup-function does it's job.
I saw that it calls a function called score-lines-markup-list, which I
was unable to find in the repository.
Or take (make-score-markup) which I had seen in an older thread.
But a "git grep make-score-markup" returns nothing.
What am I missing?
Thank you,
Michael
Am 23.09.2019 um 23:14 schrieb Thomas Morley:
Am Mo., 23. Sept. 2019 um 18:04 Uhr schrieb Michael Käppler <[email protected]>:
Hi all,
I'm trying to understand the way one can translate / stack stencils in
LilyPond.
Consider the following code:
#(define-markup-command (draw-line-mod layout props startpos endpos)
(number-pair? number-pair?)
#:properties ((thickness 1))
(let ((th (* (ly:output-def-lookup layout 'line-thickness)
thickness))
(startx (car startpos))
(starty (cdr startpos))
(endx (car endpos))
(endy (cdr endpos)))
(make-line-stencil th startx starty endx endy)))
#(define hlineone (markup #:draw-line-mod '(0 . 0) '(10 . 0)))
#(define hlinetwo (markup #:draw-line-mod '(0 . 10) '(10 . 10)))
#(define vlineone (markup #:draw-line-mod '(0 . 0) '(0 . 10)))
#(define vlinetwo (markup #:draw-line-mod '(10 . 0) '(10 . 10)))
\markup \hlineone
% \markup \hlinetwo
% \markup \vlineone
% \markup \vlinetwo
The ordinary draw-line markup function calls (make-line-stencil) with
startx/starty 0 0.
So I wrote the custom draw-line-mod function to figure out what happens
when I set the startx / starty to different values.
What I understand is that these values do not specify "absolute
coordinates" somewhere on the paper, but are somehow relative
to each other. But how exactly?
\markup \hlinetwo gives a line positioned exactly like \hlineone, though
the stencil has different starty.
\markup \vlinetwo, however, gives a line starting at a different
vertical position than \vlineone.
Eventually I want to draw a kind of grid with horizontal and vertical
lines, placing little "scores" in them.
Attached is an example of what I want to achieve. But I do not want a
quick solution, instead I would be glad to understand
the stencil positioning better than now.
Kind regards,
Michael
If I understand correctly:
If you place a bunch of stencils on a page, then lilyponds
spacing-engine will drop in and white space may be disregarded. See:
\paper { markup-markup-spacing.padding = 5 }
\markup \hlineone
\markup \hlinetwo
\markup \vlineone
\markup \vlinetwo
And compare with:
\markup {
\hlineone
\hlinetwo
\vlineone
\vlinetwo
}
With the latter you can observe all the different settings (relative
to the previous stencil)
For your final goal, checkout the table-markup-list-command.
No lines implemented there, but probably a starting point.
Cheers,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user