set_markup


Description:

public void set_markup (string str)

Sets the labels text and attributes from markup.

The string must be marked up with Pango markup (see [func@Pango.parse_markup]).

If str is external data, you may need to escape it with [func@GLib.markup_escape_text] or [func@GLib.markup_printf_escaped]:

```c GtkWidget *self = gtk_label_new (NULL); const char *str = "..."; const char *format = "<span style=\"italic\">%s</span>"; char *markup;

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

This function sets the [property@Gtk.Label:use-markup] property to true.

Also see [method@Gtk.Label.set_text].

Parameters:

this

a label

str

the markup string