X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Foutput-tex.scm;h=d9a97b90934139f5316153473e957dcdc799923d;hb=af770f3440264c18ce01525dce1aa76b86ace0d5;hp=6bc3f50a06783ac2f2f40a040db78c561bba48c2;hpb=df56feefa28914b45532b0a31b24c304c162b497;p=lilypond.git diff --git a/scm/output-tex.scm b/scm/output-tex.scm index 6bc3f50a06..d9a97b9093 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -2,12 +2,10 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 1998--2004 Jan Nieuwenhuizen -;;;; Han-Wen Nienhuys +;;;; (c) 1998--2006 Jan Nieuwenhuizen +;;;; Han-Wen Nienhuys -;; (debug-enable 'backtrace) - ;; The public interface is tight. ;; It has to be, because user-code is evalled with this module. @@ -24,24 +22,20 @@ ;; JUNK this -- see lily.scm: ly:all-output-backend-commands #:export (unknown blank + circle 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 + setcolor + resetcolor polygon draw-line no-origin @@ -69,29 +63,23 @@ (define (unknown) "%\n\\unknown\n") - +(define (url-link url x y) + "") (define (blank) "") +(define (circle radius thick) + (embedded-ps (list 'circle radius thick))) + (define (dot x y radius) (embedded-ps (list 'dot x y radius))) - (define (embedded-ps string) (embedded-ps (list 'embedded-ps string))) -(define (white-dot x y radius) - (embedded-ps (list 'white-dot x y radius))) - -(define (beam width slope thick blot) - (embedded-ps (list 'beam width slope thick blot))) - -(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 lst) - (embedded-ps (list 'dashed-slur thick dash `(quote ,lst)))) +(define (dashed-slur thick on off lst) + (embedded-ps (list 'dashed-slur thick on off `(quote ,lst)))) (define (named-glyph font name) (let* ((info (ly:otf-font-glyph-info font name)) @@ -107,18 +95,15 @@ "\\char" (number->string subidx)) (begin - (ly:warn "Can't find ~a in ~a" name font) + (ly:warning (_ "cannot 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 (dashed-line thick on off dx dy phase) + (embedded-ps (list 'dashed-line thick on off dx dy phase))) (define (zigzag-line centre? zzw zzh thick dx dy) (embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy))) -(define (ez-ball c lst b) - (embedded-ps (list 'ez-ball c lst b))) - (define (embedded-ps expr) (let ((ps-string (with-output-to-string @@ -131,7 +116,7 @@ (define (number->dim x) (string-append ;;ugh ly:* in backend needs compatibility func for standalone output - (ly:number->string x) " \\outputscale ")) + (ly:number->string x) " \\output-scale ")) (define (placebox x y s) (string-append @@ -140,20 +125,6 @@ (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) - (filledbox (- x1) (- x2 x1) (* .5 th) (* .5 th))) - -(define (filledbox breapth width depth height) - (if (and #f (defined? 'ps-testing)) - (embedded-ps - (string-append (ly:numbers->string (list breapth width depth height)) - " draw_box" )) - (string-append "\\lyvrule{" - (ly:number->string (- breapth)) "}{" - (ly:number->string (+ breapth width)) "}{" - (ly:number->string depth) "}{" - (ly:number->string height) "}"))) (define (round-filled-box x y width height blotdiam) (embedded-ps (list 'round-filled-box x y width height blotdiam))) @@ -163,11 +134,21 @@ "\\hbox{\\~a{}~a}" (tex-font-command font) (sanitize-tex-string s))) -(define (white-text scale s) - (embedded-ps (list 'white-text scale s))) +(define (setcolor r g b) + (string-append "\\color[rgb]{" + (number->string r) ", " + (number->string g) ", " + (number->string b) "}")) -(define (polygon points blotdiameter) - (embedded-ps (list 'polygon `(quote ,points) blotdiameter))) +;; FIXME +;; The PostScript backend saves the current color +;; during setcolor and restores it during resetcolor. +;; We don't do that here. +(define (resetcolor) + (string-append "\\color[rgb]{0,0,0}\n")) + +(define (polygon points blot-diameter fill) + (embedded-ps (list 'polygon `(quote ,points) blot-diameter fill))) (define (draw-line thick fx fy tx ty) (embedded-ps (list 'draw-line thick fx fy tx ty))) @@ -175,16 +156,28 @@ ;; no-origin not yet supported by Xdvi (define (no-origin) "") -(define (grob-cause grob) + +(define-public (line-location file line col) + "Print an input location, without column number ." + (string-append (number->string line) " " file)) + +(define-public point-and-click #f) + +(define (grob-cause offset grob) + (define (line-column-location file line col) + "Print an input location, including column number ." + (string-append (number->string line) ":" + (number->string col) " " file)) + (if (procedure? point-and-click) (let* ((cause (ly:grob-property grob 'cause)) - (music-origin (if (ly:music? cause) - (ly:music-property cause 'origin))) + (music-origin (if (ly:stream-event? cause) + (ly:event-property cause 'origin))) (location (if (ly:input-location? music-origin) - (ly:input-location music-origin)))) + (ly:input-file-line-column music-origin)))) (if (pair? location) ;;; \\string ? (string-append "\\special{src:" - (apply point-and-click location) "}") + (line-column-location location) "}") "")) - "")) + "")) \ No newline at end of file