Next: , Previous: ClutterGroup, Up: Top


23 ClutterLabel

Actor for displaying text

23.1 Overview

<clutter-label> is a <clutter-actor> that displays text using Pango.

23.2 Usage

— Class: <clutter-label>

Derives from <clutter-actor>.

This class defines the following slots:

font-name
Pango font description
text
Text to render
color
Font Colour
attributes
A list of style attributes to apply to the text of the label
use-markup
The text of the label includes XML markup. See pango_parse_markup()
alignment
The preferred alignment for the string
wrap
If set, wrap lines if the text becomes too wide
wrap-mode
If wrap is set, controls how line-wrapping is done
justify
Whether the contents of the label should be justified
ellipsize
The preferred place to ellipsize the string, if the label does not have enough room to display the entire string
— Function: clutter-label-new   (ret <clutter-actor>)

Creates a new, empty <clutter-label>.

ret
the newly created <clutter-label>
— Function: clutter-label-new-with-text (font_name mchars) (text mchars)   (ret <clutter-actor>)

Creates a new <clutter-label> displaying text using font-name.

font-name
the name (and size) of the font to be used
text
the text to be displayed
ret
a <clutter-label>
— Function: clutter-label-new-full (font_name mchars) (text mchars) (color <clutter-color>)   (ret <clutter-actor>)

Creates a new <clutter-label> displaying text with color using font-name.

font-name
the name (and size) of the font to be used
text
the text to be displayed
color
<clutter-color> for text
ret
a <clutter-label>
— Function: clutter-label-set-text (self <clutter-label>) (text mchars)
— Method: set-text

Sets text as the text to be displayed by label.

label
a <clutter-label>
text
the text to be displayed
— Function: clutter-label-get-text (self <clutter-label>)   (ret mchars)
— Method: get-text

Retrieves the text displayed by label

label
a <clutter-label>
ret
the text of the label. The returned string is owned by <clutter-label> and should not be modified or freed.
— Function: clutter-label-set-font-name (self <clutter-label>) (font_name mchars)
— Method: set-font-name

Sets font-name as the font used by label.

font-name must be a string containing the font name and its size, similarly to what you would feed to the pango-font-description-from-string function.

label
a <clutter-label>
font-name
a font name and size, or ‘#f’ for the default font
— Function: clutter-label-get-font-name (self <clutter-label>)   (ret mchars)
— Method: get-font-name

Retrieves the font used by label.

label
a <clutter-label>
ret
a string containing the font name, in a format understandable by pango-font-description-from-string. The string is owned by label and should not be modified or freed.
— Function: clutter-label-set-color (self <clutter-label>) (color <clutter-color>)
— Method: set-color

Sets the color of label.

label
a <clutter-label>
color
a <clutter-color>
— Function: clutter-label-get-color (self <clutter-label>) (color <clutter-color>)
— Method: get-color

Retrieves the color of label.

label
a <clutter-label>
color
return location for a <clutter-color>
— Function: clutter-label-set-ellipsize (self <clutter-label>) (mode <pango-ellipsize-mode>)
— Method: set-ellipsize

Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.

label
a <clutter-label>
mode
a <pango-ellipsize-mode>

Since 0.2

— Function: clutter-label-get-ellipsize (self <clutter-label>)   (ret <pango-ellipsize-mode>)
— Method: get-ellipsize

Returns the ellipsizing position of the label. See clutter-label-set-ellipsize.

label
a <clutter-label>
ret
<pango-ellipsize-mode>

Since 0.2

— Function: clutter-label-set-line-wrap (self <clutter-label>) (wrap bool)
— Method: set-line-wrap

Toggles line wrapping within the <clutter-label> widget. ‘#t’ makes it break lines if text exceeds the widget's size. ‘#f’ lets the text get cut off by the edge of the widget if it exceeds the widget size.

label
a <clutter-label>
wrap
the setting

Since 0.2

— Function: clutter-label-get-line-wrap (self <clutter-label>)   (ret bool)
— Method: get-line-wrap

Returns whether lines in the label are automatically wrapped. See clutter-label-set-line-wrap.

label
a <clutter-label>
ret
#t’ if the lines of the label are automatically wrapped.

Since 0.2

— Function: clutter-label-set-line-wrap-mode (self <clutter-label>) (wrap_mode <pango-wrap-mode>)
— Method: set-line-wrap-mode

If line wrapping is on (see clutter-label-set-line-wrap) this controls how the line wrapping is done. The default is ‘PANGO_WRAP_WORD’ which means wrap on word boundaries.

label
a <clutter-label>
wrap-mode
the line wrapping mode

Since 0.2

— Function: clutter-label-get-line-wrap-mode (self <clutter-label>)   (ret <pango-wrap-mode>)
— Method: get-line-wrap-mode

Returns line wrap mode used by the label. See clutter-label-set-line-wrap-mode.

label
a <clutter-label>
ret
#t’ if the lines of the label are automatically wrapped.

Since 0.2

— Function: clutter-label-get-layout (self <clutter-label>)   (ret <pango-layout>)
— Method: get-layout

Gets the <pango-layout> used to display the label. The layout is useful to e.g. convert text positions to pixel positions. The returned layout is owned by the label so need not be freed by the caller.

label
a <clutter-label>
ret
the <pango-layout> for this label

Since 0.2

— Function: clutter-label-set-attributes (self <clutter-label>) (attrs <pango-attr-list>)
— Method: set-attributes

Sets a <pango-attr-list>; the attributes in the list are applied to the label text. The attributes set with this function will be ignored if the "use_markup" property is ‘#t’.

label
a <clutter-label>
attrs
a <pango-attr-list>

Since 0.2

— Function: clutter-label-get-attributes (self <clutter-label>)   (ret <pango-attr-list>)
— Method: get-attributes

Gets the attribute list that was set on the label using clutter-label-set-attributes, if any.

label
a <clutter-label>
ret
the attribute list, or ‘#f’ if none was set.

Since 0.2

— Function: clutter-label-set-use-markup (self <clutter-label>) (setting bool)
— Method: set-use-markup

Sets whether the text of the label contains markup in Pango's text markup language.

label
a <clutter-label>
setting
#t’ if the label's text should be parsed for markup.
— Function: clutter-label-get-use-markup (self <clutter-label>)   (ret bool)
— Method: get-use-markup

Returns whether the label's text is interpreted as marked up with the Pango text markup language. See clutter-label-set-use-markup.

label
a <clutter-label>
ret
#t’ if the label's text will be parsed for markup.
— Function: clutter-label-set-alignment (self <clutter-label>) (alignment <pango-alignment>)
— Method: set-alignment

Sets text alignment of the label.

label
a <clutter-label>
alignment
A <pango-alignment>
— Function: clutter-label-get-alignment (self <clutter-label>)   (ret <pango-alignment>)
— Method: get-alignment

Returns the label's text alignment

label
a <clutter-label>
ret
The label's <pango-alignment> Since 0.2
— Function: clutter-label-get-justify (self <clutter-label>)   (ret bool)
— Method: get-justify

Retrieves whether the label should justify the text on both margins.

label
a <clutter-label>
ret
#t’ if the text should be justified

Since 0.6

— Function: clutter-label-set-justify (self <clutter-label>) (justify bool)
— Method: set-justify

Sets whether the text of the label actor should be justified on both margins. This setting is ignored if Clutter is compiled against Pango < 1.18.

label
a <clutter-label>
justify
whether the text should be justified

Since 0.6