[cairo] Re: [cairo-commit] 6 commits - doc/public src/cairo.c src/cairo-gstate.c src/cairo.h src/cairoint.h src/cairo-quartz-surface.c src/cairo-scaled-font.c test/font-face-get-type.c TODO

Carl Worth cworth at cworth.org
Fri Mar 2 01:46:45 PST 2007


On Tue, 27 Feb 2007 17:22:13 -0800 (PST), Behdad wrote:
> Author: Behdad Esfahbod <behdad at behdad.org>
> Date:   Tue Feb 27 20:09:22 2007 -0500
>
>     Implement cairo_get_scaled_font()

Sneaky, Behdad. You added new public API without sending it to the
cairo list first. Tsk. Tsk.

>  /**
> + * cairo_get_scaled_font:
> + * @cr: a #cairo_t
> + *
> + * Gets the current font face for a #cairo_t.
> + *
> + * Return value: the current font object. Can return %NULL
> + *   on out-of-memory or if the context is already in
> + *   an error state. This object is owned by cairo. To keep
> + *   a reference to it, you must call cairo_font_face_reference().
> + *
> + * Since: 1.4
> + **/

Why is this documented as returning NULL ? Shouldn't it be returning a
non-NULL nil object like everything else in cairo?

> +    if (cr->status)
> +	return (cairo_scaled_font_t *)&_cairo_scaled_font_nil;
> +
> +    cr->status = _cairo_gstate_get_scaled_font (cr->gstate, &scaled_font);
> +    if (cr->status) {
> +	_cairo_set_error (cr, cr->status);
> +	return (cairo_scaled_font_t *)&_cairo_scaled_font_nil;

Oh, phew! It is returning a nil object. Let's just fix that
documentation then.

-Carl

PS. Thanks for cranking out so much good code lately--this 1.4 release
should be dandy!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070302/aff8e4fc/attachment.pgp


More information about the cairo mailing list