1 Description: Add set-global-fonts function to scm/font.scm
2 Allow changing of notation fonts
4 This commit changes the behaviour of make-pango-font-tree in the
7 - Make all arguments optional key/value pairs
8 keeping the current default values (emmentaler/Century Schoolbook)
9 - Allow changing of music fonts too.
11 Currently alternative music fonts have to be present in the font
12 directory besides Emmentaler fonts, and they have to be manually installed.
13 But now there are a number of alternative and compatible fonts available.
16 - https://sites.google.com/site/tisimst/lilypond-fonts/docs
17 - http://lilypondblog.org/2015/03/managing-alternative-fonts-with-lilypond/
18 Author: Abraham Lee <tisimst.lilypond@gmail.com>
19 Date: Sat Aug 2 18:17:01 2014 +0200
21 Applied-Upstream: 2.19.12, http://git.savannah.gnu.org/cgit/lilypond.git/commit/?id=a7b6efba453f6bec916d3908cd83bcb825b2a1a8
22 Reviewed-by: Urs Liska <ul@openlilylib.org>
23 Reviewed-by: Anthony Fok <foka@debian.org>
24 Last-Update: 2017-01-25
26 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
30 ;;;; This file is part of LilyPond, the GNU music typesetter.
32 -;;;; Copyright (C) 2004--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
33 +;;;; Copyright (C) 2004--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
35 ;;;; LilyPond is free software: you can redistribute it and/or modify
36 ;;;; it under the terms of the GNU General Public License as published by
39 ;; Each size family is a vector of fonts, loaded with a delay. The
40 ;; vector should be sorted according to ascending design size.
41 -(define-public (add-music-fonts node name family design-size-alist factor)
42 +(define-public (add-music-fonts node family name brace design-size-alist factor)
47 @var{node} is the font tree to modify.
50 +@var{family} is the family name of the music font.
53 @var{name} is the basename for the music font.
54 @file{@var{name}-<designsize>.otf} should be the music font,
55 -@file{@var{name}-brace.otf} should have piano braces.
58 -@var{family} is the family name of the music font.
59 +@var{brace} is the basename for the brace font.
60 +@file{@var{brace}-brace.otf} should have piano braces.
63 @var{design-size-alist} is a list of @code{(rounded . designsize)}.
66 (fetaBraces ,(ly:pt 20.0)
67 #(,(delay (ly:system-font-load
68 - (format #f "~a-brace" name)))))
69 + (format #f "~a-brace" brace)))))
72 (define-public (add-pango-fonts node lily-family family factor)
74 (add-node 'italic 'normal)
75 (add-node 'italic 'bold))
77 +; This function allows the user to change the specific fonts, leaving others
78 +; to the default values. This way, "make-pango-font-tree"'s syntax doesn't
79 +; have to change from the user's perspective.
85 +; #:music "gonville" ; (the main notation font)
86 +; #:roman "FreeSerif" ; (the main/serif text font)
90 +; Leaving out "#:brace", "#:sans", and "#:typewriter" leave them at
91 +; "emmentaler", "sans-serif", and "monospace", respectively. All fonts are
92 +; still accesible through the usual scheme symbols: 'feta, 'roman, 'sans, and
94 +(define*-public (set-global-fonts #:key
95 + (music "emmentaler")
96 + (brace "emmentaler")
97 + (roman "Century Schoolbook L")
99 + (typewriter "monospace")
101 + (let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
102 + (add-music-fonts n 'feta music brace feta-design-size-mapping factor)
103 + (add-pango-fonts n 'roman roman factor)
104 + (add-pango-fonts n 'sans sans factor)
105 + (add-pango-fonts n 'typewriter typewriter factor)
108 (define-public (make-pango-font-tree roman-str sans-str typewrite-str factor)
109 (let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
110 - (add-music-fonts n "emmentaler" 'feta feta-design-size-mapping factor)
111 + (add-music-fonts n 'feta "emmentaler" "emmentaler" feta-design-size-mapping factor)
112 (add-pango-fonts n 'roman roman-str factor)
113 (add-pango-fonts n 'sans sans-str factor)
114 (add-pango-fonts n 'typewriter typewrite-str factor)
116 (define-public (make-century-schoolbook-tree factor)
117 (make-pango-font-tree
118 "Century Schoolbook L"
119 - "sans-serif" "monospace" factor))
124 (define-public all-text-font-encodings