Hi Kieren,
now I am looking at this feature request and maybe have an idea ...
later more on that.
Your snippet here fails, because the InstrumentName grob has two
properties 'long-text and 'text, which may or may not be set. The 'text
property is only set, when you define a shortInstrumentName, in this
case only 'long-text is set (-> instrumentName), so (ly:grob-property
grob 'text) returns '(), which is not a string or markup.
The example compiles, if you check for existance of the properties:
--snip--
#(define ((set-abs-fontsize n) grob)
(let ((text (ly:grob-property grob 'text))
(long-text (ly:grob-property grob 'long-text)))
(ly:message "~A" (ly:grob-properties grob))
(cond
((markup? text)
(grob-interpret-markup grob
(markup #:abs-fontsize n text)))
((markup? long-text)
(grob-interpret-markup grob
(markup #:abs-fontsize n long-text)))
(else empty-stencil)
)))
absFontSizeStencil =
#(define-scheme-function (parser location n)(number?)
(set-abs-fontsize n))
\layout {
\context {
\Score
\override InstrumentName #'stencil = \absFontSizeStencil 30
\override TextScript #'stencil = \absFontSizeStencil 30
}
}
--snip--
... but now the long-text is printed on every line - not only the first.
Best, Jan-Peter
Am 16.07.2013 18:30, schrieb Kieren MacMillan:
I don't mind Mike's function per se, but I would love for Lilypond to allow us
to set absolute fontsizes for every text object — maybe every grob (text or
not) — in a consistent way. For example, this fails
\version "2.17"
#(define ((set-abs-fontsize n) grob)
(grob-interpret-markup grob
(markup #:abs-fontsize n (ly:grob-property grob 'text))))
\layout {
\context {
\Score
\override InstrumentName #'stencil = #(set-abs-fontsize 30)
\override TextScript #'stencil = #(set-abs-fontsize 30)
}
}
\new Staff \with { instrumentName = "Test" }
\relative c' { e4^\markup "Test" e e e }
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user