]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-pdftex.scm
*** empty log message ***
[lilypond.git] / scm / output-pdftex.scm
index 96e576ffbac18af695c12bf2f5d88a32e3899310..f20f7a02aa9898c2b7add58963b1cbba09f82290 100644 (file)
@@ -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 <janneke@gnu.org>
-;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
-;;; Stephen Peters <portnoy@portnoy.org>
+;;;; 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 <janneke@gnu.org>
+;;;;                 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;;                 Stephen Peters <portnoy@portnoy.org>
 
 
 ;; TODO: port this  to the new module framework.
          (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)
   ""
   )
 
-(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)
    "\\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)
                 (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) "}"))