[Sugar-devel] Handling of SVG in Sugar/Sugarizer

Lionel Laské lionel.laske at gmail.com
Tue Aug 25 16:07:19 EDT 2020


Le mar. 25 août 2020 à 06:51, James Cameron <quozl at laptop.org> a écrit :

>
> To help answer that, I've prepared a fork of Hello World with the
> sugar3.graphics.icon module inline.
>
> https://github.com/sugarlabs/hello-world/tree/test-svg-css
>
>
Nice!


> Next, I need a sample SVG file with CSS file in the form you plan to
> use.
>
>
You could find at set of new icons here:
https://github.com/llaske/svgstudy/tree/master/icons/new


> I'm not sure what the next step is, but perhaps Rsvg library has code
> already to do this.
>
> I've tried with an SVG external source, but the test fails to render.
>
> https://github.com/sugarlabs/hello-world/tree/test-svg-css-external-source
>

Perhaps I need to set the base uri.
>
>
Hmmm. Are you sure you should not define a <symbol id="myid"> tag in the
SVG file and reference #myid in the <use> tag?
It's the way I'm doing. See in my test page here:
https://github.com/llaske/svgstudy/blob/master/icons/new/abcd-icon2.svg?short_path=f320e6c#L17
https://github.com/llaske/svgstudy/blob/master/test.html#L355

BTW I think it's better to do this step by step:
- Use CSS variables with a CSS style sheet
- Then once it works, try to use SVG external source



> https://lazka.github.io/pgi-docs/#Rsvg-2.0/classes/Handle.html#Rsvg.Handle
>
> There is a new set_stylesheet function in Rsvg 2.48 we might use, if
> the Python bindings actually work.
>

Yes, it seems to do the job.


Interesting, thanks.  I've not used Inkscape seriously yet.  I had
> thought the original SVG files should be kept separate to the
> transformed files.
>
>
No, it's better to have only one file to maintain.

Regards.

            Lionel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20200825/a76c7671/attachment.htm>


More information about the Sugar-devel mailing list