[cairo] Font rendering options

Carl Worth cworth at redhat.com
Fri Jul 8 10:52:56 PDT 2005


On Fri, 08 Jul 2005 11:22:39 -0400, Owen Taylor wrote:
> On Thu, 2005-07-07 at 17:00 -0700, Keith Packard wrote:
> > 
> > When I did the same thinking for fontconfig (which has all of the same
> > issues; fonts are selected without regard to the target surface and
> > rendering options carried through this API), I used a name/values
> > mechanism which seems more general and extensible than a bitfield. Is
> > there some reason to prefer the fixed datatype over an extensible
> > mechanism?
> 
> While FcPattern undeniably has a lot of power and flexibility, and in
> fact, as you note, solves most of the issues I listed below, I'm not
> a huge fan of the approach. There are various issues:

Another thing I really don't like about name/value pairs is that typo
checking gets pushed from compile-time to run-time. Yuck.

> Alternatives other than the complex bitfield:

The complex bitfield seems fine if we can guarantee that we won't want
to extend it much in the future. Personally, I don't know enough about
font rendering to dare make a prediction like that. What do the
experts think?

>  - An opaque structure
> 
>     cairo_font_options_t *cairo_font_options_create (void);
>     cairo_font_options_t *cairo_font_options_copy (options);
> 
>     void                  cairo_font_options_destroy (options);
>     void                  cairo_font_options_set_antialias (options,
>                                                             antialias);
>     cairo_antialias_t     cairo_font_options_get_antialias (options);

This opaque structure gets my vote, (though I like opaque structures
for almost anything). We get good compile-time checking with the
function name, extensible option types with the parameter lists, and
no limit to the number of options we can add in the future.

What would we use then, perhaps

	cairo_font_options_t *
	cairo_surface_copy_font_options (cairo_surface_t *surface);

?

-Carl
-------------- 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/20050708/de397511/attachment.pgp


More information about the cairo mailing list