X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fframework-ps.scm;h=2cd9b5edc619bd6e067081cbbd521a30a65ef386;hb=750b714488c5af6eae22d07163bba8b554734ac6;hp=aee522e0fa7e53b55101b7f14350d7d27fe2eeaa;hpb=38b0e0930b677ddcaa153d7d7d4b6dac19a63b22;p=lilypond.git diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index aee522e0fa..2cd9b5edc6 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -538,13 +538,22 @@ (set! never-embed-font-list (list)) (if (ly:get-option 'font-export-dir) (let ((dirname (format #f "~a" (ly:get-option 'font-export-dir)))) - (if (file-exists? dirname) - (ly:debug - (_ "Font export directory `~a' already exists.") dirname) - (begin - (ly:debug - (_ "Making font export directory `~a'.") dirname) - (mkdir dirname))))) + (ly:debug + (_ "Making font export directory `~a'.") dirname) + (catch + 'system-error + (lambda () + ;; mkdir: + ;; When the directory already exists, it raises system-error. + (mkdir dirname)) + (lambda stuff + ;; Catch the system-error + (if (= EEXIST (system-error-errno stuff)) + ;; If the directory already exists, avoid error. + (ly:debug + (_ "Font export directory `~a' already exists.") dirname) + ;; If the cause is something else, re-throw the error. + (throw 'system-error (cdr stuff))))))) (if load-fonts? (for-each (lambda (f) (format port "\n%%BeginFont: ~a\n" (car f)) @@ -590,8 +599,14 @@ (define (metadata-encode val) ;; First, call ly:encode-string-for-pdf to encode the string (latin1 or ;; utf-16be), then escape all parentheses and backslashes - ;; FIXME guile-2.0: use (string->utf16 str 'big) instead - + ;; + ;; NOTE: with guile-2.0+ ly:encode-string-for-pdf is not really needed and + ;; could be replaced with the following code: + ;; + ;; (let* ((utf16be-bom #vu8(#xFE #xFF))) + ;; (string-append (bytevector->string utf16be-bom "ISO-8859-1") + ;; (bytevector->string (string->utf16 val 'big) "ISO-8859-1"))) + ;; (ps-quote (ly:encode-string-for-pdf val))) (define (metadata-lookup-output overridevar fallbackvar field) (let* ((overrideval (ly:modules-lookup (list header) overridevar))