summaryrefslogtreecommitdiff
path: root/scm
diff options
context:
space:
mode:
authorMasamichi Hosoda <trueroad@trueroad.jp>2016-06-12 19:25:28 +0900
committerMasamichi Hosoda <trueroad@trueroad.jp>2016-06-18 19:52:54 +0900
commit26290fcc37069b55eb26aef84c912d1c2a59e7dc (patch)
tree2b0f684b4c174ec210aa62754e31818594713efb /scm
parent211634be6f90db700eb8e5725046b27aa153ee92 (diff)
Issue 4866/1: Improve OTC fonts support
This commit adds to distinguish font type without filename extension, and to switch font embedding method by font type. OpenType/CFF Collection (OTC) fonts which have filename extension `*.ttc' can be used.
Diffstat (limited to 'scm')
-rw-r--r--scm/framework-ps.scm25
1 files changed, 9 insertions, 16 deletions
diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm
index 9dc8414bbf..fe7a925d71 100644
--- a/scm/framework-ps.scm
+++ b/scm/framework-ps.scm
@@ -331,24 +331,17 @@
embed))
(define (font-file-as-ps-string name file-name font-index)
- (let* ((downcase-file-name (string-downcase file-name)))
+ (let ((font-format (ly:get-font-format file-name font-index)))
(cond
- ((and file-name (string-endswith downcase-file-name ".pfa"))
+ ((eq? font-format (string->symbol "Type 1"))
+ ;; Type 1 (PFA and PFB) fonts
(ly:type1->pfa file-name))
- ((and file-name (string-endswith downcase-file-name ".pfb"))
- (ly:type1->pfa file-name))
- ((and file-name (string-endswith downcase-file-name ".ttf"))
- (ly:ttf->pfa file-name))
- ((and file-name (string-endswith downcase-file-name ".ttc"))
- ;; TODO: distinguish files which have extension `*.ttc'
- ;; whether TrueType Collection (TTC) fonts
- ;; or OpenType/CFF Collection (OTC) fonts.
- (ly:ttf->pfa file-name font-index)) ;; TTC fonts
- ((and file-name (string-endswith downcase-file-name ".otf"))
- (ps-embed-cff (ly:otf->cff file-name) name 0))
- ((and file-name (string-endswith downcase-file-name ".otc"))
- ;; The files which have the extension `*.otc' are OTC fonts.
- (ps-embed-cff (ly:otf->cff file-name font-index) name 0)) ;; OTC fonts
+ ((eq? font-format 'TrueType)
+ ;; TrueType fonts (TTF) and TrueType Collection (TTC)
+ (ly:ttf->pfa file-name font-index))
+ ((eq? font-format 'CFF)
+ ;; OpenType/CFF fonts (OTF) and OpenType/CFF Collection (OTC)
+ (ps-embed-cff (ly:otf->cff file-name font-index) name 0))
(else
(ly:warning (_ "do not know how to embed ~S=~S") name file-name)
""))))