[cairo] pango.Context from a cairo.ImageSurface ?

Tobias Ceglarek dev at ceglarek.eu
Wed Feb 28 09:00:50 PST 2007


On Mon, 2007-02-26 at 15:02 -0500, Behdad Esfahbod wrote:
> On Mon, 2007-02-26 at 14:29 -0500, Tobias Ceglarek wrote:
> > 
> > When I call cairo.Context(surface) I get a cairo.Context.
> 
> Then do a pangocairo.CairoContext(cairo_context) to get a
> pango_cairo_context:
> 
>   cr = cairo.Context (surface)
>   pcr = pangocairo.CairoContext (cr)
>   
>   layout = pcr.create_layout ()
> 
>   ...
> 
>   pcr.show_layout (layout, ...)
> 
> 
> The confusing point here is that pangocairo.CairoContext is a subclass
> of a cairo.Context that adds support for rendering to it using Pango.
> It's not a subclass of pango.Context.
> 
> 

Thank you. Now I have a pango.CairoContext and I can draw text with

layout = pctx.create_layout()
layout.set_font_description(myfontdesc)
layout.set_text(mytext)
pctx.show_layout(layout)

Works fine. It recognize my font description ...

but layout.set_alignment(pango.ALIGN_CENTER) does not work. It has no
effect.

Could anyone tell me why?

Regards,

Tobias




More information about the cairo mailing list