[Top][All Lists]

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

Re: lilypond-book: "external" fonts and --pdf option problem

From: Masamichi HOSODA
Subject: Re: lilypond-book: "external" fonts and --pdf option problem
Date: Sat, 12 Dec 2015 02:22:52 +0900 (JST)

> Thank you for finding this. I'm wondering if there is a more generic way to
> identify third-party fonts rather than hard-coding it like this? Perhaps by
> checking if the font has the LILY, LILC, and LILF subtables? I'm just
> brain-storming...

How about following patch?

In the case of text font, variable `font' is set to #f.
In the case of music font, variable `font' is set to non-#f.

diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm
index 60d7bb3..f6d1700 100644
--- a/scm/framework-ps.scm
+++ b/scm/framework-ps.scm
@@ -246,10 +246,15 @@
 (define (write-preamble paper load-fonts? port)
-  (define (internal-font? file-name)
-    (or (string-startswith file-name "Emmentaler")
-        (string-startswith file-name "emmentaler")
-        ))
+  (define (internal-font? font-name-filename)
+    (let* ((font (car font-name-filename))
+           (file-name (caddr font-name-filename))
+           (font-file-name (ly:find-file (format #f "~a.otf" file-name))))
+      (and font
+           (cff-font? font)
+           font-file-name
+           (string-contains font-file-name
+                            (ly:get-option 'datadir)))))
   (define (load-font-via-GS font-name-filename)
     (define (ps-load-file file-name)
@@ -272,7 +277,7 @@
             (if (mac-font? bare-file-name)
                 (handle-mac-font name bare-file-name)
-                 ((internal-font? file-name)
+                 ((and font (cff-font? font))
                   (ps-load-file (ly:find-file
                                  (format #f "~a.otf" file-name))))
                  ((string? bare-file-name)
@@ -402,7 +407,7 @@
                     ((ly:get-option 'gs-load-lily-fonts)
                      (if (or (string-contains (caddr name)
                                               (ly:get-option 'datadir))
-                             (internal-font? (caddr name)))
+                             (internal-font? name))
                          (load-font-via-GS name)
                          (load-font name)))

reply via email to

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