[cairo] [API] unbreak CAIRO_FONT_TYPE_ATSUI

Behdad Esfahbod behdad at behdad.org
Tue Mar 25 04:41:23 PDT 2008


On Mon, 2008-03-24 at 15:20 -0400, Vladimir Vukicevic wrote:
> 
> I'm ok with this change, but I would prefer to get rid of the ATSUI  
> name entirely in case someone expects it to actually use ATSUI in
> the  
> future.  The behaviour won't change though, so maybe it's ok to just  
> #define it.  But up to carl and behdad; we should come up with some  
> kind of policy for those enums, since I bet this will come up again
> in  
> the future.
> 
> It would be nice to get rid of the enums from cairo.h entirely to  
> avoid this problem; I thought about this a little while ago, but
> never  
> wrote up a suggestion.  Here's one thing that could be done:
> 
> typedef char *cairo_surface_identifier_t;
> typedef void *cairo_surface_type_t;
> 
> struct _surface_backend {
>    cairo_surface_identifier_t ident;
>    ...
> };
> 
> surface_backed image_surface = {
>     "Image Surface",
>     ... functions ...
> };
> 
> cairo_surface_type_t
> image_surface_get_type() {
>    return (cairo_surface_type_t) backend.ident;
> }

This is pretty much what I suggested back in Feb 06:

http://lists.cairographics.org/archives/cairo/2006-February/006416.html

and is basically my only regret in cairo for not pushing that approach
hard enough.

Not sure if this still can be fixed...

behdad


> and then some compat defines:
> 
> #define CAIRO_SURFACE_TYPE_IMAGE  (cairo_image_surface_get_type())
> 
> The only thing that breaks with this is that you can't use the
> values  
> in case statements any more, but I'd think that's pretty uncommon in  
> user code.
> 
>       - Vlad
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list