[Top][All Lists]

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

Aw: Re: Pseudo-handwritten font

From: Torsten Hämmerle
Subject: Aw: Re: Pseudo-handwritten font
Date: Thu, 14 Mar 2013 11:36:49 +0100 (CET)

Hello all,

I've just noticed the my last mail didn't get through to the list for some reason. Well, here it is again in a second attempt:

In the first place: I've attached a zip file containing the current (albeit unfinished) versions of the LilyJAZZ music and LilyJAZZ Text font plus the corresponding LilyJAZZ.ily include.
As an example to demonstrate what's already there (well, I missed grace notes/acciaccaturas/appoggiaturas) there's a PDF file for all those who'd like to take a look at the result without having to install anything.
At any rate, the whole LilyJAZZ issue shall be open and free (just like Lilypond), so I first had to create my own fonts in order to become independent of commercial ones.
It's (still) a preliminary version, many things are missing (spanners like trill-span, repeat bar lines, multi measure rests, ...), but you can use clefs, key signatures, time signatures, accidentals, note heads and flags, articulations, dynamics. And: there is a LilyJAZZ Text font included. Most characters should be there (including accented characters for German/French/Italian etc. texts).
I know that a chord font is indispensable for all virtually any jazz application, especially lead sheets, but I'll keep it separate first for several reasons (I'll get back to this soon).

BUT: Even if all this may be quite an ambitious task, I just started off to see what's possible and how Lilypond behaves in a jazz context. Fortunately, the results look quite encouraging. :)

So finally: what have I done and why?
The main obstacle is the rigid way Lilypond handles its (her, his?) internal music font. I deliberately decided to stick to an "ordinary" OTF/TTF font first to learn how to use external fonts (who knows what it's good for) and my metafont phase of life dates back to the last millennium.

In the meantime, most of the characters have been re-drawn manually from scans of the well-known Sigler fonts FontForge, a few still have been created using FontForge's tracing functionality. It should be enough for experimenting and getting an impression, though.

To match the overall appearance of the jazz font, I've slightly (perhaps too much...) increased the stem, beam, tie, slur, and bar line thickness. Nothing fancy about.

Currently, the "LilyJAZZ mode" can be switched on using the \jazzOn command and it can (almost) be switched off again using \jazzOff. This has proved most helpful in this early stage when comparing/checking spacing against the standard.

Some technical background for those interested in the scheme coding. Unforunately, I'm fairly new to scheme, but there's a lot of coding around to learn from.

The alist jazz-map contains mapping information from glyph name to unicode character number, so that any external font could be accessed as long as it supports Unicode:


#(define jazz-map '(
    ("noteheads.s0jazz" . #xe191)
    ("noteheads.s1jazz" . #xe192)
    ("noteheads.s2jazz" . #xe193)
    ("noteheads.s0slashjazz" . #xe19c)
    ("noteheads.s1slashjazz" . #xe19d)
    ("noteheads.s2slashjazz" . #xe19e)
    ("noteheads.s2crossjazz" . #xe1a1)
    ("flags.u3jazz" . #xe21c)
    ("flags.u4jazz" . #xe21d)


As a jazz replacement for \musicglyph, there now is a simliar \jazzglyph command that can be used in exactly the same way, returning the corresponding jazz font glyph.
Example: \musicglyph #"script.ufermata" becomes \jazzglyph #"scripts.ufermatajazz".


% JAZZGLYPH: REPLACEMENT FOR MUSICGLYPH ================================
#(define-markup-command (jazzglyph layout props glyphname) (string?)
  "musicglyph replacemet for jazz (i. e. non-Feta) characters"
    (let* ((charnum (cdr (assoc glyphname  jazz-map))))
    (interpret-markup layout props
      (markup (#:fontsize 5 #:override '(font-name . "LilyJAZZ") #:char charnum)))))


Having established this basic functionality, we can start actually changing various stencils.
Let's have a look at the clefs. The new jazz-clef stencil function appends the "jazz" suffix to the standard glyph name and searches the jazz-map lookup table. If there's no entry, the standard function ly:clef::print will be used.


#(define (jazz-clef grob)
  "jazz clef stencil"
  (let* ((glyphname (string-append (ly:grob-property grob 'glyph-name) "jazz")))   
    (if (pair? (assoc glyphname jazz-map))
        (grob-interpret-markup grob (markup #:jazzglyph glyphname))
        (ly:clef::print grob))))

Currently, I've just implemented three diffent note heads: whole, half and quarter, depending on the duration-log property. The stem-attachment has been slightly shifted to match the steeper "slope" of the jazz noteheads and the increased stem thickness.


#(define (jazz-notehead grob)
  "stencil: jazz noteheads"
  (let* ((log (ly:grob-property grob 'duration-log)))
     (set! (ly:grob-property grob 'stem-attachment) '(1.0 . 0.35))
     (grob-interpret-markup grob
         ((<= log 0) (markup #:jazzglyph "noteheads.s0jazz"))
         ((<= log 1) (markup #:jazzglyph "noteheads.s1jazz")) 
     (else  (markup #:jazzglyph "noteheads.s2jazz"))))))


These new stencil functions now can be assigned, e. g.

  \override Staff.Clef #'stencil = #jazz-clef

  \override Staff.NoteHead #'stencil = #jazz-notehead 
  \override Staff.NoteHead #'Y-extent = \makeUnpurePureContainer

The use of pure-unpure-containers is tremendously important in certain cases, because otherwise, the spacing will go belly up.

That's basically the way LilyJAZZ works, the coding of the first line in the demo PDF looks thus:

\version "2.16.1"

\include "LilyJAZZ.ily"

\paper { indent = #10 }

\relative c' {
  \set Staff.instrumentName = "Trumpet"
  \clef treble
  \key es \major
  \time 4/4
  \tempo "Medium Swing"
   r8 es4->\mf f8-. g--  as4-^ bes8-^  |
   r4. b8\trill\fff ~ b2 |
   bes?16-> r as4\mp r8 g4( \times 2/3 { es8 f e\pp ~ } |
   e1) \fermata |
   \bar "||"
   \mark \markup \jazzglyph #"scripts.varsegnojazz"
   \clef bass
   \time 5/4
   \key g \major
   geses,4_"Various Accidentals" ges g gis gisis |

As you can see, apart from the \include statement and the \jazzOn command, it's still standard lilypond input without many special "jazz commands" and tweaking. The second example in the PDF is also totally standard Lilypond output without any manual corrections.
Of course, there are some spacing issues, but after all, vaticana neumes or modern Gregorian ligatures have their problems, either, so we’re in good company here. ;-)
And, yes, I have refrained so far from using "pango-font-tree", just to keep track of what might still be missing.

All the best,

Attachment: jazz-test-3.pdf
Description: Adobe PDF document

Description: Zip archive

reply via email to

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