[cairo-bugs] [Bug 90166] Add a way to specify units
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Oct 12 06:29:02 UTC 2017
https://bugs.freedesktop.org/show_bug.cgi?id=90166
--- Comment #10 from Antonio Ospite <ao2 at ao2.it> ---
(In reply to Bill Spitzak from comment #9)
>
[...]
> 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.
>
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
cairo at cairographics.org, I'll subscribe and follow up over there as well.
Ciao,
Antonio
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20171012/acf3a4ab/attachment-0001.html>
More information about the cairo-bugs
mailing list