Cairo and freetype

Techie Help <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi,
 
The problem was with cairo_font_options_t. They can't be NULL in call : cairo_scaled_font_create().
So, I added default options.
 
It has moved further but still no text as on executing this line of code:
cairo_text_path(), I get 
 
_gcm_surface_get_font_options not implemented yet
in my debugger.
Any ideas, how to get rid of this.
 
Thanks.

 
----- Forwarded Message -----
From: Techie Help <[email protected]>
To: "[email protected]" <[email protected]> 
Sent: Thursday, 8 November 2012, 10:51
Subject: Re: Cairo and freetype
  

Hi Jutsin,
 
I did it the way you suggested:
Here's what I did:
 
 
cairo_device_t *  cairo_device=cairo_gcm_device_create(1024*1024*10, 1024*1024*15, 1024*1024*20);
        cairo_surface_t * surface = cairo_gcm_surface_create_for_texture(cairo_device, 1500, 1500);
     
   /* Init freetype */
  int error;
  FT_Library ft_library;
  error = FT_Init_FreeType(&ft_library);
  if (error)
  {
   printf("ERROR CODE: %d, filename: %s, line no. : %d\n", error, __FILE__,
 __LINE__);
  }
  //Load our fonts 
  FT_Face ft_face = NULL;
        error = FT_New_Face(ft_library, "/app_home/FreeMonoBold.ttf", 0, &ft_face);
  if (error)
  {
   printf("ERROR CODE: %d, filename: %s, line no. : %d\n", error, __FILE__, __LINE__);
  }
   
  cairo_font_face_t *myfont_face;
  myfont_face =  cairo_ft_font_face_create_for_ft_face(ft_face,0);
  
  cairo_matrix_t mxSize;
  cairo_matrix_t mxIdent;
  cairo_matrix_init_scale(&mxSize, 16, 16); // sizing..
  cairo_matrix_init_identity(&mxIdent);
  cairo_scaled_font_t* cairoFont = cairo_scaled_font_create(myfont_face, &mxSize, &mxIdent, 0);
  cairo_t *cr = cairo_create (surface);
  
  cairo_set_scaled_font(cr, cairoFont);
  cairo_set_font_size(cr, 16);
  cairo_new_path(cr);
  cairo_move_to(cr, 200, 200);
  
  cairo_text_path(cr, "Print Something");
  cairo_set_source_rgb(cr, 1, 0, 0);
  cairo_fill(cr);
  cairo_set_source_surface(cr, surface, 0, 0);
  cairo_paint(cr); 
sys_timer_usleep(20 *1000000);
 
I added sleep in the end, so that if there is any text I can see it before application exits.
But I still don't see anything.
 
Sorry, I am totally new to all this. You mentioned that it will be better if I use 
freetype library and glyph/font rendering already available in the SDK(yes, my platform is PS3)
but I am not sure how to find what is available in SDK and how to use it?
 
Please if you can provide any more guidance it would be of great help.
Thanks
 

________________________________
 From: Techie Help <[email protected]>
To: "[email protected]" <[email protected]> 
Sent: Wednesday, 7 November 2012, 21:28
Subject: Cairo and freetype
  

Hi,

I am new to Graphics, so new to cairo as well.
I am trying to render some text using Cairo and freetype.
The backend that I am using is gcm, and it does not support any glyphs etc.
Can anyone please provide me with an example how to do this.

Thanks

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.