[cairo] Text output in SVG target

Hans-Jürgen Koch hjk at linutronix.de
Mon Jan 7 10:17:34 PST 2008

When I output text to an SVG target, the resulting SVG file is very
large. Cairo doesn't simply save the string (together with font, size,
position etc), but generates a path from it and saves all the
borderline vectors.

Maybe it has to be that way for certain operations, I don't know. But
I've got an application at the moment where I have to render some
simple graphics and a lot of text, first to a screen and then the same
to an SVG file. Size of the file is critical in that application.

Cairo seemed to be ideally suited for the purpose, as I can use the
same library for screen output and file generation. But the ridiculous
size of the resulting SVG files makes it unusable for that application.

Question: Is there really no way to embed simple text in an SVG file,
or did I miss something? Just to be clear, I think of something like

<text x="100" y="150" font-family="Verdana" font-size="35">
Hello world!

If Cairo cannot produce such output at the moment, would it be possible
to add, or is it completely against some Cairo concepts?

Any other ideas?


More information about the cairo mailing list