set_markup


Description:

public void set_markup (string str)

Parses str which is marked up with the Pango text markup language, setting the label’s text and attribute list based on the parse results.

If the str is external data, you may need to escape it with escape_text or printf_escaped:

GtkWidget *label = gtk_label_new (NULL);
const char *str = "some text";
const char *format = "<span style=\"italic\">\%s</span>";
char *markup;

markup = g_markup_printf_escaped (format, str);
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);

This function will set the use_markup property to true as a side effect.

If you set the label contents using the label property you should also ensure that you set the use_markup property accordingly.

See also: set_text

Parameters:

this

a Label

str

a markup string (see Pango markup format)