Next: , Previous: GtkTextBuffer, Up: Top


29 GtkTextTag

A tag that can be applied to text in a

29.1 Overview

You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.

Tags should be in the <gtk-text-tag-table> for a given <gtk-text-buffer> before using them with that buffer.

gtk-text-buffer-create-tag is the best way to create tags. See for numerous examples.

The "invisible" property was not implemented for GTK+ 2.0; it's planned to be implemented in future releases.

29.2 Usage

— Class: <gtk-text-tag>

Derives from <gobject>.

This class defines the following slots:

name
Name used to refer to the text tag. NULL for anonymous tags
background
Background color as a string
foreground
Foreground color as a string
background-gdk
Background color as a (possibly unallocated) GdkColor
foreground-gdk
Foreground color as a (possibly unallocated) GdkColor
background-stipple
Bitmap to use as a mask when drawing the text background
foreground-stipple
Bitmap to use as a mask when drawing the text foreground
font
Font description as a string, e.g. "Sans Italic 12"
font-desc
Font description as a PangoFontDescription struct
family
Name of the font family, e.g. Sans, Helvetica, Times, Monospace
style
Font style as a PangoStyle, e.g. PANGO_STYLE_ITALIC
variant
Font variant as a PangoVariant, e.g. PANGO_VARIANT_SMALL_CAPS
weight
Font weight as an integer, see predefined values in PangoWeight; for example, PANGO_WEIGHT_BOLD
stretch
Font stretch as a PangoStretch, e.g. PANGO_STRETCH_CONDENSED
size
Font size in Pango units
size-points
Font size in points
scale
Font size as a scale factor relative to the default font size. This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as PANGO_SCALE_X_LARGE
pixels-above-lines
Pixels of blank space above paragraphs
pixels-below-lines
Pixels of blank space below paragraphs
pixels-inside-wrap
Pixels of blank space between wrapped lines in a paragraph
editable
Whether the text can be modified by the user
wrap-mode
Whether to wrap lines never, at word boundaries, or at character boundaries
justification
Left, right, or center justification
direction
Text direction, e.g. right-to-left or left-to-right
left-margin
Width of the left margin in pixels
indent
Amount to indent the paragraph, in pixels
strikethrough
Whether to strike through the text
right-margin
Width of the right margin in pixels
underline
Style of underline for this text
rise
Offset of text above the baseline (below the baseline if rise is negative) in Pango units
background-full-height
Whether the background color fills the entire line height or only the height of the tagged characters
language
The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If not set, an appropriate default will be used.
tabs
Custom tabs for this text
invisible
Whether this text is hidden.
paragraph-background
Paragraph background color as a string
paragraph-background-gdk
Paragraph background color as a (possibly unallocated) GdkColor
accumulative-margin
Whether left and right margins accumulate.
background-set
Whether this tag affects the background color
foreground-set
Whether this tag affects the foreground color
background-stipple-set
Whether this tag affects the background stipple
foreground-stipple-set
Whether this tag affects the foreground stipple
family-set
Whether this tag affects the font family
style-set
Whether this tag affects the font style
variant-set
Whether this tag affects the font variant
weight-set
Whether this tag affects the font weight
stretch-set
Whether this tag affects the font stretch
size-set
Whether this tag affects the font size
scale-set
Whether this tag scales the font size by a factor
pixels-above-lines-set
Whether this tag affects the number of pixels above lines
pixels-below-lines-set
Whether this tag affects the number of pixels above lines
pixels-inside-wrap-set
Whether this tag affects the number of pixels between wrapped lines
editable-set
Whether this tag affects text editability
wrap-mode-set
Whether this tag affects line wrap mode
justification-set
Whether this tag affects paragraph justification
left-margin-set
Whether this tag affects the left margin
indent-set
Whether this tag affects indentation
strikethrough-set
Whether this tag affects strikethrough
right-margin-set
Whether this tag affects the right margin
underline-set
Whether this tag affects underlining
rise-set
Whether this tag affects the rise
background-full-height-set
Whether this tag affects background height
language-set
Whether this tag affects the language the text is rendered as
tabs-set
Whether this tag affects tabs
invisible-set
Whether this tag affects text visibility
paragraph-background-set
Whether this tag affects the paragraph background color
— Signal on <gtk-text-tag>: event (arg0 <gobject>) (arg1 <gdk-event>) (arg2 <gtk-text-iter>) ⇒ <gboolean>
— Class: <gtk-text-attributes>

Derives from <gboxed>.

This class defines no direct slots.

— Function: gtk-text-tag-new (name mchars) ⇒  (ret <gtk-text-tag>)

Creates a <gtk-text-tag>. Configure the tag using object arguments, i.e. using g-object-set.

name
tag name, or ‘#f
ret
a new <gtk-text-tag>
— Function: gtk-text-tag-get-priority (self <gtk-text-tag>) ⇒  (ret int)
— Method: get-priority

Get the tag priority.

tag
a <gtk-text-tag>
ret
The tag's priority.
— Function: gtk-text-tag-set-priority (self <gtk-text-tag>) (priority int)
— Method: set-priority

Sets the priority of a <gtk-text-tag>. Valid priorities are start at 0 and go to one less than gtk-text-tag-table-get-size. Each tag in a table has a unique priority; setting the priority of one tag shifts the priorities of all the other tags in the table to maintain a unique priority for each tag. Higher priority tags "win" if two tags both set the same text attribute. When adding a tag to a tag table, it will be assigned the highest priority in the table by default; so normally the precedence of a set of tags is the order in which they were added to the table, or created with gtk-text-buffer-create-tag, which adds the tag to the buffer's table automatically.

tag
a <gtk-text-tag>
priority
the new priority
— Function: gtk-text-tag-event (self <gtk-text-tag>) (event_object <gobject>) (event <gdk-event>) (iter <gtk-text-iter>) ⇒  (ret bool)
— Method: event

Emits the "event" signal on the <gtk-text-tag>.

tag
a <gtk-text-tag>
event-object
object that received the event, such as a widget
event
the event
iter
location where the event was received
ret
result of signal emission (whether the event was handled)
— Function: gtk-text-attributes-new ⇒  (ret <gtk-text-attributes>)

Creates a <gtk-text-attributes>, which describes a set of properties on some text.

ret
a new <gtk-text-attributes>
— Function: gtk-text-attributes-copy (self <gtk-text-attributes>) ⇒  (ret <gtk-text-attributes>)

Copies src and returns a new <gtk-text-attributes>.

src
a <gtk-text-attributes> to be copied
ret
a copy of src
— Function: gtk-text-attributes-copy-values (self <gtk-text-attributes>) (dest <gtk-text-attributes>)

Copies the values from src to dest so that dest has the same values as src. Frees existing values in dest.

src
a <gtk-text-attributes>
dest
another <gtk-text-attributes>