GdkFont->Pango replacement



Hi

I am facing few problems when I replace gdk_draw_string with pango
equivalents. I am using PangoLayout.

*    Earlier gdk_font_width () used to give the distance from the
beginning of the current string to the point where the next string is to
be drawn. The closest equivalent I found to this is
pango_font_metrics_get_approximate_char_width (metrics).  It gives the
character width. Can I multiply this by the length of the string to get
string width as given by gdk_font_width ()? Or is there any other way
for doing this?

*    To replace gdk_draw_string (), I do the following
           GtkWidget *area;
           PangoLayout *layout;
           GdkPixmap *pixmap;
           layout = gtk_widget_create_pango_layout (area, "");
           pango_layout_set_text (layout, string, -1);
           gtk_paint_layout (area->style,
                                          pixmap,
                                          GTK_WIDGET_STATE (area),
                                          FALSE,
                                          NULL,
                                          area,
                                          NULL,
                                          x,
                                          y,
                                          layout);

Any help is appreciated.

Thanks in advance,
Deepa








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]