[Cairo] Text APIs round 2

Carl Worth cworth at east.isi.edu
Thu Aug 14 14:25:49 PDT 2003


On Aug 13, Keith Packard wrote:
 > I think we've converged on the class of acceptable solutions for cairo 
 > text.  Here's a specific example of both the FreeType/Fontconfig APIs and 
 > the generic (aka 'toy') APIs:

Keith and Owen (and others),

Thanks for battling this out while I was on vacation. It's nice to
come back and see something like consensus forming.

I feel pretty good about the direction things are going. We get native
fonts systems everywhere with matching screen/printer output. We have a
basic text API which enables portable Cairo programs for users who
have modest needs from the font system. And we provide full access to
the native font system for those that require it, (at the cost of
transparent portability).

That seems like a good set of tradeoffs given the current situation.

A few comments below:

 > 	void
 > 	cairo_select_font (cairo_t *ct, char *family, int slant, int weight);

What are the appropriate values for slant and weight? And shall we
change the types from int to new cairo_slant_t and cairo_weight_t
enums?

 > Note that the "toy" font names are explicitly not Fontconfig-specific any 
 > longer.  This maps reasonably well to Fontconfig and Win32; I don't know 
 > about OS X.

What guarantees do we make about how the "family" argument is treated?
It was proposed to support a reasonable result for a list of a few
fonts, ("serif", "sans-serif", and "monospace"). Beyond that, do we
just say that the result of any other name is dependent on the native
font system?

 > 	cairo_font_t *
 > 	cairo_font_from_ft_font (cairo_ft_font_t *ft_font);

What are the memory management semantics here? If we're creating a new
object, then consistency suggests the following instead:

	cairo_font_t *
	cairo_font_create_for_ft_font (cairo_ft_font_t *ft_font);

And of course, the OS-independent:

	void
	cairo_font_destroy (cairo_font_t *font);

Though that's not as convenient for passing to cairo_set_font. Other
options would be some sort of casting syntax, (which I would only like
if it its syntax made it obvious that no memory allocation occurred),
or perhaps separate cairo_set_ft_font and cairo_set_win32_font
functions.

I'm still mulling over the other questions posed at the end of the
proposal.

-Carl




More information about the cairo mailing list