]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-tex.scm
* input/regression/new-markup-scheme.ly: oops. font-family=music
[lilypond.git] / scm / output-tex.scm
index c1fd784b8665ddae4d289a8c4807dc85645d6612..6bc3f50a06783ac2f2f40a040db78c561bba48c2 100644 (file)
 
   ;; JUNK this -- see lily.scm: ly:all-output-backend-commands
   #:export (unknown
-            blank
-            dot
-            white-dot
-            beam
-            bracket
-            dashed-slur
-            named-glyph
-            dashed-line
-            zigzag-line
-            ez-ball
-            comment
-            repeat-slash
-            placebox
-            bezier-sandwich
-            horizontal-line
-            filledbox
-            round-filled-box
-            text
-            white-text
-            polygon
-            draw-line
-            no-origin
-            grob-cause
-            ))
+           blank
+           dot
+           white-dot
+           beam
+           bracket
+           dashed-slur
+           named-glyph
+           dashed-line
+           zigzag-line
+           ez-ball
+           comment
+           repeat-slash
+           placebox
+           bezier-sandwich
+           horizontal-line
+           filledbox
+           round-filled-box
+           text
+           white-text
+           polygon
+           draw-line
+           no-origin
+           grob-cause))
 
 (use-modules (ice-9 regex)
             (ice-9 string-fun)
@@ -63,6 +62,9 @@
 ;;;;;;;;
 
 
+(define (char font i)
+  (string-append "\\" (tex-font-command font)
+                "\\char" (ly:inexact->string i 10) " "))
 
 (define (unknown) 
   "%\n\\unknown\n")
 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
   (embedded-ps (list 'bracket  arch_angle arch_width arch_height height arch_thick thick)))
 
-(define (dashed-slur thick dash l)
-  (embedded-ps (list 'dashed-slur thick dash `(quote ,l))))
+(define (dashed-slur thick dash lst)
+  (embedded-ps (list 'dashed-slur thick dash `(quote ,lst))))
 
 (define (named-glyph font name)
-  (let* ((info (ly:otf-font-glyph-info font name)))
+  (let* ((info (ly:otf-font-glyph-info font name))
+        (subfont (assoc-get 'subfont info))
+        (subidx  (assoc-get 'subfont-index info)))
+    
     ;;(stderr "INFO: ~S\n" info)
     ;;(stderr "FONT: ~S\n" font)
-    (string-append "\\" (tex-font-command-raw
-                        (assoc-get 'subfont info)
-                        (ly:font-magnification font))
-                  "\\char" (number->string (assoc-get 'subfont-index info)))))
+    (if (and subfont subidx)
+       (string-append "\\" (tex-font-command-raw
+                            subfont
+                            (ly:font-magnification font))
+                      "\\char" (number->string subidx))
+
+       (begin
+         (ly:warn "Can't find ~a in ~a" name font)
+         ""))))
 
 (define (dashed-line thick on off dx dy)
   (embedded-ps (list 'dashed-line  thick on off dx dy)))
 (define (zigzag-line centre? zzw zzh thick dx dy)
   (embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy)))
 
-(define (ez-ball c l b)
-  (embedded-ps (list 'ez-ball c l b)))
+(define (ez-ball c lst b)
+  (embedded-ps (list 'ez-ball c lst b)))
 
 (define (embedded-ps expr)
   (let ((ps-string
   (string-append
    "\\lyitem{" (ly:number->string x) "}{" (ly:number->string y) "}{" s "}%\n"))
 
-(define (bezier-sandwich l thick)
-  (embedded-ps (list 'bezier-sandwich  `(quote ,l) thick)))
+(define (bezier-sandwich lst thick)
+  (embedded-ps (list 'bezier-sandwich `(quote ,lst) thick)))
 
 ;; WTF is this in every backend?
 (define (horizontal-line x1 x2 th)
   (embedded-ps (list 'round-filled-box  x y width height blotdiam)))
 
 (define (text font s)
-  (let*
-      ((mapping #f)       ;; (assoc-get  'char-mapping (ly:font-encoding-alist font))))
-
-
-       ;; TODO: we'd better do this for PS only
-       ;; LaTeX gets in the way, and we need to remap
-       ;; nonprintable chars.
-       
-       (input-enc-name #f) ;; (assoc-get 'input-name (ly:font-encoding-alist font) ))
-       )
-
-    (string-append "\\hbox{\\" (tex-font-command font)
-                  (if (string? input-enc-name)
-                      (string-append "\\inputencoding{" input-enc-name "}")
-                      "{}")
-                  (sanitize-tex-string
-                   (if (vector? mapping)
-                       (reencode-string mapping s)
-                       s))
-                  "}")))
+  (format
+   "\\hbox{\\~a{}~a}" (tex-font-command font)
+   (sanitize-tex-string s)))
 
 (define (white-text scale s)
-   (embedded-ps (list 'white-text scale s)))
-   
+  (embedded-ps (list 'white-text scale s)))
+
 (define (polygon points blotdiameter)
   (embedded-ps (list 'polygon `(quote ,points) blotdiameter)))