Added pict to svg conversion. Added parameter to Scribble's html renderer to control choice between png and svg.

original commit: 5ed686d9911b9f0d1cb1d5cb58d6950e33b9d17c
This commit is contained in:
Jens Axel Søgaard 2013-10-14 16:41:42 +02:00
parent 24492f3f9b
commit 49eac8975b
2 changed files with 11 additions and 3 deletions

View File

@ -6,13 +6,14 @@
"decode-struct.rkt"
"html-properties.rkt"
"tag.rkt"
"parameters.rkt"
scheme/list
scheme/class
racket/contract/base
racket/contract/combinator
(for-syntax scheme/base))
(provide (all-from-out "tag.rkt"))
(provide (all-from-out "tag.rkt" "parameters.rkt"))
;; ----------------------------------------

View File

@ -1,5 +1,4 @@
#lang scheme/base
(require "core.rkt"
"private/render-utils.rkt"
"html-properties.rkt"
@ -1092,7 +1091,8 @@
(cond
[(string? e) (super render-content e part ri)] ; short-cut for common case
[(list? e) (super render-content e part ri)] ; also a short-cut
[(and (convertible? e)
[(and (equal? (current-html-render-pict-as) 'png)
(convertible? e)
(convert e 'png-bytes))
=> (lambda (bstr)
(let ([w (integer-bytes->integer (subbytes bstr 16 20) #f #t)]
@ -1101,6 +1101,13 @@
[alt "image"]
[width ,(number->string w)]
[height ,(number->string h)])))))]
[(and (equal? (current-html-render-pict-as) 'svg)
(convertible? e)
(convert e 'svg-bytes))
=> (lambda (bstr)
`((object
([data ,(install-file "pict.svg" bstr)]
[type "image/svg+xml"]))))]
[(image-element? e)
(let* ([src (collects-relative->path (image-element-path e))]
[suffixes (image-element-suffixes e)]