summaryrefslogtreecommitdiff
path: root/scm
diff options
context:
space:
mode:
authorMasamichi Hosoda <trueroad@trueroad.jp>2016-06-19 11:59:45 +0900
committerMasamichi Hosoda <trueroad@trueroad.jp>2016-06-27 23:45:58 +0900
commit9b5a8ef057768b72d63e0e87667a953763e05272 (patch)
tree799e9b113260f68a85baf80962e76162913417f7 /scm
parent08d00bc3c27d182e2c59ccde7898a43fe03f81e4 (diff)
Issue 4901: Improve `-dgs-load-fonts` option for OTC fonts
`-dgs-load-fonts` loads fonts via Ghostscript. However, Ghostscript could not load OpenType/CFF Collection (OTC) fonts by this way. http://bugs.ghostscript.com/show_bug.cgi?id=696808 This commit lets `-dgs-load-fonts` loads the OTC fonts in a way that is not via Ghostscript.
Diffstat (limited to 'scm')
-rw-r--r--scm/framework-ps.scm19
1 files changed, 18 insertions, 1 deletions
diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm
index ae63cb91e9..42b60b4042 100644
--- a/scm/framework-ps.scm
+++ b/scm/framework-ps.scm
@@ -257,6 +257,18 @@
(ly:get-option 'datadir)))))
(define (load-font-via-GS font-name-filename)
+ (define (is-collection-font? file-name)
+ (let ((port (open-file file-name "rb")))
+ (if (eq? (read-char port) #\t)
+ (if (eq? (read-char port) #\t)
+ (if (eq? (read-char port) #\c)
+ (if (eq? (read-char port) #\f)
+ #t
+ #f)
+ #f)
+ #f)
+ #f)))
+
(define (ps-load-file file-name)
(if (string? file-name)
(if (string-contains file-name (ly:get-option 'datadir))
@@ -280,7 +292,12 @@
(ly:warning (_ "Font ~a cannot be loaded via Ghostscript because its font-index (~a) is not zero.")
name font-index)
(load-font font-name-filename))
- ;; TODO: Check OTC fonts.
+ ((and (string? bare-file-name)
+ (eq? (ly:get-font-format bare-file-name font-index) 'CFF)
+ (is-collection-font? bare-file-name))
+ (ly:warning (_ "Font ~a cannot be loaded via Ghostscript because it is an OpenType/CFF (OTC) font.")
+ name)
+ (load-font font-name-filename))
;; TODO: Check TrueType fonts that do not have glyph names.
(else
(cons name