[Cairo] Re: [xsvg] cairo_text_extents ?

Keith Packard keithp at keithp.com
Fri Dec 5 12:13:02 PST 2003

Around 11 o'clock on Dec 5, Bill Spitzak wrote:

> I think this means there *must* be a public "turn a string into a 
> device-specific font" interface somewhere. Unless cairo provides this, we 
> have just added the requirement for a second "font naming" interface. Having 
> two interfaces that do the same thing is a *bad* idea.

I don't see this as a requirement.  The toy API isn't designed to be 
sufficient for real applications like KDE or Gnome.  Those applications 
already have platform specific code for locating fonts, so there's no 
reason for cairo to attempt to provide an abstract API for them.  

Given that the applications are already knowledgeable about platform 
specific font selection mechanisms, having them transmit that data in its 
native format to the cairo platform specific font API is the best API 

> Where ':' is some seperating character that is not allowed in a cairo font 
> name. "gibberish" is an unreadable hex dump of internal data from the 
> device-specific interface, including an id for what device it is.

Perhaps you're misunderstanding where the portablity lies here -- fonts 
are *not* device dependent.  If you can construct a cairo_font_t object on 
the platform, you can pass it to *any* cairo_t.  This means that font 
selection is per-platform, not per output-device.  Therefore, there is no 
need for this kind of API horror; the cairo_font_t object completely 
encapsulates the abstract font object needed to render text to any device 
with the cairo API.


More information about the cairo mailing list