From 13c22c4ce1b3ba54b1d0ff0f49cf2e246151d1ba Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 19 Dec 2004 10:20:27 +0000 Subject: [PATCH] (dump-page): Implement landscape. --- ChangeLog | 4 ++++ scm/framework-svg.scm | 11 +++++++---- scm/output-svg.scm | 34 +++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b7bc00882..da956c5e86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-12-19 Jan Nieuwenhuizen + + * scm/framework-svg.scm (dump-page): Implement landscape. + 2004-12-18 Jan Nieuwenhuizen * lily/main.cc (setup_paths): Add svg to search path. diff --git a/scm/framework-svg.scm b/scm/framework-svg.scm index af2ffd8a1a..259fde045f 100644 --- a/scm/framework-svg.scm +++ b/scm/framework-svg.scm @@ -22,7 +22,7 @@ (vsize (ly:output-def-lookup paper 'vsize)) (page-width (inexact->exact (ceiling (* output-scale hsize)))) (page-height (inexact->exact (ceiling (* output-scale vsize)))) - (page-set? (> page-count 1))) + (page-set? (or (> page-count 1) landscape?))) (ly:outputter-dump-string outputter @@ -56,14 +56,17 @@ (ec 'svg))))) (define (dump-page outputter page page-number page-count landscape? page-set?) - ;; FIXME:landscape (ly:outputter-dump-string outputter (comment (format #f "Page: ~S/~S" page-number page-count))) - (if page-set? (ly:outputter-dump-string outputter (eo 'page))) + (if (or landscape? page-set?) + (ly:outputter-dump-string + outputter + (if landscape? (eo 'page '(page-orientation . "270")) (eo 'page)))) (ly:outputter-dump-string outputter (string-append (eo 'g))) (ly:outputter-dump-stencil outputter page) (ly:outputter-dump-string outputter (string-append (ec 'g))) - (if page-set? (ly:outputter-dump-string outputter (ec 'page)))) + (if (or landscape? page-set?) + (ly:outputter-dump-string outputter (ec 'page)))) (define (embed-font string) (let ((start (string-contains string "")) diff --git a/scm/output-svg.scm b/scm/output-svg.scm index b19006a342..03155dbf39 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -6,6 +6,11 @@ ;;;; http://www.w3.org/TR/SVG11 +;;;; TODO: +;;;; * missing stencils: line, dashed-line ... +;;;; * rounded corners on stencils: rect, bezier (inkscape bug?) +;;;; * inkscape page/pageSet support + (debug-enable 'backtrace) (define-module (scm output-svg)) (define this-module (current-module)) @@ -19,9 +24,20 @@ ;; FIXME: 2? (define output-scale (* 2 scale-to-unit)) -(define (stderr string . rest) - (apply format (cons (current-error-port) (cons string rest))) - (force-output (current-error-port))) +(define indent-level 0) +(define (indent s . add) s) + +;;(define (indentation indent str) +;; (regexp-substitute/global #f "\(\n\)[ \t]*" str 'pre 1 indent 'post)) + +(define (indent s . add) + (let ((before indent-level) + (after (apply + (cons indent-level add))) + (after? (and (not (null? add)) (> (car add) 0)))) + (set! indent-level after) + (if after? + (string-append (make-string before #\ ) s) + (string-append (make-string after #\ ) s)))) (define (debugf string . rest) (if #f @@ -47,13 +63,13 @@ attributes-alist))) (define-public (eo entity . attributes-alist) - (format #f "<~S~a>\n" entity (attributes attributes-alist))) + (indent (format #f "<~S~a>\n" entity (attributes attributes-alist)) 2)) (define-public (eoc entity . attributes-alist) - (format #f "<~S~a/>\n" entity (attributes attributes-alist))) + (indent (format #f "<~S~a/>\n" entity (attributes attributes-alist)))) (define-public (ec entity) - (format #f "\n" entity)) + (indent (format #f "\n" entity) -2)) (define-public (entity entity string . attributes-alist) (if (equal? string "") @@ -117,9 +133,9 @@ (let* ((encoding (ly:font-encoding font)) (anchor (if (memq encoding '(fetaMusic fetaBraces)) 'start 'start)) (family (font-family font))) - (format #f "font-family:~a;font-weight:~a;font-size:~a;text-anchor:~S;" + (format #f "font-family:~a;font-style:~a;font-size:~a;text-anchor:~S;" (otf-name-mangling font family) - (otf-weight-mangling font family) + (otf-style-mangling font family) (font-size font) anchor))) (define (fontify font expr) @@ -135,7 +151,7 @@ "LilyPondBraces" family))) -(define-public (otf-weight-mangling font family) +(define-public (otf-style-mangling font family) ;; Hmm, family is bigcheese20/26? (if (string=? (substring family 0 (min (string-length family) 9)) "bigcheese") -- 2.39.5