[cairo] <text> support in the SVG backend

Behdad Esfahbod behdad at behdad.org
Tue Oct 2 17:07:18 PDT 2007

On Tue, 2007-07-31 at 17:38 -0400, Emmanuel Pacaud wrote:
> 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 ?

So, how does my proposed show_text_glyphs() api look?  Do you have any
implementation plans for SVG?  Mind writing a summary of font/text
support in SVG so we all learn?



> 	Emmanuel.


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list