X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Foutput-svg.scm;h=a15a9d8ad0bc59432a8b69bf164017a56fa78ccf;hb=e51399a6cf22bebdefe8f21bdb9a58947d1fe8cc;hp=d993c356358c94fa21fe70f57c09e28cce49687b;hpb=9a2ffbf058002a6a82acc5748a2998840885afb8;p=lilypond.git diff --git a/scm/output-svg.scm b/scm/output-svg.scm index d993c35635..a15a9d8ad0 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2002--2011 Jan Nieuwenhuizen +;;;; Copyright (C) 2002--2012 Jan Nieuwenhuizen ;;;; Patrick McCarty ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify @@ -70,6 +70,12 @@ "c = close" (format #f "\n" entity)) +(define (start-enclosing-id-node s) + (string-append "\n")) + +(define (end-enclosing-id-node) + "\n") + (define-public (comment s) (string-append "\n")) @@ -238,7 +244,7 @@ (begin (set! path (apply dump-path d-attr-value font-scale - (list (cadr rest) (caddr rest)))) + (list (caddr rest) (cadddr rest)))) (set! next-horiz-adv (+ next-horiz-adv (car rest))) path)) @@ -257,7 +263,7 @@ "")))) (define (extract-glyph-info all-glyphs glyph size) - (let* ((offsets (list-head glyph 3)) + (let* ((offsets (list-head glyph 4)) (glyph-name (car (reverse glyph)))) (apply extract-glyph all-glyphs glyph-name size offsets))) @@ -323,18 +329,6 @@ ;;; stencil outputters ;;; -(define (bezier-sandwich lst thick) - (let* ((first (list-tail lst 4)) - (second (list-head lst 4))) - (entity 'path "" - '(stroke-linejoin . "round") - '(stroke-linecap . "round") - '(stroke . "currentColor") - '(fill . "currentColor") - `(stroke-width . ,thick) - `(d . ,(string-append (svg-bezier first #f) - (svg-bezier second #t)))))) - (define (char font i) (dispatch `(fontify ,font ,(entity 'tspan (char->entity (integer->char i)))))) @@ -434,7 +428,7 @@ (define (embedded-svg string) string) -(define (embedded-glyph-string font size cid glyphs) +(define (embedded-glyph-string pango-font font size cid glyphs) (define path "") (if (= 1 (length glyphs)) (set! path (music-string-to-path font size (car glyphs))) @@ -450,7 +444,7 @@ (set! next-horiz-adv 0.0) path) -(define (woff-glyph-string font-name size cid? w-x-y-named-glyphs) +(define (woff-glyph-string pango-font font-name size cid? w-h-x-y-named-glyphs) (let* ((name-style (font-name-style font-name)) (family-designsize (regexp-exec (make-regexp "(.*)-([0-9]*)") font-name)) @@ -464,7 +458,7 @@ (font (ly:paper-get-font paper `(((font-family . ,family) ,(if design-size `(design-size . design-size))))))) - (define (glyph-spec w x y g) + (define (glyph-spec w h x y g) ; h not used (let* ((charcode (ly:font-glyph-name-to-charcode font g)) (char-lookup (format #f "&#~S;" charcode)) (glyph-by-name (eoc 'altglyph `(glyphname . ,g))) @@ -483,7 +477,7 @@ (string-append glyph-by-name apparently-broken char-lookup))))) (string-join (map (lambda (x) (apply glyph-spec x)) - (reverse w-x-y-named-glyphs)) "\n"))) + (reverse w-h-x-y-named-glyphs)) "\n"))) (define glyph-string (if (not (ly:get-option 'svg-woff)) embedded-glyph-string woff-glyph-string)) @@ -497,26 +491,6 @@ (define (no-origin) "") -(define (oval x-radius y-radius thick is-filled) - (let ((x-max x-radius) - (x-min (- x-radius)) - (y-max y-radius) - (y-min (- y-radius))) - (entity - 'path "" - '(stroke-linejoin . "round") - '(stroke-linecap . "round") - `(fill . ,(if is-filled "currentColor" "none")) - `(stroke . "currentColor") - `(stroke-width . ,thick) - `(d . ,(ly:format "M~4f ~4fC~4f ~4f ~4f ~4f ~4f ~4fS~4f ~4f ~4f ~4fz" - x-max 0 - x-max y-max - x-min y-max - x-min 0 - x-max y-min - x-max 0))))) - (define* (path thick commands #:optional (cap 'round) (join 'round) (fill? #f)) (define (convert-path-exps exps) (if (pair? exps) @@ -598,17 +572,6 @@ `(points . ,(string-join (map offset->point (ly:list->offsets '() coords)))))) -(define (repeat-slash width slope thickness) - (define (euclidean-length x y) - (sqrt (+ (* x x) (* y y)))) - (let* ((x-width (euclidean-length thickness (/ thickness slope))) - (height (* width slope))) - (entity - 'path "" - '(fill . "currentColor") - `(d . ,(ly:format "M0 0l~4f 0 ~4f ~4f ~4f 0z" - x-width width (- height) (- x-width)))))) - (define (resetcolor) "\n")