[cairo] [PATCH] Enable links to image files in SVG backend

Alexander Shulgin alex.shulgin at gmail.com
Tue Jan 19 09:27:02 PST 2010

On Sat, Jan 16, 2010 at 01:34, Carl Worth <cworth at cworth.org> wrote:
> On Fri, 15 Jan 2010 13:23:11 +0200, Alexander Shulgin <alex.shulgin at gmail.com> wrote:
>> Attached is a patch which introduces a new mime type "text/x-uri"[1]
>> and uses this data in the SVG backend to replace image data with just
>> a link[2] to the file.
>> Attention paid to special characters which may occur in the mime data,
>> like ampersand and double quote.
>> Is this looking good enough now? :)
> Let's get some documentation *somewhere* that describes this. It's
> pretty magic, and the user needs to be told somewhere that this is
> possible.

Hi again,

I'm preparing the patch, but can't seem to get my head around git.  My
problem is: how do I make newly added files appear in the diff/patch?
My background is mostly SVN and reading man/docs/faqs didn't seem to
help a bit. :(

So for now I mail you a patch for changed files and a tgz of the added
files.  Hope you are OK with that. :)

Regarding the changes:

1. I've figured out that having only "text/x-uri" is not enough.

Consider someone using cairo in a web app, where in a URI one have to
use percent encoding to escape from special delimiter semantics (like
'&' after '?' or whatever).  So cairo shouldn't apply percent encoding
to this URI, or things will go wrong.

To overcome this I've added "text/x-uri-encoded" which will be emitted
to SVG stream as is.  So normal users are going to use x-uri and
sophisticated servers might need to use x-uri-encoded.

2. I've added docs to cairo_surface_set_mime_data() which mention
available MIME types and refer to surface backends which support some
of them.

Also added detailed description of which MIME types handled which way
in the SVG backend near cairo_svg_surface_create().  TODO: add similar
description for other backends (PDF, PS, Win32).

3. It turned out that most popular software doesn't handle percent
encoded URIs as it should according to SVG-1.1 spec.  I've tried
Inkscape, librsvg, Chrome and Firefox--only the latter seems to handle
them correctly.  Need to file bugs for the rest.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: svg-emit-surface-mime-type-xuri-v3.patch
Type: text/x-patch
Size: 8638 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20100119/60a8f7fd/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svg-emit-surface-mime-type-xuri-v3-lookup-table.tgz
Type: application/x-gzip
Size: 847 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20100119/60a8f7fd/attachment-0001.bin 

More information about the cairo mailing list