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 [[email protected]_markup]).

If the str is external data, you may need to escape it with escape_text or 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 will set the [[email protected]:use-markup] property to true as a side effect.

If you set the label contents using the [[email protected]:label] property you should also ensure that you set the [ [email protected]:use-markup] property accordingly.

See also: [[email protected]_text]

Parameters:

this

a `GtkLabel`

str

a markup string




2022 vala-language.org