[cairo] pango.Context from a cairo.ImageSurface ?
Tobias Ceglarek
dev at ceglarek.eu
Mon Feb 26 11:29:35 PST 2007
Hi Dom,
thanks for your very fast answer.
At first I have to correct: I do not need a pango.Context! I need a
pangocairo.CairoContext. Sorry.
I don't understand exactly. I will try to explain (with python syntax):
When I call cairo.Context(surface) I get a cairo.Context.
Then I create a pangocairo.CairoFontMap with
pangocairo.cairo_font_map_get_default().
This Object gives me with create_context() a pango.Context.
But then I do not understand. There is a function called update_context
in pangocairo.CairoContext. This function wants a pango.Context as
argument. But do I need a pangoCairoContext to call this Function or is
it static? When I call just like this:
pangocairo.CairoContext.update_context(mypangocontext) I get an error
message:
"TypeError: descriptor 'update_context' requires a
'pangocairo.CairoContext' object but received a 'pango.Context'"
Can anyone help me?
Cu,
Tobias
On Mon, 2007-02-26 at 13:22 -0500, Dominic Lachowicz wrote:
> Hi Tobias,
>
> Probably you want something similar to:
>
> // given a cairo surface, create a cairo_t
> cairo_create ()
>
> // get default font map
> pango_cairo_font_map_get_default ()
>
> // create PangoContext, given a fontmap
> pango_cairo_font_map_create_context ()
>
> // sync pango context with cairo context
> pango_cairo_update_context ()
>
> http://www.cairographics.org/manual/cairo-cairo-t.html
> http://developer.gnome.org/doc/API/2.0/pango/pango-Cairo-Rendering.html
>
> It looks like you're not using C, but there should be equivalent calls
> in whatever binding you're using.
>
> Best,
> Dom
>
> On 2/26/07, Tobias Ceglarek <dev at ceglarek.eu> wrote:
> > Hello,
> >
> > I need to get a pango.Context from a cairo.ImageSurface?
> >
> > More precisely: I want to produce a png image file with
> > cairo.ImageSurface.write_to_png(). So I need a cairo.ImageSurface. But I
> > need a pango.Context too, because I want to use pango to layout text
> > comfortably.
> >
> > Is it possible?
> >
> > Regards,
> >
> > TC
> >
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> >
>
>
More information about the cairo
mailing list