Hello to everyone,
For some rather obscure reason I wanted to use old style numbers in a series of scores I'm working in. In a first moment I worked using some functions written by Michael Lauer (to be found in
https://www.mrlauer.org/music/) but they were intended for version 2.12 and I couldn't made them work in 2.19.
Here are my (meagre) findings mainly for reference to others' and also to know if they could be achieved in a better way. Also, they are some open questions.
As far as I know (Notation Reference, 1.8.3, Fonts), there is no global method to use old style figures (and, eventually other OpenFont features). This is what I did.
1.- Defined a new markup command to override the font-features property.
#(define-markup-command (oldStyleNum layout props text)
(markup?)
#:category font
(interpret-markup layout props
#{\markup \override #'(font-features . ("onum")) { #text }#}))
2.- Use this markup command to modify some stencils in a \layout section.
\layout {
\context {
\Score
\override BarNumber.stencil = #(lambda (grob) (grob-interpret-markup grob (markup #:oldStyleNum (ly:grob-property grob 'text))))
\override TextScript.stencil = #(lambda (grob) (grob-interpret-markup grob (markup #:oldStyleNum (ly:grob-property grob 'text))))
\override MetronomeMark.stencil = #(lambda (grob) (grob-interpret-markup grob (markup #:oldStyleNum (ly:grob-property grob 'text))))
}
}
This solves: BarNumbers, numbers inside any \markup and \tempo texts within the score.
Some open questions.
a) anything inside \header must be manually corrected using the \oldStyleNum. I couldn't find something as global.
b) They are some others "numbers" within a score: tuplet numbers, ottava brackets, etc. But altering them as the other examples is not so easy. TupletNumber.stencil is easy to alter, but doesn't work well with TupletBracket: the "spacing" and "centering" is somewhat different. And I couldn't isolate the "8" in ottava brackets to modify it. All the same I'm somewhat proud and satisfied with my results.
All the best,
F.