lilypond-user
[Top][All Lists]
Advanced

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

Re: changing feta23 fonts


From: Thomas Morley
Subject: Re: changing feta23 fonts
Date: Sun, 16 May 2021 15:25:13 +0200

Am So., 16. Mai 2021 um 13:49 Uhr schrieb <darkijah@jesusgod-pope666.info>:
>
> Abraham... I just wanted to figure out HOW to change the notefond from
> whatever is it to one of the feta 18, 20 or whatever size - that was all
> I was looking for.
>
> For the other one responding which name alludes me.
> thanks for the size tip on the notehead that might be useful as well! :)
>
> Dearly regards
> - Darkijah
>
>
>
> On 2021-05-14 16:35, Abraham Lee wrote:
> > Hi, Darkijah!
> >
> > On Fri, May 14, 2021 at 8:08 AM <darkijah@jesusgod-pope666.info>
> > wrote:
> >
> >> It's not the staff I have issues with, it is how to fix the font in
> >> the
> >> noteheads.
> >>
> >> Dearly regards
> >> - Darkijah
> >
> > Just some background info. LilyPond is designed to use a certain font
> > size given a specified staff height, as Karlin was suggesting by
> > changing the staff instead of directly changing the font. Meaning, the
> > default 5-line staff is 20 pts high and the feta20 font was designed
> > to be optically appropriate for that size of staff. Similarly, feta18
> > is designed to be the best choice for an 18pt staff, and so on for the
> > other sizes. Perhaps you could describe what you mean by "how to fix
> > the font in the noteheads" a bit more so we can give you more accurate
> > help?
> >
> > Best,
> > Abraham
>

I recommend to forget all about changing the default font of NoteHead
to different sizes of that default font directly.
LilyPond will always do it for you.
Again, forget about it, well, until you have a real use case.

Tl;dr
There are commands like set-global-staff-size, layout-set-staff-size,
\set fontSize, magnifyStaff and others, which will force other sizes.
All for a different pupose.
You may study below, but don't uncomment all at once, the result is not nice.

\version "2.22.1"

#(define (lists-map function ls)
  "Apply @var{function} to @var{ls} and all of it sublists.
First it recurses over the children, then the function is applied to
@var{ls}."
    (if (list? ls)
        (set! ls (map (lambda (y) (lists-map function y)) ls))
        ls)
    (function ls))

printStencilExpressionFonts =
#(lambda (grob)
  (let* ((stil (ly:grob-property grob 'stencil))
         (stil-expr (ly:stencil-expr stil))
         (output '())
         ;; Finde font-names und speichere sie in "output"
         ;; Die Methode muß zwischen "named-glyph" und "glyph-string"
         ;; differenzieren, da LilyPond das intern anders umsetzt.
         (store-font-names
           (lambda (entry)
             (cond
                   ;; Wenn die stencil-expression irgendwo "named-glyph"
                   ;; beinhaltet, dann extrahiere die Schriftart via
                   ;; ly:font-name aus dem zweiten Eintrag der mit "named-glyph"
                   ;; anfangenden Liste.
                   ;; Erweitere output mit dem Ergebnis.
                   ((and (list? entry)
                         (eq? 'named-glyph (car entry))
                         (ly:font-metric? (cadr entry)))
                     (set! output
                           (cons (ly:font-name (cadr entry)) output)))
                   ((and (list? entry)
                   ;; Wenn die stencil-expression irgendwo "glyph-string"
                   ;; beinhaltet, dann extrahiere die Schriftart indem das
                   ;; dritte Element, der mit "glyph-string" anfangenden Liste
                   ;; ausgewählt wird, ly:font-name würde hier #f zurückgeben.
                   ;; Erweitere output mit dem Ergebnis.
                         (eq? 'glyph-string (car entry))
                         (ly:font-metric? (cadr entry)))
                     (set! output
                           (cons (caddr entry) output)))
                   ;; Ansonsten mache nichts weiter.
                   (else entry)))))
        (lists-map store-font-names stil-expr)
    (pretty-print (cons (grob::name grob) (reverse output)))))

printNoteHeadFont =
\override NoteHead.after-line-breaking = \printStencilExpressionFonts

%#(set-global-staff-size 11.22)

\score {
  \new Staff %\with { \magnifyStaff #1/4 }
  {
    \printNoteHeadFont
    a'8
%    \once \override NoteHead.font-size = 3
    b'
    c''
%    \set fontSize = 5
    d''
  }
  \layout {
      \autoBeamOff
      #(layout-set-staff-size 50)
  }
}

Cheers,
  Harm



reply via email to

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