[cairo] Can't get cairo_ft_font_create_for_ft_face() to work right
Owen Taylor
otaylor at redhat.com
Thu Mar 17 19:47:39 PST 2005
On Thu, 2005-03-17 at 18:54 -0800, Ned Konz wrote:
> I'm sure this is a stupid mistake on my part, but...
>
> I'm using SNAPSHOT_0_4_0 from the CVS.
>
> I'm trying to use cairo_ft_font_create_for_ft_face() so that I can use FT_Face
> objects with Cairo.
>
> But I haven't been able to actually get this to work right. No matter what I
> do, Cairo still uses the default font!
>
> Attached is a test program in C that demonstrates this. You can run it with a
> single command line argument that names a Truetype font file.
>
> It reports that it has loaded the font OK, and
> cairo_ft_font_create_for_ft_face() also returns a font that says it's the
> same as the loaded font, but when I actually create text, it's in the default
> font.
cairo_matrix_set_identity(scale);
cairo_font_t *font;
ASSERT((font =
cairo_ft_font_create_for_ft_face(face, FT_LOAD_DEFAULT,
scale)) != NULL);
cairo_matrix_destroy(scale);
You have to use the real scale here.
cairo_set_font(cr, font);
[...]
cairo_scale_font(cr, fontSize);
scale_font refers only to the font selected by cairo_select_font(),
calling it after set_font() will clear the previously set font.
It could be argued that cairo_ft_font_create_for_ft_font() isn't a
terribly useful in the present form - see
http://lists.freedesktop.org/archives/cairo/2005-January/002805.html
for some comments on the subject. Not having a use for the function
myself I'm not sure I have a very good idea of what is needed in this
area.
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/20050317/b2f9a0b0/attachment.pgp
More information about the cairo
mailing list