[cairo] <text> support in the SVG backend
Emmanuel Pacaud
emmanuel.pacaud at lapp.in2p3.fr
Tue Jul 31 14:38:09 PDT 2007
Hi,
Yesterday, I've had a look at the last embarrassing thing in the SVG
backend, which is the text handling.
Currently, texts are emitted as symbols, one symbol for each glyph at
each size. While I'd like to keep this output as the default method,
since it ensures a good rendering with most of the SVG renderers, I'd
like to add a support for an alternative method using <text> elements,
embedding the fonts using <font> elements. That will provides more
compact files and text editability.
I've had a look at whats currently done in the PDF backend, where text
is already editable, trying to figure out if I could do something
similar for the SVG backend. It looks like the PDF code is not really
suited for the SVG backend use. The glyph to unicode character mapping
is done when emitting the font subsets, where I need this information
when emitting the <text> element. So using the PDF method would probably
lead to inefficient code (rebuild of the glyph unicode map at each call
to show_glyph).
The main problem I see in the PDF backend method is we try to retrieve
an information that was known but lost before the call to show_glyphs.
This information is known by pango, if I recall correctly stored in the
PangoLayout object.
So what would be nice is a way to transfer the complete text
informations from pango to the show_glyphs backend method. That could be
done for example by serializing the PangoLayout data and transmit them
to show_glyphs (or an alternative method).
Does this sound reasonable ?
Emmanuel.
More information about the cairo
mailing list