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

Antonio Ospite ao2 at ao2.it
Tue Oct 31 11:43:02 UTC 2017


On Tue, 31 Oct 2017 10:35:47 +0100
Uli Schlachter <psychon at znc.in> wrote:

> On 30.10.2017 23:20, Antonio Ospite wrote:
> > On Thu, 12 Oct 2017 21:59:08 +1030
> > Adrian Johnson <ajohnson at redneon.com> wrote:
> > 
> > [...]
> >> The enum in the patch is:
> >>
> >> typedef enum _cairo_svg_unit {
> > 
> > [...]
> > 
> >> } cairo_svg_unit_t;
> >>
> >> This looks good to me. It just needs a getter.
> >>
> > 
> > About the getter function, what do you prefer?
> > 
> > 1. A function which returns the unit in the return value.
> [...]
> > 
> > 2. A function which returns the unit in an output parameter and returns
> >    a status in the return value.
> >    
> >    This seems more robust; is it cairo-style?
> > 
> [...]
> 
> Hi,
>

Hi Uli, thanks for the comment.

> take a look at, for example, cairo_image_surface_get_width():
> 
[...]
> 
> I'd say the same should be done here. No one will check the status
> return value of such a function anyway.
> 

That's where I took inspiration for 1.

The only doubt was that while width=0 might suggest that something is
wrong, returning unit=CAIRO_SVG_UNIT_USER does not really raise any
eyebrows.

However, to be fair, the value is returned when the surface is not an
SVG surface so it is meaningless anyway and unusable for subsequent
operations on that particular surface.

So I think I'll go for 1. unless someone else objects.

Ciao,
   Antonio

-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


More information about the cairo mailing list