On Wed, 2010-04-07 at 16:16 +0200, Oscar Lazzarino wrote:

> OK, let's try lowering the bar ;-)
> 
> Would it be possible to use cogl_pango outside of the clutter_text
> actor (i.e. in a custom actor)?

yes.

> The cogl_pango functions are treated as private functions and not
> documented, as far as I can see, and the "simple" approach

the fact that are undocumented has nothing to do with whether they are
private or not. :-)

private functions in clutter or cogl are prefixed by an underscore.

>     CoglColor *lWhite = cogl_color_new();
>     cogl_color_set_from_4f(lWhite, 1.0, 1.0, 1.0, 1.0);

don't allocate a new CoglColor - use it on the stack:

  CoglColor white;

  cogl_color_set_from_4f (&white, 1.0, 1.0, 1.0, 1.0);

>     cogl_set_source_color(lWhite);
> 
>     PangoContext *lPangoCtx = pango_context_new();

use:

  layout = clutter_actor_create_pango_layout (actor, "some text");

instead of creating the layout and context yourself.

>     pango_font_description_set_family(lPangoFontDescr, "Sans");
>     pango_font_description_set_size(lPangoFontDescr, 10 * PANGO_SCALE);
>     pango_layout_set_font_description(lPangoLayout, lPangoFontDescr);

>     cogl_pango_render_layout(lPangoLayout, mWidth/2, mHeight/2, lWhite, 0);
> 

this should work.

> shows me the ellipse, but not the text.
> 
> I get the message
> 
> (testCOGL:13610): CoglPango-CRITICAL **:
> cogl_pango_get_renderer_from_context: assertion
> `COGL_PANGO_IS_FONT_MAP (font_map)' failed
> 
> Any hints?

yes: you should not use generic PangoCairo context and layouts, and use
the ones that Clutter creates for you. :-)

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, Open Source Software Engineer
Intel Open Source Technology Center

-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com

Reply via email to