Re: rendering text to drawable
- From: HuamiSoft Hubert Sokolowski <h sokolowski huamisoft com>
- To: gtk-app-devel-list gnome org
- Subject: Re: rendering text to drawable
- Date: Wed, 31 Aug 2005 08:12:51 +0200
Hi!
On Tue, 30 Aug 2005 23:11:29 +0200
Mateusz Misiorny <mateusz misiorny gmail com> wrote:
Hi,
I just wanted to render some simple strings to a drawable (a pixmap)
and it seems it requires massive amount of work and code just to get a
few characters on the screen. I am talking about the "new" way of
rendering text - through pango. I have to create many structures and
fill many fields just to get a plain simple text rendered (which still
I didn't manage to do since I gave up after I spend way too much time
on that than I wanted). How do I do it with minimal work?
I do it this way and I think this is the minimal way to do it
PangoLayout *layout;
PangoContext *context;
void draw_init ()
{
context = gdk_pango_context_get ();
layout = pango_layout_new (context);
pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
}
void draw_text (GdkPixmap *pixmap, GdkGC *gc, const gchar *str, gint x,
gint y)
{
pango_layout_set_markup (layout, str, -1);
gdk_draw_layout (pixmap, gc, x, y, layout);
}
--
HuamiSoft Hubert Sokolowski
http://www.huamisoft.com/
tel. 501456743
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]