]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/tex.scm
release: 1.5.0
[lilypond.git] / scm / tex.scm
index 499b2efdd3545d1486ffe259189896a51669e686..c002a22b3f3dea5eb4445d47818e04e3a851167f 100644 (file)
@@ -30,7 +30,7 @@
            (ly-warn (string-append
                      "Programming error: No such font known "
                      (car name-mag-pair) " "
-                     (number->string (cdr name-mag-pair))
+                     (ly-number->string (cdr name-mag-pair))
                      ))
            "") ; issue no command
          (string-append "\\" (cddr c)))
@@ -47,8 +47,8 @@
   (define (dashed-slur thick dash l)
     (embedded-ps ((ps-scm 'dashed-slur)  thick dash l)))
 
-  (define (crescendo thick w h cont)
-    (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
+  (define (hairpin thick w sh eh)
+    (embedded-ps ((ps-scm 'hairpin) thick w sh eh)))
 
   (define (char i)
     (string-append "\\char" (inexact->string i 10) " "))
   (define (dashed-line thick on off dx dy)
     (embedded-ps ((ps-scm 'dashed-line) thick on off dx dy)))
 
-  (define (decrescendo thick w h cont)
-    (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
-
   (define (font-load-command name-mag command)
     (string-append
      "\\font\\" command "="
      (car name-mag)
      " scaled "
-     (number->string (inexact->exact (* 1000  (cdr name-mag))))
+     (ly-number->string (inexact->exact (* 1000  (cdr name-mag))))
      "\n"))
 
   (define (ez-ball c l b)
@@ -86,6 +83,9 @@
   (define (experimental-on)
     "")
 
+  (define (repeat-slash w a t)
+    (embedded-ps ((ps-scm 'repeat-slash) w a t)))
+  
   (define (font-switch i)
     (string-append
      "\\" (font i) "\n"))
 
   (define (header-end)
     (string-append
-     "\\special{! "
-
+     "\\special{\\string! "
+     
      ;; URG: ly-gulp-file: now we can't use scm output without Lily
      (if use-regex
         ;; fixed in 1.3.4 for powerpc -- broken on Windows
         (regexp-substitute/global #f "\n"
-                                  (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
-        (ly-gulp-file "lily.ps"))
+                                  (ly-gulp-file "music-drawing-routines.ps") 'pre " %\n" 'post)
+        (ly-gulp-file "music-drawing-routines.ps"))
+     (if (defined? 'ps-testing) "/testing true def%\n" "")
      "}"
      "\\input lilyponddefs\\newdimen\\outputscale \\outputscale=\\lilypondpaperoutputscale pt\\turnOnPostScript"))
 
+  ;; Note: this string must match the string in ly2dvi.py!!!
   (define (header creator generate) 
     (string-append
      "% Generated automatically by: " creator generate "\n"))
          s))
       
   (define (lily-def key val)
-    (string-append
-     "\\def\\"
-     (if use-regex
-        ;; fixed in 1.3.4 for powerpc -- broken on Windows
-        (regexp-substitute/global #f "_"
-                                  (output-tex-string key) 'pre "X" 'post)
-        (output-tex-string key))
-     "{" (output-tex-string val) "}\n"))
-
+    (let ((tex-key
+          (if use-regex
+              ;; fixed in 1.3.4 for powerpc -- broken on Windows
+              (regexp-substitute/global
+               #f "_" (output-tex-string key) 'pre "X" 'post)
+              (output-tex-string key)))
+         (tex-val (output-tex-string val)))
+      (if (equal? (sans-surrounding-whitespace tex-val) "")
+         (string-append "\\let\\" tex-key "\\undefined\n")
+         (string-append "\\def\\" tex-key "{" tex-val "}\n"))))
+               
   (define (number->dim x)
     (string-append
      ;;ugh ly-* in backend needs compatibility func for standalone output
     "}\\vss}\\interscoreline\n")
   (define (stop-last-line)
     "}\\vss}")
-  (define (filledbox breapth width depth height) 
+  (define (xfilledbox breapth width depth height) 
     (string-append 
      "\\kern" (number->dim (- breapth))
      "\\vrule width " (number->dim (+ breapth width))
      "depth " (number->dim depth)
      "height " (number->dim height) " "))
 
+  (define (filledbox breapth width depth height) 
+    (embedded-ps
+     (string-append (numbers->string (list breapth width depth height))
+                  " draw_box" )))
+
   (define (text s)
     (string-append "\\hbox{" (output-tex-string s) "}"))
   
     (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
 
   (define (define-origin file line col)
-    ; use this for column positions
-    (if point-and-click
-     (string-append "\\special{src:" (number->string line) ":"
-        (number->string col) " " file "}"
-        ;; arg, the clueless take over the mailing list...
-;       "\\special{-****-These-warnings-are-harmless-***}"
-;       "\\special{-****-PLEASE-read-http://appel.lilypond.org/wiki/index.php3?PostProcessing-****}"
-       )
-     "")
-
-     ; line numbers only:
-    ;(string-append "\\special{src:" (number->string line) " " file "}")
-)
+    (if (procedure? point-and-click)
+       (string-append "\\special{src\\string:"
+                      (point-and-click line col file)
+                      "}" )
+       "")
+  )
 
   ; no-origin not yet supported by Xdvi
   (define (no-origin) "")
            (define bezier-sandwich ,bezier-sandwich)
            (define bracket ,bracket)
            (define char ,char)
-           (define crescendo ,crescendo)
            (define dashed-line ,dashed-line) 
            (define dashed-slur ,dashed-slur) 
-           (define decrescendo ,decrescendo
+           (define hairpin ,hairpin
            (define end-output ,end-output)
            (define experimental-on ,experimental-on)
            (define filledbox ,filledbox)
            (define volta ,volta)
            (define define-origin ,define-origin)
            (define no-origin ,no-origin)
+           (define repeat-slash ,repeat-slash)
            ))
 
        ((eq? action-name 'beam) beam)
        ((eq? action-name 'tuplet) tuplet)
        ((eq? action-name 'bracket) bracket)
-       ((eq? action-name 'crescendo) crescendo)
+       ((eq? action-name 'hairpin) hairpin)
        ((eq? action-name 'dashed-line) dashed-line) 
        ((eq? action-name 'dashed-slur) dashed-slur) 
-       ((eq? action-name 'decrescendo) decrescendo) 
        ((eq? action-name 'end-output) end-output)
        ((eq? action-name 'experimental-on) experimental-on)
        ((eq? action-name 'font-def) font-def)