From: Masamichi Hosoda Date: Sat, 18 Jun 2016 13:49:44 +0000 (+0900) Subject: Issue 4900: Improve `-dgs-load-fonts` option for non-zero font-index X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=08d00bc3c27d182e2c59ccde7898a43fe03f81e4;p=lilypond.git Issue 4900: Improve `-dgs-load-fonts` option for non-zero font-index `-dgs-load-fonts` loads fonts via Ghostscript. However, it could not load the font that has non-zero font-index. This commit lets it loads the font in a way that is not via Ghostscript. --- diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index fe7a925d71..ae63cb91e9 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -272,19 +272,29 @@ (let* ((font (car font-name-filename)) (name (cadr font-name-filename)) (file-name (caddr font-name-filename)) + (font-index (cadddr font-name-filename)) (bare-file-name (ly:find-file file-name))) - (cons name - (if (mac-font? bare-file-name) - (handle-mac-font name bare-file-name) - (cond - ((and font (cff-font? font)) - (ps-load-file (ly:find-file - (format #f "~a.otf" file-name)))) - ((string? bare-file-name) - (ps-load-file file-name)) - (else - (ly:warning (_ "cannot embed ~S=~S") name file-name) - "")))))) + (cond + ((and (number? font-index) + (!= font-index 0)) + (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. + ;; TODO: Check TrueType fonts that do not have glyph names. + (else + (cons name + (if (mac-font? bare-file-name) + (handle-mac-font name bare-file-name) + (cond + ((and font (cff-font? font)) + (ps-load-file (ly:find-file + (format #f "~a.otf" file-name)))) + ((string? bare-file-name) + (ps-load-file file-name)) + (else + (ly:warning (_ "cannot embed ~S=~S") name file-name) + "")))))))) (define (dir-join a b) (if (equal? a "")