Pango layouts rendering on Windows using Cairo.
- From: Plex <plexer gmail com>
- To: gtk-i18n-list gnome org
- Subject: Pango layouts rendering on Windows using Cairo.
- Date: Wed, 1 Oct 2008 12:05:23 +1100
Hi,
I'm trying to work with Pango and Cairo under Gtkmm, currently running
on Windows.
I'm having trouble getting Pango to render nice text. In this screenshot:
http://i183.photobucket.com/albums/x210/plexerSE/pango.gif
the first line of text is rendered with Cairo and the second with
Pango using the following code:
// Create context from the window handle of a GTK+ Drawing Area.
Cairo::RefPtr<Cairo::Context> context = window->create_cairo_context();
// Draw some text using Cairo
context->set_source_rgb(0.8, 0.0, 0.0);
context->move_to(30, 30);
context->set_font_size(24);
context->show_text("This is drawn by cairo");
// Draw some text using Pango
Glib::RefPtr<Pango::Layout> pangoLayout = Pango::Layout::create (context);
context->move_to(30, 60);
pangoLayout->update_from_cairo_context(context);
Pango::FontDescription font_descr( "Sans Normal 24" );
pangoLayout->set_font_description( font_descr);
pangoLayout->set_text("This is drawn by Pango");
pangoLayout->add_to_cairo_context(context); //adds text to
cairos stack of stuff to be drawn?
context->fill();
I expected the Pango text to look similar to, or at least no worse
than, the cairo text (which is looking pretty awful to begin with, I
think I must not have anti-aliasing enabled). I assume the reason is
that I'm using Pango incorrectly, but I've been unable to find much
documentation on the topic. Has anyone here successfully gotten Pango
to play nicely with Cairo under Gtkmm?
Regards,
James McGill
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]