If you work a lot with postscript markups, you'll wish to have an easy method to include 'postcript libaries' (usually prodecure sets) into the PS output, which will be converted to PDF or other formats. Well, at least I do.
I tried to solve it in my 2.15.39 test installation. I added to .../scm/lily.scm after line 40 the predefinition of an empty list in which to collect the file names: (begin (debug-enable 'backtrace) (debug-set! show-file-name #t))) +(define-public postscript-user-libraries '()) + (define-public PLATFORM (string->symbol (string-downcase (car (string-tokenize (utsname:sysname (uname))))))) I added to .../scm/framework-ps.scm after line 398 the code to output of these files to the intermediate postscript file at the end of the prolog. The files will be searched in the defines lilypond search pathes: ;; adobe note 5002: should initialize variables before loading routines. (display (procset "music-drawing-routines.ps") port) (display (procset "lilyponddefs.ps") port) + ;; user wants PS library file(s) to include? + (if (not (null? postscript-user-libraries)) + (if (list? postscript-user-libraries) + (for-each (lambda (ps-lib-file) + (display (ly:gulp-file ps-lib-file) port)) + postscript-user-libraries))) (display "%%EndProlog\n" port) (display "%%BeginSetup\ninit-lilypond-parameters\n%%EndSetup\n\n" port)) (define (ps-quote str) For an user friedly definition of the PS files to include, I defined the following function, which will prevent me adding a filename multiple times into the collector list: postscriptLibrary = #(define-void-function (parser location file-name) (string?) (if (null? (filter (lambda (x) (string-ci=? x file-name)) postscript-user-libraries)) (set! postscript-user-libraries (append! postscript-user-libraries (cons file-name '()))) (if (null? (filter (lambda (x) (string=? x file-name)) postscript-user-libraries)) (begin (ly:warning "portability problem. filename entered again, but as a caseinsensitive variant.") ;;DE: (ly:warning "Partabilitätsproblem. Dateiname wurde mehrfach spezifiziert, aber in unterschiedlicher Groß-/Kleinschreibung.") (if (eq? PLATFORM 'windows) (ly:warning "path entry in \\postscriptLibrary ignored: ~a" file-name) ;;DE: (ly:warning "Dateiname in \\postscriptLibrary wurde ignoriert: ~a" file-name) (begin (set! postscript-user-libraries (append! postscript-user-libraries (cons file-name '()))) (ly:warning "path entry in \\postscriptLibrary added nevertheless: ~a" file-name) ;;DE: (ly:warning "Dateiname in \\postscriptLibrary wurde trotzdem hinzugefügt: ~a" file-name) ) ))))) I tested it with these definitions in an included LY file like this: http://old.nabble.com/file/p33906716/ps-include.ly ps-include.ly My file to compile with lilypond did look like this: http://old.nabble.com/file/p33906716/ps-test.ly ps-test.ly Finally, here is my postscript file which is to be included, which I put into my 'private additions' Lilypond-Include-Directory: http://old.nabble.com/file/p33906716/fine-script-sym.ps fine-script-sym.ps Finally my questions: - Is it correct to put the declation of postscript-user-libraries into lily.scm? Or is there a better file? - Is it correct to use ly:gulp-file? Or is this wasting of memory because the compete file will be read into memory before the output is done? - Are there other PLATFORMs for lilypond, other then 'windows, which use case-insensitive file names? - Can the translations of messages (warning messages) be added without any compiler? - Is this sulution worth to be added to lilypond development? -- View this message in context: http://old.nabble.com/include-user-defined-postscript-libraries-into-output-tp33906716p33906716.html Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com. _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user