gtk pango draw rotated text
Hi, I want to draw some rotated text on a Window. I've tried every code I found on the net but still no solution :( I would like to draw some rotated text on a window, the rotation point should X,Y and not to the center of the rectangle where the text is draw. Can anyone please help me? This is my current code (in pascal): WidgetCont := pango_layout_get_context(UseFont); rotated_matrix.xx := 1.0; rotated_matrix.xy := 0.0; rotated_matrix.yx := 0.0; rotated_matrix.yy := 1.0; rotated_matrix.x0 := 0.0; rotated_matrix.y0 := 0.0; pango_matrix_rotate (@rotated_matrix, 45); pango_context_set_matrix (WidgetCont, @rotated_matrix); pango_layout_context_changed (UseFont); gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.GC, X, Y, UseFont, Foreground, nil); Thanks in advance. Luis ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk pango draw rotated text
It's not on my system. I use Debian, do you happen do know the package name? Thanks, Luis On Sun, 2007-09-09 at 19:40 -0400, James Scott Jr wrote: > Take a look at the excellent example in the program 'gtk-demo', which > should be installed on your system already. > Try '# gtk-demo', then choose the 'rotated text' example. Note: > double-clinking the choice launches the example, also notice the two > tabs - one show description, one show the actual code. > > James, > > On Mon, 2007-09-10 at 00:33 +0100, Luis Rodrigues wrote: > > Hi, > > > > I want to draw some rotated text on a Window. I've tried every code I > > found on the net but still no solution :( > > > > I would like to draw some rotated text on a window, the rotation point > > should X,Y and not to the center of the rectangle where the text is > > draw. > > > > Can anyone please help me? > > > > This is my current code (in pascal): > > > > WidgetCont := pango_layout_get_context(UseFont); > > rotated_matrix.xx := 1.0; > > rotated_matrix.xy := 0.0; > > rotated_matrix.yx := 0.0; > > rotated_matrix.yy := 1.0; > > rotated_matrix.x0 := 0.0; > > rotated_matrix.y0 := 0.0; > > pango_matrix_rotate (@rotated_matrix, 45); > > pango_context_set_matrix (WidgetCont, @rotated_matrix); > > pango_layout_context_changed (UseFont); > > gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.GC, X, Y, UseFont, > > Foreground, nil); > > > > > > Thanks in advance. > > > > Luis > > > > > > ___ > > gtk-app-devel-list mailing list > > gtk-app-devel-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk pango draw rotated text
Thanks for the support. For future reference in google or whatever: Pascal Rotate Text GTK2 renderer := gdk_pango_renderer_get_default( gtk_widget_get_screen(DevCtx.DCWidget) ); gdk_pango_renderer_set_drawable ( renderer, DevCtx.drawable); gdk_pango_renderer_set_gc ( renderer, DevCtx.GC); WidgetCont := pango_layout_get_context(UseFont); matrix.xx := 1.0; matrix.xy := 0.0; matrix.yx := 0.0; matrix.yy := 1.0; matrix.x0 := 0.0; matrix.y0 := 0.0; pango_matrix_translate (@matrix, X, Y); <--pos to draw pango_matrix_rotate (@matrix, 285); <--angle pango_context_set_matrix (WidgetCont, @matrix); pango_layout_context_changed (DevCtx.Layout); pango_renderer_draw_layout (renderer, DevCtx.Layout X, Y);<--pos todraw gdk_pango_renderer_set_drawable ( renderer, nil); gdk_pango_renderer_set_gc ( renderer, nil); _LR_ On Mon, 2007-09-10 at 17:06 +0200, David Nečas (Yeti) wrote: > On Mon, Sep 10, 2007 at 01:27:48PM +0100, Luis Rodrigues wrote: > > It's not on my system. > > > > I use Debian, do you happen do know the package name? > > http://packages.debian.org/search?searchon=contents&keywords=gtk-demo&mode=path&suite=stable&arch=any > > Yeti > > -- > http://gwyddion.net/ > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list