lilypond-user
[Top][All Lists]
Advanced

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

Re: Problem with a font


From: Walter Garcia-Fontes
Subject: Re: Problem with a font
Date: Thu, 5 Apr 2018 19:50:41 +0200
User-agent: Mutt/1.9.4 (2018-02-28)

Thanks a lot Torsten. I got such great responses, that I think it is
worth it to finish this thread with a short summary. 

The problem arose with a font which can be downloaded from here:

http://www.edu.xunta.gal/centros/ceipfrions/system/files/u1/Escolar_2_Negra.zip

This is a handwriting font. If I use it in a word processing system,
like LibreOffice Writer, I get a correct apostroph, but if I use it in
LilyPond with the following code, the apostroph comes too low:

\version "2.18.2"

\paper {
   #(define fonts
      (make-pango-font-tree
       "Escolar2"
       "Escolar2"
       "Escolar2"
       (/ staff-height pt 20)))
}

\markup{This is showing the problem '}

The problem is caused because actually the character ' is defined in
this font very low, so LilyPond does the right thing. Instead what
LibreOffice does it to substitute this character by a typographic
apostroph: ’. Since (at least I) we use a text editor to code LilyPond, we
do not get this typographic apostroph. I use emacs, and to get this
character I have to do the following: 
control + x + 8 + RET , and then enter 2019. 

If I use this character, LilyPond renders the apostroph exactly as
Writer. 

LibreOffice Writer is actually also able to slant and bold this font,
without having specific bold and slant versions for the font. LilyPond
actually is also able to do it, for instance slant can be gotten by this
snippet: 

> %%%%% BEGIN OF SNIPPET
#(define-markup-command
  (slanted layout props arg)
  (markup?)
  #:category font
  #:properties ((slant-angle 12))
  "Fake a slanted font"
  (let* ((alpha-rad (* 0.5 (acos (tan (* (/ PI -180) slant-angle)))))
         (alpha-deg (* (/ 180 PI) alpha-rad))
         (stencil
          (if (markup? arg)
              (interpret-markup layout props arg)
              empty-stencil))
         (x-ext (ly:stencil-extent stencil X))
         (y-ext (ly:stencil-extent stencil Y)))
    (ly:make-stencil
     (ly:stencil-expr
      (ly:stencil-scale
       (ly:stencil-rotate
        (ly:stencil-scale
         (ly:stencil-rotate
          (ly:make-stencil (ly:stencil-expr stencil) (cons 0 0) (cons 0 0))
          45 0 0)
         1
         (* (tan alpha-rad)))
        (* (- alpha-deg)) 0 0)
       (* (sqrt 2) (cos alpha-rad)) (/ 0.5 (sqrt 0.5) (sin alpha-rad))))
     x-ext y-ext)))
%%%%% END OF SNIPPET

I take the homework to try to code a snippet that would "bold" the
font. That must be harder, not that I not find hard the above code.

Thanks a lot to everybody who answered in this thread,

-- 
Walter Garcia-Fontes
L'Hospitalet de Llobregat



reply via email to

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