<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Add a way to specify units"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90166#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Add a way to specify units"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90166">bug 90166</a>
from <span class="vcard"><a class="email" href="mailto:ao2@ao2.it" title="Antonio Ospite <ao2@ao2.it>"> <span class="fn">Antonio Ospite</span></a>
</span></b>
<pre>(In reply to Bill Spitzak from <a href="show_bug.cgi?id=90166#c9">comment #9</a>)
<span class="quote">> </span >
[...]
<span class="quote">> Proposed api:
>
> void cairo_svg_surface_set_document_unit (cairo_surface_t*, const char*)
>
> The string pointer must point at a valid svg unit type, such as "pt"
> or "em". NULL is the same as "" (which means "user" units). The
> function should do some basic sanity checks (maximum length, and only
> printing ASCII) and is a no-op if it fails.
> </span >
Hi Bill,
the API I propose is modeled after cairo_svg_surface_restrict_to_version()
which also uses an enum, so cairo users are already familiar with this
approach, and I think it's OK for a few more reasons:
1. IMHO it's a little more robust, it allows to produce only valid documents
(after we discuss if relative units are OK to use).
2. The implementation is simple, hence more verifiable, for instance there is
no need to escape special characters like " to assure that the XML is well
formed.
3. The event of new units being added to the SVG spec seems quite rare, so
having cairo react to that (even in a minor release) seems OK considering the
benefits of 1. and 2.
Sanitizing user strings is a bother, when possible I prefer avoiding a problem
rather than having to solve it.
Ah, after writing the reply I noticed you already posted to
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a>, I'll subscribe and follow up over there as well.
Ciao,
Antonio</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>