[cairo] Last minute removal of functionality (using "cairo" to select internal font)

Behdad Esfahbod behdad at behdad.org
Wed Oct 29 21:40:07 PDT 2008


Carl Worth wrote:
> As I was typing up release notes for 1.8.2 I noticed a problem:
> 
> The new internal font face feature was stealing the font family name of
> "cairo" for itself. This could break past or future users wanting to sue
> cairo_select_font_face to get at some cairo.ttf for example.

I agree that this is definitely not appropriate for 1.8.x.  But I don't think
it's a big deal for 1.10+.

Ok, when I was thinking about this I never considered that cairo was a proper
name in English long before it was a library :).  So yeah, maybe you're right.

> Now, I know we've never fully documented what the font family argument
> does, but it does do reasonable things on most systems, and stealing
> this name just doesn't seem right.
> 
> We had a chat on IRC covering various options:
> 
> 1. Invent some less-likely-to-clash name such as "/cairo", (though we
> had much more fun with names like "I♥cairo").

Right.  It's ugly, but works.  Defining a macro for it is probably overkill.

> 2. Rip out the internal font face altogether, (Behdad had actually
> proposed as much in the first final call for 1.8.2 changes---before
> Chris fixed some bugs in it).
> 
> 3. Leave the internal font face implementation in place, but just remove
> the ability to explicitly select it. It would still be there for people
> wanting to build cairo without an external font system.
> 
> Without much time for an email discussion, I went ahead and implemented
> (3). The change to cairo itself is quite small and seems correct (see
> below). I also followed it up with the removal of the "twin" test and
> perf cases.
> 
> Unless someone speaks up with some clear objection quite soon, then I'll
> go ahead and push out 1.8.2 with this change. I'm sorry that it hasn't
> been sitting on master for a couple of days yet.

Sounds fine to do 1.8.x without it, and 1.9+ with "/cairo" or "<cairo>".

behdad


> -Carl
> 
> From a824d284be23793a5c48b9ae833dcb7b2d5fff80 Mon Sep 17 00:00:00 2001
> From: Carl Worth <cworth at cworth.org>
> Date: Wed, 29 Oct 2008 16:21:42 -0700
> Subject: [PATCH] Remove the ability to select the internal font face with a name of "cairo".
> 
> It's not fair to steal this name from the namespace of family names.
> There are definitely cairo.ttf files that exist out there, and people
> may already be using these, (or may use them in the future), with
> cairo_select_font_face and a family name of "cairo".
> 
> In place of this, we'll want to come up with some other new, and
> documented API for selecting the internal font face.
> ---
>  src/cairo-font-face.c |    6 ++----
>  src/cairoint.h        |    1 -
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
> index 6cea395..30c8d9f 100644
> --- a/src/cairo-font-face.c
> +++ b/src/cairo-font-face.c
> @@ -578,8 +578,7 @@ _cairo_toy_font_face_scaled_font_get_implementation (void                *abstra
>      if (font_face->base.status)
>  	return font_face->base.status;
>  
> -    if (CAIRO_SCALED_FONT_BACKEND_DEFAULT != &_cairo_user_scaled_font_backend &&
> -	0 != strcmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT))
> +    if (CAIRO_SCALED_FONT_BACKEND_DEFAULT != &_cairo_user_scaled_font_backend)
>      {
>  	const cairo_scaled_font_backend_t * backend = CAIRO_SCALED_FONT_BACKEND_DEFAULT;
>  
> @@ -618,8 +617,7 @@ _cairo_toy_font_face_scaled_font_create (void                *abstract_font_face
>      if (status)
>  	return status;
>  
> -    if (CAIRO_SCALED_FONT_BACKEND_DEFAULT != &_cairo_user_scaled_font_backend &&
> -	0 != strcmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT))
> +    if (CAIRO_SCALED_FONT_BACKEND_DEFAULT != &_cairo_user_scaled_font_backend)
>      {
>  	const cairo_scaled_font_backend_t * backend = CAIRO_SCALED_FONT_BACKEND_DEFAULT;
>  
> diff --git a/src/cairoint.h b/src/cairoint.h
> index a1d3f3d..a00e6e1 100644
> --- a/src/cairoint.h
> +++ b/src/cairoint.h
> @@ -938,7 +938,6 @@ typedef struct _cairo_traps {
>  #define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
>  #define CAIRO_QUARTZ_FONT_FAMILY_DEFAULT  "Helvetica"
>  #define CAIRO_FT_FONT_FAMILY_DEFAULT     ""
> -#define CAIRO_USER_FONT_FAMILY_DEFAULT     "cairo"
>  
>  #if   CAIRO_HAS_WIN32_FONT
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list