Re: [gtkmm] problems using pangomm to render text on a drawable (1.3.21)
- From: MHL Schulze t-online de (Martin Schulze)
- To: Patrick Crosby <pcrosby pobox com>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] problems using pangomm to render text on a drawable (1.3.21)
- Date: Tue, 3 Sep 2002 22:12:26 +0200
Am 03.09.2002 21:05 schrieb(en) Patrick Crosby:
in converting one of my apps to gtkmm2 (using v1.3.21), i've been
trying to use pango for font rendering but haven't had much luck. the
following program:
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <pangomm/layout.h>
int
main(int argc, char* argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window win(Gtk::WINDOW_TOPLEVEL);
win.set_default_size(500, 100);
win.show_all();
Glib::RefPtr<Pango::Context> pContext = Pango::Context::create();
pContext->set_font_description(Pango::FontDescription("fixed"));
Glib::RefPtr<Pango::Layout> pLayout =
Pango::Layout::create(pContext);
pLayout->set_text("Pango Test Application");
Glib::RefPtr<Gdk::GC> gc = win.get_style()->get_black_gc();
win.get_window()->draw_layout(gc, 10, 10, pLayout);
kit.run();
}
I guess you should try:
Glib::RefPtr<Pango::Context> pContext = win.get_pango_context();
or
Glib::RefPtr<Pango::Layout> pLayout = win.create_pango_layout("Pango Test
Application");
The output sounds as if some fields of the context were not set.
But I'm learning this stuff myself at the moment so please let me
hear whether this helps...
Regards,
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]