Hi Kevin,
I did this together with Kieren ... it didn't make its way into the
lilypond-codebase ... I should create a path.
Anyway - I attached the file, we developed last year(?).
The allowGrobCallback is needed to allow callbacks in the
font-interface. \absFontSize creates a procedure, which returns a
font-size corresponding to the given point-size.
HTH, Jan-Peter
On 06.06.2014 15:39, Kevin Patrick Barry wrote:
> Dear Federico,
>
> Thank you for responding. I had read the section you linked (and
> copied the code at the bottom into a style file). There are two
> problems: I can't use an absolute font size in an override, which I
> need, and if I change the font size in the paper block with the pango
> function all of the emmentaler glyphs are resized also. I would like a
> single command, that can accept an absolute font size, to only apply
> to Textscript. Is this possible? I don't want to have to fill all the
> files with \abs-fontsize.
>
> Kevin
>
>
> On Fri, Jun 6, 2014 at 1:39 PM, Federico Bruni <[email protected]
> <mailto:[email protected]>> wrote:
>
> 2014-06-06 14:31 GMT+02:00 Kevin Patrick Barry <[email protected]
> <mailto:[email protected]>>:
>
> Dear LilyPond users,
>
> I would like the font in a series of files to be size 10, but
> I don't want to have to put \abs-fontsize in every markup. I
> would prefer to put it in my style file, but when I mess with
> the font sizes there, the size of the music glyphs also
> changes. Is there a way to change the absolute font size of
> just the textscript?
>
>
> Here's explained how to change the font size of a specific object:
>
> http://lilypond.org/doc/v2.18/Documentation/notation/fonts#single-entry-fonts
>
> If you know which object to apply it to, it should work.
>
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.18.0"
allowGrobCallback =
#(define-scheme-function (parser location syms) (symbol-list?)
(let ((interface (car syms))
(sym (cadr syms)))
#{
\with {
\consists #(lambda (context)
`((acknowledgers .
((,interface . ,(lambda (engraver grob source-engraver)
(let ((prop (ly:grob-property grob sym)))
(if (procedure? prop) (ly:grob-set-property! grob sym (prop grob)))
))))
))
)
}
#}))
absFontSize =
#(define-scheme-function (parser location pt)(number?)
(lambda (grob)
(let* ((layout (ly:grob-layout grob))
(ref-size (ly:output-def-lookup (ly:grob-layout grob) 'text-font-size 12)))
(magnification->font-size (/ pt ref-size))
)))
\layout {
\context {
\Score
\allowGrobCallback font-interface.font-size
% some "global" overrides
\override TextScript.font-size = \absFontSize #16
\override LyricText.font-size = \absFontSize #7
\override InstrumentName.font-size = \absFontSize #24
\override BarNumber.font-size = \absFontSize #18
}
}
% example Music
\paper {
% just to make the huge instrument name fit
left-margin = 2\cm
}
\new Staff \with {
instrumentName = "Melodie"
shortInstrumentName = "Mel"
} \new Voice {
\repeat unfold 19 \relative c'' { bes4^"Hello" a c b }
\break
\once \override Score.BarNumber.font-size = \absFontSize 40
\once \override TextScript.font-size = \absFontSize 30
\once \override Score.LyricText.font-size = \absFontSize 40
\once \override Score.LyricText.stencil =
#(lambda (grob)
(let* ((lyr (ly:grob-property grob 'text))
(stil (lyric-text::print grob))
(stil-ref (grob-interpret-markup grob (markup #:with-color red #:abs-fontsize 40 lyr))))
; store lyric-text stencil and lyric markup
(ly:parser-define! parser 'lyrstil stil)
(ly:parser-define! parser 'lyrmup lyr)
(ly:stencil-add stil stil-ref)))
\repeat unfold 6 \relative c'' {
bes4^"World" a c b
}
} \addlyrics {
\repeat unfold 25 { B A C H }
}
% create a markup from stored lyric stencil and markup
#(define-markup-command (debug layout props)()
(ly:stencil-add lyrstil (interpret-markup layout props (markup #:with-color red #:abs-fontsize 40 lyrmup))))
\markup { \debug }
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user