[cairo] [Bug 90166] Add a way to specify units (in SVG output)

Adrian Johnson ajohnson at redneon.com
Mon Nov 6 22:16:48 UTC 2017


On 07/11/17 08:44, Bryce Harrington wrote:
> On Fri, Nov 03, 2017 at 03:13:05PM +0100, Antonio Ospite wrote:
>> On Thu, 12 Oct 2017 12:25:41 +0200
>> Antonio Ospite <ao2 at ao2.it> wrote:
>>
>> [...] 
>>> The API addition I originally proposed[1,2] looks like this:
>>>
>>> void cairo_svg_surface_set_document_unit (cairo_surface_t*, cairo_svg_unit_t)
>>>
>>> Where cairo_svg_unit_t is an enum type representing all the possible
>>> units.
>>>
>>
>> Hi,
>>
>> here is v2 of the path:
>> https://bugs.freedesktop.org/show_bug.cgi?id=90166#c11
>>
>> After this is merged we can discuss if some extensions can be useful;
>> like getting an array of all the possible units, or having a function
>> to convert the enum values to strings, I mean following the model of 
>> cairo_svg_get_versions() and cairo_svg_version_to_string().
>>
>> I was also thinking of tweaking the documentation of the functions which
>> create SVG surfaces to state that "width" and "height" are assumed to
>> be in points by *default*, but that their unit can be changed later.
> 
> The patch looks good to me.  I agree with making user the default even
> though cairo has defaulted to "pt" historically.

That would be an API change. We can't do that.

>  Regarding using the
> abbr versions of the units rather than full strings I could go either
> way on myself, and have no arguments against using the short versions;
> anyone dealing with SVG document syntax should be adequately familiar
> with the abbreviated versions already.
> 
> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
> 
> If no one raises any further qualms within the next few days, I'll go
> ahead and land this patch.
> 
> Bryce
> 



More information about the cairo mailing list