[Cairo] Re: [xsvg] cairo_text_extents ?

Carl Worth cworth at east.isi.edu
Wed Dec 3 06:20:53 PST 2003


On Dec 2, Bill Spitzak wrote:
 > It does appear that the current transform is serving the purpose of my 
 > text_matrix, and the matrix sent to cairo_trasnform_font is the same as my 
 > font_matrix.

Good. I'm glad to know the current design matches some part of what
you want.

 > This is if cairo_text_extents returns values in the current 
 > transform, and not in either device space or in font space.

Yes, my intention is that pretty much all of the coordinates that go
back and forth across the top-level cairo interface be in user space.

 > I also assumme that cairo_scale_font(x) is the same as
 > cairo_transform_font(x,0,0,x), right?

Yes.

 > 2. I also had this idea to split the text_transform from the current 
 > transform. The reason was so that you could place labels using a different 
 > transform than is used for the characters.

Can you come up with something like a pseudo-code sequence
demonstrating a problem you can't solve with the current API? We've
tried to base the text manipulation API on PostScript, and I don't
want to complicate the interface without solid evidence that there's
something lacking in the PostScript model.

 > 3. The header mentions a "cairo font_t". I think this is a bad idea.

Font management is extraordinarily complex and differs from one system
to the next. I don't pretend to understand all the issues involved,
(you mention hashing, but there are lots of other things like naming,
substitution, etc.). We've made a conscious decision to not attempt to
incorporate a complete font management API inside of cairo. We'd
probably just botch it, it would likely lag state-of-the-art, and due
to the multi-platform nature of cairo, it would be doomed to have
worst-of-all-worlds functionality anyway.

Instead, we provide the "toy" API with string-based font names for
people like me that just want to display some text without thinking
about it much. Any "real" font use requires constructing a
cairo_font_t via an external font system.

This pushes all the hard parts of font management outside of cairo
into the external font system. If there's some hashing that needs to
be done, that would be the place to do it. It would even be feasible
for someone to make a cairo-aware font system if that were actually
necessary.

-Carl




More information about the cairo mailing list