;;;; http://www.w3.org/TR/SVG11
-;;; FIXME
-
-;;; * sodipodi gets confuseed by dashes in font names.
-;;;
-;;; removing feta-nummer*.pfa (LilyPond-feta-nummer),
-;;; feta-braces*.pfa (LilyPond-feta-braces), feta-din*.pfa
-;;; (LilyPond-feta-din) from font path shows feta fonts in sodipodi.
-;;;
-;;; * inkscape fails to map Feta fonts to private use area (PUA) E000
-;;; (sodipodi is fine).
-
(debug-enable 'backtrace)
(define-module (scm output-svg))
(define this-module (current-module))
(if #f
(apply stderr (cons string rest))))
-
(define (dispatch expr)
(let ((keyword (car expr)))
(cond
(debugf "design:~S\n" designsize)
scaling))
+(define (integer->entity integer)
+ (format #f "&#x~x;" integer))
+
(define (char->entity font char)
- (format #f "&#x~x;" (char->unicode-index font char)))
+ (integer->entity (char->unicode-index font char)))
(define (string->entities font string)
(apply string-append
(define (svg-font font)
(let* ((encoding (ly:font-encoding font))
- (anchor (if (memq encoding '(fetaMusic fetaBraces)) 'start 'start)))
- (format #f "font-family:~a;font-size:~a;text-anchor:~S;"
- (font-family font) (font-size font) anchor)))
+ (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;"
+ (otf-name-mangling font family)
+ (otf-weight-mangling font family)
+ (font-size font) anchor)))
(define (fontify font expr)
(tagify "text" expr (cons 'style (svg-font font))))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-public (otf-name-mangling font family)
+ ;; Hmm, family is bigcheese20/26?
+ (if (string=? (substring family 0 (min (string-length family) 9))
+ "bigcheese")
+ "LilyPond"
+ family))
+(define-public (otf-weight-mangling font family)
+ ;; Hmm, family is bigcheese20/26?
+ (if (string=? (substring family 0 (min (string-length family) 9))
+ "bigcheese")
+ (substring family 9)
+ "Regular"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; stencil outputters
(define (filledbox breapth width depth height)
(round-filled-box breapth width depth height 0))
+(define (named-glyph font name)
+ (dispatch
+ `(fontify ,font ,(tagify "tspan"
+ (integer->entity
+ (ly:font-glyph-name-to-charcode font name))))))
+
(define (placebox x y expr)
(tagify "g"
;; FIXME -- JCN