Using SVG module from Skia

Hossein Nourikhah hossein at
Fri Apr 28 09:12:48 UTC 2023

Hello Tomaž,

I think there can be a good rationale for using Skia, or other good 
external SVG libraries, considering the use case of the two SVG import 
filters, which includes converting an SVG unchanged:

1) svgio: For Insert -> Image -> From File
2) filter/source/svg used to open SVG file

Quoting from Fernand:

> From a users point of view:
> Inserting a SVG-image in Writer, Calc or Impress must been done
> "unchanged" because users will in 99% off all cases not edit a Image.
> Opening in Draw is a different game where in most cases the user has 
> the
> intention tot edit a image and save back SVG or as a other format.

In this way, converting documents containing embedded unchanged SVG 
files is an important use case, and it is meaningful to have a faster 
conversion with more SVG features supported.

Theoretically, If we convert the document to PDF using Skia/PDF backend, 
and before that, convert the embedded SVG files to the Skia vector 
representation, then it may be possible to bypass the drawinglayer, and 
create a document consisting of SVG files (and not only the SVG files 
separately) to PDF, and have the embedded SVG files as vector in the 
output, not as bitmap.

This the usual use case for many users, as those who are interested in 
editing SVG files usually use other tools like Inkscape.


On 28.04.2023 09:47, Tomaž Vajngerl wrote:
> Hi Hossein,
> On Tue, Apr 25, 2023 at 9:59 PM Hossein Nourikhah
> <hossein at> wrote:
>> Hello,
>> I have studied some of the bugs from the svgio module of
>> LibreOffice. As
>> described in the svgio/, "svgio module uses sax for reading
>> xml
>> and turns it into drawinglayer primitives. The rendering is done via
>> drawinglayer primitives".
> As you say - SVG is turned into drawinglayer primitives, so we keep
> the SVG in a vector graphic form and can - if needed - transform that
> into another vector graphic format (EMF for example). If you want to
> implement it with Skia, you also have to import it into drawinglayer
> primitives and not render the vector graphic into a bitmap (like we do
> for example with "PDF as an image", where we render the PDF into a
> bitmap, which has major flaws). This is IMHO not that easy to achieve
> and not sure if skia supports that (it probably is possible to convert
> into skia internal vector representation and convert that to drawing
> layer primitives).
> The only place where rendering the SVG to a bitmap would be useful is
> for icons, but then I have always said - why spend time on integrating
> another SVG library instead of fixing svgio instead...
> Tomaž

More information about the LibreOffice mailing list