X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Foutput-pdftex.scm;h=f20f7a02aa9898c2b7add58963b1cbba09f82290;hb=d4e1cf3b24ad546d05a490ad1b07be45ea230e44;hp=96e576ffbac18af695c12bf2f5d88a32e3899310;hpb=f2d6ea6c952ab8f8651f95cdc1bc45716e4d3cc8;p=lilypond.git diff --git a/scm/output-pdftex.scm b/scm/output-pdftex.scm index 96e576ffba..f20f7a02aa 100644 --- a/scm/output-pdftex.scm +++ b/scm/output-pdftex.scm @@ -1,11 +1,11 @@ -;;; pdftex.scm -- implement Scheme output routines for PDFTeX -;;; -;;; source file of the GNU LilyPond music typesetter -;;; modified from the existing tex.scm -;;; -;;; (c) 1998--2003 Jan Nieuwenhuizen -;;; Han-Wen Nienhuys -;;; Stephen Peters +;;;; pdftex.scm -- implement Scheme output routines for PDFTeX +;;;; +;;;; source file of the GNU LilyPond music typesetter +;;;; modified from the existing tex.scm +;;;; +;;;; (c) 1998--2004 Jan Nieuwenhuizen +;;;; Han-Wen Nienhuys +;;;; Stephen Peters ;; TODO: port this to the new module framework. @@ -37,19 +37,18 @@ (display (object-type (car name-mag-pair))) (display (object-type (caaar font-name-alist))) - (ly:warn (string-append - "Programming error: No such font known " - (car name-mag-pair) " " + (ly:warn "Programming error: No such font known ~S ~S" + (car name-mag-pair) (ly:number->string (cdr name-mag-pair)) - )) + ) "") ; issue no command (string-append "\\" (cddr c))) )) -(define (beam width slope thick) - (embedded-pdf (list 'beam width slope thick))) +(define (beam width slope thick blot) + (embedded-pdf (list 'beam width slope thick blot))) (define (bracket arch_angle arch_width arch_height height arch_thick thick) (embedded-pdf (list 'bracket arch_angle arch_width arch_height height arch_thick thick))) @@ -58,7 +57,7 @@ (embedded-pdf (list 'dashed-slur thick dash l))) (define (char i) - (string-append "\\char" (inexact->string i 10) " ")) + (string-append "\\char" (ly:inexact->string i 10) " ")) (define (dashed-line thick on off dx dy) (embedded-pdf (list 'dashed-line thick on off dx dy))) @@ -68,7 +67,7 @@ "\\font\\" command "=" (car name-mag) " scaled " - (ly:number->string (inexact->exact (* 1000 (cdr name-mag)))) + (ly:number->string (inexact->exact (* 1000 (cdr name-mag)))) "\n")) (define (ez-ball c l b) @@ -93,40 +92,19 @@ "" ) -(if (or (equal? (minor-version) "4.1") - (equal? (minor-version) "4") - (equal? (minor-version) "3.4")) - (define (embedded-pdf expr) - (let ((ps-string - (with-output-to-string - (lambda () (pdf-output-expression expr (current-output-port)))))) - (string-append "\\embeddedpdf{" ps-string "}"))) - (define (embedded-pdf expr) - (let - ((os (open-output-string))) - (pdf-output-expression expr os) - (string-append "\\embeddedpdf{" (get-output-string os) "}")))) - - -(define (comment s) - (simple-format #f "% ~a\n" s)) - -(define (end-output) - (begin - ; uncomment for some stats about lily memory - ; (display (gc-stats)) - (string-append "%\n\\lilypondend\n" - ; Put GC stats here. - ))) +(define (embedded-pdf expr) + (let + ((os (open-output-string))) + (pdf-output-expression expr os) + (string-append "\\embeddedpdf{" (get-output-string os) "}"))) + + (define (experimental-on) "") (define (repeat-slash w a t) (embedded-pdf (list 'repeat-slash w a t))) -(define (fontify name-mag-pair exp) - (string-append (select-font name-mag-pair) - exp)) (define (tex-encoded-fontswitch name-mag) @@ -173,21 +151,22 @@ "\\lilypondpostscript\n" "\\pdfcompresslevel=0")) -;; Note: this string must match the string in ly2dvi.py!!! +;; Note: this string must match the string in lilypond.py!!! (define (header creator generate) (string-append "% Generated automatically by: " creator generate "\n")) (define (invoke-char s i) (string-append - "\n\\" s "{" (inexact->string i 10) "}" )) + "\n\\" s "{" (ly:inexact->string i 10) "}" )) -;; -;; need to do something to make this really safe. -;; +;; FIXME: explain ploblem: need to do something to make this really safe. (define (output-tex-string s) - (if security-paranoia - (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post) + (if (ly:get-option 'safe) + (regexp-substitute/global #f "\\\\" + (regexp-substitute/global #f "\\([{}]\\)" s 'pre "\\1" 'post) + 'pre "$\\backslash$" 'post) + s)) (define (lily-def key val) @@ -235,8 +214,8 @@ (ly:number->string depth) "}{" (ly:number->string height) "}")) -(define (roundfilledbox x y width height blotdiam) - (embedded-pdf (list 'roundfilledbox x y width height blotdiam))) +(define (round-filled-box x y width height blotdiam) + (embedded-pdf (list 'round-filled-box x y width height blotdiam))) (define (text s) (string-append "\\hbox{" (output-tex-string s) "}"))