<div dir="ltr">That sounds right to me. Thanks for looking into this!<div><br></div><div>How did you plan to have the parameter default? That is, does it make sense to ever generate .png bytes when you are able to generate svg?</div>
<div><br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Oct 13, 2013 at 10:11 AM, Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net" target="_blank">jensaxel@soegaard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
Currently the html-renderer of Scribble converts picts into png-images.<br>
Is there an easy way to get svg-images instead?<br>
<br>
A first look at the code seems to indicate the answer is no, but maybe I have<br>
overlooked something?<br>
<br>
The html-renderer converts anything (including picts) convertible to<br>
png-bytes pngs.<br>
<br>
Line 1090-... in scribble/html-render.rkt :<br>
<br>
(define/override (render-content e part ri)<br>
(define (attribs [extras null]) (content-attribs e extras))<br>
(cond<br>
[(string? e) (super render-content e part ri)] ; short-cut for<br>
common case<br>
[(list? e) (super render-content e part ri)] ; also a short-cut<br>
[(and (convertible? e)<br>
(convert e 'png-bytes))<br>
=> (lambda (bstr)<br>
(let ([w (integer-bytes->integer (subbytes bstr 16 20) #f #t)]<br>
[h (integer-bytes->integer (subbytes bstr 20 24) #f #t)])<br>
`((img ([src ,(install-file "pict.png" bstr)]<br>
[alt "image"]<br>
[width ,(number->string w)]<br>
[height ,(number->string h)])))))]<br>
[(image-element? e)<br>
...<br>
<br>
In mrlib/image-core.rkt at line 232 one sees that images currently can<br>
be converted to png-bytes only.<br>
<br>
Is the right way to proceed, to<br>
1) add svg-bytes to mrlib/image-core.rkt.<br>
2) introduce a parameter in Scribble that controls what picts<br>
should be converted to<br>
3) change render-content in scribble/html-render.rkt accordingly<br>
<br>
?<br>
<br>
<a href="https://github.com/plt/racket/blob/master/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt#L1090" target="_blank">https://github.com/plt/racket/blob/master/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt#L1090</a><br>
<a href="https://github.com/plt/racket/blob/4b8bd2260543dfe7d6da58e7529f330a1cf19d7b/pkgs/gui-pkgs/gui-lib/mrlib/image-core.rkt#L232" target="_blank">https://github.com/plt/racket/blob/4b8bd2260543dfe7d6da58e7529f330a1cf19d7b/pkgs/gui-pkgs/gui-lib/mrlib/image-core.rkt#L232</a><br>
<br>
--<br>
Jens Axel Søgaard<br>
<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>