[cairo] FT fonts and Aqua ?
Charles سمير Doutriaux
doutriaux1 at llnl.gov
Tue Mar 31 11:08:45 PDT 2009
Hello,
I'm trying to use cairo to draw on an aqua surface.
I'm successfull getting it to draw and update rectangles/lines, etc...
But I'm having an issue when it comes to text
I can get it to write on my surface, if i use the default font, but
when creating a FT face for cairo it fails with "out_of_memory" when
trying to use it for drawing,
here's a snippet of the code I use, any idea? IS it at all possible to
use FT on Aqua surfaces?
Thanks
C.
code:
context = static_cast<CGContextRef > (this->macCGHandle());
CAIRO_SURFACE =
cairo_quartz_surface_create_for_cg_context(context,width,height);
cairo_surface_mark_dirty(CAIRO_SURFACE);
cr = cairo_create(CAIRO_SURFACE);
cairo_move_to(cr,x,y);
printf("we are drawing: %s\n",msg);
strcpy(path,"/Users/doutriaux1/Fonts/samba/Samba.ttf");
index = FT_New_Face( ft_library, path, 0, &myftface );
if ( index )
{
printf("londfont no file bug\n");
}
mycairoftface = (cairo_font_face_t
*)cairo_ft_font_face_create_for_ft_face(myftface,0);
printf("cairo status b4 ftface: %s
\n",cairo_status_to_string(cairo_status(cr)));
cairo_set_font_face (cr, mycairoftface);
printf("cairo status after ftface: %s
\n",cairo_status_to_string(cairo_status(cr)));
cairo_set_font_size(cr, 100.);
printf("cairo status after size: %s
\n",cairo_status_to_string(cairo_status(cr)));
cairo_show_text(cr,msg);
printf("cairo status after msg ftface: %s
\n",cairo_status_to_string(cairo_status(cr)));
The satus meesages are as follow:
cairo status b4 ftface: success
cairo status after ftface: success
cairo status after size: success
cairo status after msg ftface: out of memory
More information about the cairo
mailing list