It derives from <GObject>.
Can be applied to text contained in a
<GtkTextBuffer>.
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 <GtkTextTagTable> for a
given <GtkTextBuffer> before using them with
that buffer.
Gtk.TextBuffer.create_tag is the best way to create tags. See
“gtk4-demo” for numerous examples.
For each property of <GtkTextTag>, there is a
“set” property, e.g. “font-set” corresponds to “font”. These “set”
properties reflect whether a property has been set or not.
They are maintained by GTK and you should not set them independently.
parent-instanceprivWhether the margins accumulate or override each other.
When set to #t the margins of this tag are added to the margins
of any other non-accumulative margins present. When set to #f
the margins override one another (the default).
Its value is a boolean.
Set it with (set! (text-tag:accumulative-margin self) value).
Whether breaks are allowed.
Its value is a boolean.
Set it with (set! (text-tag:allow-breaks self) value).
Whether the allow-breaks property is set.
Its value is a boolean.
Set it with (set! (text-tag:allow-breaks-set self) value).
Background color as a string.
Its value is a string, or #f.
It can only be set, with (set! (text-tag:background self) value).
Whether the background color fills the entire line height or only the height of the tagged characters.
Its value is a boolean.
Set it with (set! (text-tag:background-full-height self) value).
Whether the background-full-height property is set.
Its value is a boolean.
Set it with (set! (text-tag:background-full-height-set self)
value).
Background color as a <GdkRGBA>.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:background-rgba self) value).
Whether the background property is set.
Its value is a boolean.
Set it with (set! (text-tag:background-set self) value).
Text direction, e.g. right-to-left or left-to-right.
Its value is a <GtkTextDirection> (or, to
set it, one of its symbols).
Set it with (set! (text-tag:direction self) value).
Whether the text can be modified by the user.
Its value is a boolean.
Set it with (set! (text-tag:editable self) value).
Whether the editable property is set.
Its value is a boolean.
Set it with (set! (text-tag:editable-set self) value).
Whether font fallback is enabled.
When set to #t, other fonts will be substituted where the current
font is missing glyphs.
Its value is a boolean.
Set it with (set! (text-tag:fallback self) value).
Whether the fallback property is set.
Its value is a boolean.
Set it with (set! (text-tag:fallback-set self) value).
Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
Its value is a string, or #f.
Set it with (set! (text-tag:family self) value).
Whether the family property is set.
Its value is a boolean.
Set it with (set! (text-tag:family-set self) value).
Font description as string, e.g. \"Sans Italic 12\".
Note that the initial value of this property depends on the internals of
<PangoFontDescription>.
Its value is a string, or #f.
Set it with (set! (text-tag:font self) value).
Font description as a
<PangoFontDescription>.
Its value is a
<PangoFontDescription>, or
#f.
Set it with (set! (text-tag:font-desc self) value).
OpenType font features, as a string.
Its value is a string, or #f.
Set it with (set! (text-tag:font-features self) value).
Whether the font-features property is set.
Its value is a boolean.
Set it with (set! (text-tag:font-features-set self) value).
Foreground color as a string.
Its value is a string, or #f.
It can only be set, with (set! (text-tag:foreground self) value).
Foreground color as a <GdkRGBA>.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:foreground-rgba self) value).
Whether the foreground property is set.
Its value is a boolean.
Set it with (set! (text-tag:foreground-set self) value).
Amount to indent the paragraph, in pixels.
A negative value of indent will produce a hanging indentation. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.
Its value is a 32-bit integer.
Set it with (set! (text-tag:indent self) value).
Whether the indent property is set.
Its value is a boolean.
Set it with (set! (text-tag:indent-set self) value).
Whether to insert hyphens at breaks.
Its value is a boolean.
Set it with (set! (text-tag:insert-hyphens self) value).
Whether the insert-hyphens property is set.
Its value is a boolean.
Set it with (set! (text-tag:insert-hyphens-set self) value).
Whether this text is hidden.
Note that there may still be problems with the support for invisible text, in particular when navigating programmatically inside a buffer containing invisible segments.
Its value is a boolean.
Set it with (set! (text-tag:invisible self) value).
Whether the invisible property is set.
Its value is a boolean.
Set it with (set! (text-tag:invisible-set self) value).
Left, right, or center justification.
Its value is a <GtkJustification> (or, to
set it, one of its symbols).
Set it with (set! (text-tag:justification self) value).
Whether the justification property is set.
Its value is a boolean.
Set it with (set! (text-tag:justification-set self) value).
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.
Note that the initial value of this property depends on the current
locale, see also
get-default-language.
Its value is a string, or #f.
Set it with (set! (text-tag:language self) value).
Whether the language property is set.
Its value is a boolean.
Set it with (set! (text-tag:language-set self) value).
Width of the left margin in pixels.
Its value is a 32-bit integer.
Set it with (set! (text-tag:left-margin self) value).
Whether the left-margin property is set.
Its value is a boolean.
Set it with (set! (text-tag:left-margin-set self) value).
Extra spacing between graphemes, in Pango units.
Its value is a 32-bit integer.
Set it with (set! (text-tag:letter-spacing self) value).
Whether the letter-spacing property is set.
Its value is a boolean.
Set it with (set! (text-tag:letter-spacing-set self) value).
Factor to scale line height by.
Its value is a real number.
Set it with (set! (text-tag:line-height self) value).
Whether the line-height property is set.
Its value is a boolean.
Set it with (set! (text-tag:line-height-set self) value).
The name used to refer to the tag.
#f for anonymous tags.
Its value is a string, or #f.
It can only be set when the object is made, with #:name.
Style of overline for this text.
Its value is a <PangoOverline> (or, to set
it, one of its symbols).
Set it with (set! (text-tag:overline self) value).
This property modifies the color of overlines.
If not set, overlines will use the foreground color.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:overline-rgba self) value).
Whether the overline-rgba property is set.
Its value is a boolean.
Set it with (set! (text-tag:overline-rgba-set self) value).
Whether the overline property is set.
Its value is a boolean.
Set it with (set! (text-tag:overline-set self) value).
The paragraph background color as a string.
Its value is a string, or #f.
It can only be set, with (set! (text-tag:paragraph-background
self) value).
The paragraph background color as a <GdkRGBA>.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:paragraph-background-rgba self)
value).
Whether the paragraph-background property is set.
Its value is a boolean.
Set it with (set! (text-tag:paragraph-background-set self)
value).
Pixels of blank space above paragraphs.
Its value is a 32-bit integer.
Set it with (set! (text-tag:pixels-above-lines self) value).
Whether the pixels-above-lines property is set.
Its value is a boolean.
Set it with (set! (text-tag:pixels-above-lines-set self) value).
Pixels of blank space below paragraphs.
Its value is a 32-bit integer.
Set it with (set! (text-tag:pixels-below-lines self) value).
Whether the pixels-below-lines property is set.
Its value is a boolean.
Set it with (set! (text-tag:pixels-below-lines-set self) value).
Pixels of blank space between wrapped lines in a paragraph.
Its value is a 32-bit integer.
Set it with (set! (text-tag:pixels-inside-wrap self) value).
Whether the pixels-inside-wrap property is set.
Its value is a boolean.
Set it with (set! (text-tag:pixels-inside-wrap-set self) value).
Width of the right margin, in pixels.
Its value is a 32-bit integer.
Set it with (set! (text-tag:right-margin self) value).
Whether the right-margin property is set.
Its value is a boolean.
Set it with (set! (text-tag:right-margin-set self) value).
Offset of text above the baseline, in Pango units.
Negative values go below the baseline.
Its value is a 32-bit integer.
Set it with (set! (text-tag:rise self) value).
Whether the rise property is set.
Its value is a boolean.
Set it with (set! (text-tag:rise-set self) value).
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.
Its value is a real number.
Set it with (set! (text-tag:scale self) value).
Whether the scale property is set.
Its value is a boolean.
Set it with (set! (text-tag:scale-set self) value).
Whether this tag represents a single sentence.
This affects cursor movement.
Its value is a boolean.
Set it with (set! (text-tag:sentence self) value).
Whether the sentence property is set.
Its value is a boolean.
Set it with (set! (text-tag:sentence-set self) value).
How to render invisible characters.
Its value is a <PangoShowFlags> (or, to
set it, a list of its symbols, or one of them).
Set it with (set! (text-tag:show-spaces self) value).
Whether the show-spaces property is set.
Its value is a boolean.
Set it with (set! (text-tag:show-spaces-set self) value).
Font size in Pango units.
Its value is a 32-bit integer.
Set it with (set! (text-tag:size self) value).
Font size in points.
Its value is a real number.
Set it with (set! (text-tag:size-points self) value).
Whether the size property is set.
Its value is a boolean.
Set it with (set! (text-tag:size-set self) value).
Font stretch as a <PangoStretch>, e.g.
condensed.
Its value is a <PangoStretch> (or, to set
it, one of its symbols).
Set it with (set! (text-tag:stretch self) value).
Whether the stretch property is set.
Its value is a boolean.
Set it with (set! (text-tag:stretch-set self) value).
Whether to strike through the text.
Its value is a boolean.
Set it with (set! (text-tag:strikethrough self) value).
This property modifies the color of strikeouts.
If not set, strikeouts will use the foreground color.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:strikethrough-rgba self) value).
If the strikethrough-rgba property has been set.
Its value is a boolean.
Set it with (set! (text-tag:strikethrough-rgba-set self) value).
Whether the strikethrough property is set.
Its value is a boolean.
Set it with (set! (text-tag:strikethrough-set self) value).
Font style as a <PangoStyle>, e.g.
italic.
Its value is a <PangoStyle> (or, to set it,
one of its symbols).
Set it with (set! (text-tag:style self) value).
Whether the style property is set.
Its value is a boolean.
Set it with (set! (text-tag:style-set self) value).
Custom tabs for this text.
Its value is a <PangoTabArray>, or
#f.
Set it with (set! (text-tag:tabs self) value).
Whether the tabs property is set.
Its value is a boolean.
Set it with (set! (text-tag:tabs-set self) value).
How to transform the text for display.
Its value is a <PangoTextTransform>
(or, to set it, one of its symbols).
Set it with (set! (text-tag:text-transform self) value).
Whether the text-transform property is set.
Its value is a boolean.
Set it with (set! (text-tag:text-transform-set self) value).
Style of underline for this text.
Its value is a <PangoUnderline> (or, to
set it, one of its symbols).
Set it with (set! (text-tag:underline self) value).
This property modifies the color of underlines.
If not set, underlines will use the foreground color.
If text-tag:underline is set to
error, an alternate color may be applied
instead of the foreground. Setting this property will always override
those defaults.
Its value is a <GdkRGBA>, or #f.
Set it with (set! (text-tag:underline-rgba self) value).
If the underline-rgba property has been set.
Its value is a boolean.
Set it with (set! (text-tag:underline-rgba-set self) value).
Whether the underline property is set.
Its value is a boolean.
Set it with (set! (text-tag:underline-set self) value).
Font variant as a <PangoVariant>, e.g.
small-caps.
Its value is a <PangoVariant> (or, to set
it, one of its symbols).
Set it with (set! (text-tag:variant self) value).
Whether the variant property is set.
Its value is a boolean.
Set it with (set! (text-tag:variant-set self) value).
Font weight as an integer.
Its value is a 32-bit integer.
Set it with (set! (text-tag:weight self) value).
Whether the weight property is set.
Its value is a boolean.
Set it with (set! (text-tag:weight-set self) value).
Whether this tag represents a single word.
This affects line breaks and cursor movement.
Its value is a boolean.
Set it with (set! (text-tag:word self) value).
Whether the word property is set.
Its value is a boolean.
Set it with (set! (text-tag:word-set self) value).
Whether to wrap lines never, at word boundaries, or at character boundaries.
Its value is a <GtkWrapMode> (or, to set it, one
of its symbols).
Set it with (set! (text-tag:wrap-mode self) value).
Whether the wrap-mode property is set.
Its value is a boolean.
Set it with (set! (text-tag:wrap-mode-set self) value).
Emits the text-tag-table:tag-changed signal on the
<GtkTextTagTable> where the tag is included.
The signal is already emitted when setting a
<GtkTextTag> property. This function is useful
for a <GtkTextTag> subclass.
Passed: a <GtkTextTag>.
Passed: a boolean.
whether the change affects the <GtkTextView>
layout
Get the tag priority.
Passed: a <GtkTextTag>.
Returned: a 32-bit integer.
The tag’s priority.
Creates a <GtkTextTag>.
Passed, or left out: a string, or #f.
tag name
Returned: a <GtkTextTag>.
a new <GtkTextTag>
Sets the priority of a <GtkTextTag>.
Valid priorities start at 0 and go to one less than
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.TextBuffer.create_tag, which adds the tag to the buffer’s
table automatically.
Passed: a <GtkTextTag>.
Passed: a 32-bit integer.
the new priority