X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fframework-ps.scm;h=a781055f5077d152520e7d7c4643341a9fc5ea0f;hb=f4e12f1b0cb5dfb32f193f87e7ca28c406b87771;hp=f6d1700f424355f278fe0d3facdfa1690a030125;hpb=c8a49d69fa78ca3e6b0ce5feec76dcbd2e64b64d;p=lilypond.git diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index f6d1700f42..a781055f50 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -340,9 +340,15 @@ ((and file-name (string-endswith downcase-file-name ".ttf")) (ly:ttf->pfa file-name)) ((and file-name (string-endswith downcase-file-name ".ttc")) - (ly:ttf->pfa file-name font-index)) + ;; 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 (else (ly:warning (_ "do not know how to embed ~S=~S") name file-name) "")))) @@ -463,20 +469,47 @@ (val (if overrideval overrideval fallbackval))) (if val (format port "/~a (~a)\n" field (metadata-encode (markup->string val (list header))))))) - (display "[ " port) - (metadata-lookup-output 'pdfauthor 'author "Author") - (format port "/Creator (LilyPond ~a)\n" (lilypond-version)) - (metadata-lookup-output 'pdftitle 'title "Title") - (metadata-lookup-output 'pdfsubject 'subject "Subject") - (metadata-lookup-output 'pdfkeywords 'keywords "Keywords") - (metadata-lookup-output 'pdfmodDate 'modDate "ModDate") - (metadata-lookup-output 'pdfsubtitle 'subtitle "Subtitle") - (metadata-lookup-output 'pdfcomposer 'composer "Composer") - (metadata-lookup-output 'pdfarranger 'arranger "Arranger") - (metadata-lookup-output 'pdfpoet 'poet "Poet") - (metadata-lookup-output 'pdfcopyright 'copyright "Copyright") - (display "/DOCINFO pdfmark\n\n" port)) + (if (module? header) + (begin + (display "mark " port) + (metadata-lookup-output 'pdfauthor 'author "Author") + (format port "/Creator (LilyPond ~a)\n" (lilypond-version)) + (metadata-lookup-output 'pdftitle 'title "Title") + (metadata-lookup-output 'pdfsubject 'subject "Subject") + (metadata-lookup-output 'pdfkeywords 'keywords "Keywords") + (metadata-lookup-output 'pdfmodDate 'modDate "ModDate") + (metadata-lookup-output 'pdfsubtitle 'subtitle "Subtitle") + (metadata-lookup-output 'pdfcomposer 'composer "Composer") + (metadata-lookup-output 'pdfarranger 'arranger "Arranger") + (metadata-lookup-output 'pdfpoet 'poet "Poet") + (metadata-lookup-output 'pdfcopyright 'copyright "Copyright") + (display "/DOCINFO pdfmark\n\n" port))) + + (if (ly:get-option 'embed-source-code) + (let ((source-list (delete-duplicates + (remove (lambda (str) + (or + (string-contains str + (ly:get-option 'datadir)) + (string=? str + ""))) + (ly:source-files))))) + (display "\n/pdfmark where +{pop} {userdict /pdfmark /cleartomark load put} ifelse" port) + (for-each (lambda (fname idx) + (format port "\n +mark /_objdef {ly~a_stream} /type /stream /OBJ pdfmark +mark {ly~a_stream} << /Type /EmbeddedFile>> /PUT pdfmark +mark {ly~a_stream} (~a) /PUT pdfmark +mark /Name (LilyPond source file ~a) +/FS << /Type /Filespec /F (~a) /EF << /F {ly~a_stream} >> >> /EMBED pdfmark +mark {ly~a_stream} /CLOSE pdfmark +\n" + idx idx idx + (ps-quote (ly:gulp-file fname)) + idx fname idx idx)) + source-list (iota (length source-list)))))) (define-public (output-framework basename book scopes fields) (let* ((port-tmp (make-tmpfile)) @@ -501,8 +534,7 @@ ;; don't do BeginDefaults PageMedia: A4 ;; not necessary and wrong (write-preamble paper #t port) - (if (module? header) - (handle-metadata header port)) + (handle-metadata header port) (for-each (lambda (page) (set! page-number (1+ page-number)) @@ -730,7 +762,7 @@ system-by-system output. For that, use the EPS backend instead, lilypond -dbackend=eps FILE -If have cut & pasted a lilypond fragment from a webpage, be sure +If you have cut & pasted a lilypond fragment from a webpage, be sure to only remove anything before %% ****************************************************************