[cairo] custom font options and cairo_t
cworth at redhat.com
Mon Jul 25 10:37:57 PDT 2005
On Sat, 23 Jul 2005 13:00:49 -0400, Owen Taylor wrote:
> So, how to fix?
> - We could add font options to the gstate (I even suggested this
> earlier) ... this would allow the person using a scaled font
> with custom font options to set those custom font options on
> the surface.
> - We could replace or augment cairo_set_font_face() with
> cairo_set_scaled_font(). (Bringing back the issue of the
> interaction of that with the CTM)
[eliding unpleasant third option]
> While the first option strikes me as a bit of a bandaid, it's the
> simplest and least disruptive change, and also has the other
> justification of allowing use of custom font options with the
> toy API, so it's what I'm favoring at this point.
I agree. Option number one seems correct. Something not unlike:
cairo_set_font_options (cairo_t *cr,
This is consistent with the model that is already in place with
cairo_set_font_face and cairo_set_font_matrix. This model simply
requires that the gstate provides a way to set each parameter needed
Option 2 certainly would be possible, but it would cause too disruptive
an API change at this point. And I think it would leave us doing API
design in circles, which is quite unpleasant.
What is nice about the current model is that it really is easy to use
as the application knows what surface it will be drawing to at the
time text needs to be measured. In that case, it's not even necessary
for the application to see a cairo_scaled_font_t, (though
cairo_get_scaled_font might still make a useful addition).
It's when measurement is done before knowing where things will be
drawn, (such as in pango), that a cairo_scaled_font_t object is
necessary in the application. And that creates the need to be careful
to ensure that cairo draws with the same scaled_font used to
measure. The addition of cairo_set_font_options should be sufficient
And what some applications still want is a way to detect and flag an
error if drawing with a scaled font that differs from the scaled font
used for measurement. Again, adding cairo_get_scaled_font might be all
that's needed to enable this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050725/1d30a2c9/attachment.pgp
More information about the cairo