[cairo] First implementation of font Changes
Owen Taylor
otaylor at redhat.com
Wed Apr 6 13:56:40 PDT 2005
On Wed, 2005-04-06 at 11:24 -0400, Carl Worth wrote:
> Owen and I have been talking about this in IRC a bit, and have been
> batting around suggestions such as changing cairo_font_t to
> cairo_scaled_font_t and/or changing cairo_font_name_t to
> cairo_font_face_t. I think Owen shot down my suggestion of changing
> cairo_font_name_t to cairo_font_t.
>
> So I don't have a solid proposal yet, but we'll need something here.
What did you think about:
cairo_font_t => cairo_scaled_font_t
cairo_font_name_t => cairo_font_face_t
cairo_set_font_name => cairo_set_font_face()
cairo_get_font_name => cairo_get_font_face()
cairo_select_font => cairo_select_font_face()
It's not the most compact naming, but it seems clear, and for an
API that is going to be used:
- In tutorials
- In some rare low-level code
clarity is important.
> Something else I just noticed in the font API, not directly related to
> the proposed changes, is that we currently have these three extents
> functions on the cairo context:
>
> cairo_get_font_extents
> cairo_text_extents
> cairo_glyph_extents
>
> and this extents function on cairo_font_t:
>
> cairo_font_extents
>
> The fact that one in four has a "get" in the name seems a misfeature,
> (though, obviously, removing it would introduce a name clash with the
> cairo_font_t function.
>
> If we had "cairo_font_t *cairo_get_font (cairo_t *cr)" we could drop
> cairo_get_font_extents in favor of:
>
> cairo_font_extents (cairo_get_font (cr));
>
> and avoid the problem. But that would re-introduce cairo_font_t into
> the cairo_t API and exacerbate the naming problems discussed above.
If we rename font => scaled_font, then we have:
cairo_scaled_font_extents(cairo_scaled_font_t)
cairo_text_extents(cairo_t)
cairo_glyph_extents(cairo_t)
cairo_font_extents(cairo_t)
Which doesn't strike me as bad.
Regards,
Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050406/9dd84c22/attachment.pgp
More information about the cairo
mailing list