diff options
author | Masamichi Hosoda <trueroad@trueroad.jp> | 2016-07-04 23:22:54 +0900 |
---|---|---|
committer | Masamichi Hosoda <trueroad@trueroad.jp> | 2016-07-11 22:55:54 +0900 |
commit | 4164bfb62950c46517a21ad1d80131ce27868aa1 (patch) | |
tree | 4d187265f81698b4b62a729bca31b2dd8a5be5a7 /scm | |
parent | 9821acee8db5d01c9f625d9bf15ac6720bc0f59e (diff) |
Issue 4918: Fix CFF flavored font embedding for multiple output
For multiple output (e.g. `-dbackend=eps`),
conflict checking needs to be done within each output.
Otherwise, the font which is embedded in the prior output
is not embedded in the subsequent output.
Diffstat (limited to 'scm')
-rw-r--r-- | scm/framework-ps.scm | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 8221e5eab3..bc6599c70b 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -248,27 +248,32 @@ (define check-conflict-and-embed-cff (let ((font-list '())) (lambda (name file-name font-index) - (let* ((name-symbol (string->symbol name)) - (args-filename-offset - (cons file-name (ly:get-cff-offset file-name font-index))) - (found-filename-offset (assq name-symbol font-list))) - (if found-filename-offset - (begin - (if (equal? args-filename-offset (cdr found-filename-offset)) - (ly:debug - (_ "CFF font `~a' already embedded, skipping.") - name) - (ly:warning - (_ "Different CFF fonts which have the same name `~a' has been detected. The font cannot be embedded.") - name)) - "") - (begin - (ly:debug - (_ "Embedding CFF font `~a'") - name) - (set! font-list - (acons name-symbol args-filename-offset font-list)) - (ps-embed-cff (ly:otf->cff file-name font-index) name 0))))))) + (if name + (let* ((name-symbol (string->symbol name)) + (args-filename-offset + (cons file-name (ly:get-cff-offset file-name font-index))) + (found-filename-offset (assq name-symbol font-list))) + (if found-filename-offset + (begin + (if (equal? args-filename-offset (cdr found-filename-offset)) + (ly:debug + (_ "CFF font `~a' already embedded, skipping.") + name) + (ly:warning + (_ "Different CFF fonts which have the same name `~a' has been detected. The font cannot be embedded.") + name)) + "") + (begin + (ly:debug (_ "Embedding CFF font `~a'.") name) + (set! font-list + (acons name-symbol args-filename-offset font-list)) + (ps-embed-cff (ly:otf->cff file-name font-index) name 0)))) + (begin + (ly:debug (_ "Initializing embedded CFF font list.")) + (set! font-list '())))))) + +(define (initialize-font-embedding) + (check-conflict-and-embed-cff #f #f #f)) (define (write-preamble paper load-fonts? port) (define (internal-font? font-name-filename) @@ -575,6 +580,7 @@ mark {ly~a_stream} /CLOSE pdfmark (page-number (1- (ly:output-def-lookup paper 'first-page-number))) (page-count (length page-stencils)) (port (ly:outputter-port outputter))) + (initialize-font-embedding) (if (ly:get-option 'clip-systems) (clip-system-EPSes basename book)) (if (ly:get-option 'dump-signatures) @@ -655,6 +661,7 @@ mark {ly~a_stream} /CLOSE pdfmark (rounded-bbox (to-rounded-bp-box bbox)) (port (ly:outputter-port outputter)) (header (eps-header paper rounded-bbox load-fonts))) + (initialize-font-embedding) (display header port) (write-preamble paper load-fonts port) (display "/mark_page_link { pop pop pop pop pop } bind def\n" port) |