]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4900: Improve `-dgs-load-fonts` option for non-zero font-index
authorMasamichi Hosoda <trueroad@trueroad.jp>
Sat, 18 Jun 2016 13:49:44 +0000 (22:49 +0900)
committerMasamichi Hosoda <trueroad@trueroad.jp>
Mon, 27 Jun 2016 14:45:58 +0000 (23:45 +0900)
`-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.

scm/framework-ps.scm

index fe7a925d7196593f427c624c71d9e47b71e24169..ae63cb91e9f3e85fd256710c5dd26625a07b888c 100644 (file)
     (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 "")