lilypond-user
[Top][All Lists]
Advanced

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

Re: Fonts for text


From: Thomas Morley
Subject: Re: Fonts for text
Date: Sun, 26 Apr 2020 09:22:47 +0200



Am Sa., 25. Apr. 2020 um 23:36 Uhr schrieb Ignacio Lois <address@hidden>:
AAAAAAAH!!

\version "2.19.83"

\header {
    title = \markup {
      \override #'(font-name . "ITC Souvenir")
              "My Title"
            }
}

\score {
  c''
}

Now that's the example I should have sent. Can anyone check the fonts? There's the links to install them in my original email. The fonts work fine elsewhere.

I've downloaded and installed the itc-souvenir fonts.

All's working here (64-bit Ubuntu 18.04)

Some debugging code below (too lazy to translate the german comments).
Does not work for toplevel-markup. One could probably define a markup-command for debugging, though...

#(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)))))

   
\header {
    title = \markup {
      \override #'(font-name . "ITC Souvenir")
              "My Title"
            }
}

{
  \override TextScript.after-line-breaking = #printStencilExpressionFonts
  \textLengthOn
  %% default
  b1-\markup "My Title"
  %% fall-back
  b-\markup \override #'(font-name . "Times New Roman") "My Title"
  %% all working
  b-\markup \override #'(font-name . "Times New Roman,") "My Title"
  b-\markup \override #'(font-name . "ITC Souvenir") "My Title"
  b-\markup \override #'(font-name . "ITC Souvenir Bold") "My Title"
}

-->
(TextScript "TeXGyreSchola-Regular")
(TextScript "DejaVuSans")
(TextScript "TimesNewRomanPSMT")
(TextScript "Souvenir-Medium")
(TextScript "Souvenir-Bold")


Cheers,
  Harm

reply via email to

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