I agree, I was just trying to keep it simple.
On Tuesday, 4 January 2011, Jaroslav Šmíd <[email protected]> wrote: > Don't do that. Fixed size buffers are evil for string formatting. You better > use g_strdup_printf even though this would lead to reallocations. But much > better then end up with cropped text. > > On 01/02/2011 10:00 PM, [email protected] wrote: > > On 2 January 2011 15:39, John Emmas<[email protected]> wrote: > > To be honest, all I'm trying to do is create a button whose label font can be > changed on demand. I've managed to achieve it by using an empty button with > a label on top, except that the label doesn't always stay on top! > > > Ah, OK, yes, there's a much simpler technique. > > Try something like this: > > txt = "some text to display"; > font = "sans 12"; > > snprintf (button_text, 256, > "<span font_desc=\"%s\" size=\"medium\">%s</span>", > font, txt); > gtk_label_set_markup ( > GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), > button_text); > > Assuming 'button' is a regular gtk button containing a label. > > John > _______________________________________________ > gtk-app-devel-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > _______________________________________________ gtk-app-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
