lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting font-features globally?


From: Valentin Petzel
Subject: Re: Setting font-features globally?
Date: Mon, 27 Feb 2023 13:53:44 +0100

Hello John,

you can do this by setting this in the default props:

\paper {
    #(define fonts
        (set-global-fonts
            #:roman      "Linux Libertine"
            #:factor (/ staff-height pt 20)
        ))
    text-font-defaults = #(assoc-set! text-font-defaults 'font-features 
'("smcp"))
}

\markup "abc"

But keep in mind that \override '((font-feature . (...))) needs to specify all 
font features, which is a bit of a hassle, as this requires you to add this 
feature to all places where you change features.

Alternatively you might want to use a markup command like this instead:

\paper {
    #(define fonts
        (set-global-fonts
            #:roman      "Linux Libertine"
            #:factor (/ staff-height pt 20)
        ))
    text-font-defaults = #(assoc-set! text-font-defaults 'font-features 
'("smcp"))
}

#(define-markup-command (with-font-features layout props feats markup)
   ((lambda (x) (or (string? x) (list? x))) markup?)
   #:properties ((font-features '()))
   (if (not (list? feats)) (set! feats (list feats)))
   (let* ((add-feats (filter (lambda (x) (not (eq? (string-ref x 0) #\-))) 
feats))
          (rm-feats (filter (lambda (x) (eq? (string-ref x 0) #\-)) feats))
          (rm-feats (map (lambda (x) (substring x 1)) rm-feats))
          (font-features (if font-features font-features '()))
          (font-features (lset-difference equal? font-features rm-feats))
          (font-features (lset-union equal? font-features add-feats))
          (font-features (if (null? font-features) #f font-features)))
     (interpret-markup layout
                       (prepend-alist-chain
                        'font-features font-features
                        props)
                       markup)))

\markup "abc"
\markup \with-font-features "lnum" "A12a"
\markup \with-font-features "onum" "A12a"
\markup \with-font-features "-smcp" "abc"

Cheers,
Valentin

Am Montag, 27. Februar 2023, 06:52:25 CET schrieb John Zaitseff:
> Hello,
> 
> I have a fairly large collection of LilyPond music scores that I
> have entered over the years.  Now that I have access to the rather
> nice Adobe Minion 3 set of fonts, I would like to use them for my
> scores.  I have successfully included the following in my
> stylesheet:
> 
>   \paper {
>       #(define fonts
>           (set-global-fonts
>               #:roman      "Minion 3,"
>               #:sans       "Myriad Pro,"
>               #:typewriter "Hack,"
>               #:factor (/ staff-height pt 20)
>           ))
>   }
> 
> However, I'd like to use the SS03 font feature of Minion 3
> (trapezoid variants of Cyrillic DE and EL [1]) everywhere that text
> appears.  Is this possible?  If so, how?  I don't mind writing
> Scheme to do it!
> 
> [1] https://minion.typekit.com/usage/
> 
> I know I can do something like:
> 
>   \layout {
>       \context { \Lyrics \override LyricText.font-features = #'("ss03") }
>       # ... every other context / text variation here
>   }
> 
> but this misses headings, page headers and footers and verse text
> typeset after a score.
> 
> In short, is there a way to set "ss03" globally?
> 
> Yours truly,
> 
> John Zaitseff

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]