Gtk.TextTag¶
class — extends GObject.Object
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 TextTagTable for a given
GtkTextBuffer before using them with that buffer.
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.
Constructors¶
new¶
Creates a GtkTextTag.
Parameters:
name— tag name
Methods¶
changed¶
Emits the TextTagTable.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.
Parameters:
size_changed— whether the change affects theGtkTextViewlayout
get_priority¶
Get the tag priority.
set_priority¶
Sets the priority of a GtkTextTag.
Valid priorities start at 0 and go to one less than
TextTagTable.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 TextBuffer.create_tag,
which adds the tag to the buffer’s table automatically.
Parameters:
priority— the new priority
Properties¶
accumulative_margin¶
Whether the margins accumulate or override each other.
When set to True the margins of this tag are added to the margins
of any other non-accumulative margins present. When set to False
the margins override one another (the default).
allow_breaks¶
Whether breaks are allowed.
allow_breaks_set¶
Whether the allow-breaks property is set.
background¶
Background color as a string.
background_full_height¶
Whether the background color fills the entire line height or only the height of the tagged characters.
background_full_height_set¶
Whether the background-full-height property is set.
background_rgba¶
Background color as a GdkRGBA.
background_set¶
Whether the background property is set.
direction¶
Text direction, e.g. right-to-left or left-to-right.
editable¶
Whether the text can be modified by the user.
editable_set¶
Whether the editable property is set.
fallback¶
Whether font fallback is enabled.
When set to True, other fonts will be substituted
where the current font is missing glyphs.
fallback_set¶
Whether the fallback property is set.
family¶
Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
family_set¶
Whether the family property is set.
font¶
Font description as string, e.g. \"Sans Italic 12\".
Note that the initial value of this property depends on
the internals of PangoFontDescription.
font_desc¶
Font description as a PangoFontDescription.
font_features¶
OpenType font features, as a string.
font_features_set¶
Whether the font-features property is set.
foreground¶
Foreground color as a string.
foreground_rgba¶
Foreground color as a GdkRGBA.
foreground_set¶
Whether the foreground property is set.
indent¶
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.
indent_set¶
Whether the indent property is set.
insert_hyphens¶
Whether to insert hyphens at breaks.
insert_hyphens_set¶
Whether the insert-hyphens property is set.
invisible¶
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.
invisible_set¶
Whether the invisible property is set.
justification¶
Left, right, or center justification.
justification_set¶
Whether the justification property is set.
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.
Note that the initial value of this property depends
on the current locale, see also get_default_language.
language_set¶
Whether the language property is set.
left_margin¶
Width of the left margin in pixels.
left_margin_set¶
Whether the left-margin property is set.
letter_spacing¶
Extra spacing between graphemes, in Pango units.
letter_spacing_set¶
Whether the letter-spacing property is set.
line_height¶
Factor to scale line height by.
line_height_set¶
Whether the line-height property is set.
name¶
The name used to refer to the tag.
None for anonymous tags.
overline¶
Style of overline for this text.
overline_rgba¶
This property modifies the color of overlines.
If not set, overlines will use the foreground color.
overline_rgba_set¶
Whether the overline-rgba property is set.
overline_set¶
Whether the overline property is set.
paragraph_background¶
The paragraph background color as a string.
paragraph_background_rgba¶
The paragraph background color as a GdkRGBA.
paragraph_background_set¶
Whether the paragraph-background property is set.
pixels_above_lines¶
Pixels of blank space above paragraphs.
pixels_above_lines_set¶
Whether the pixels-above-lines property is set.
pixels_below_lines¶
Pixels of blank space below paragraphs.
pixels_below_lines_set¶
Whether the pixels-below-lines property is set.
pixels_inside_wrap¶
Pixels of blank space between wrapped lines in a paragraph.
pixels_inside_wrap_set¶
Whether the pixels-inside-wrap property is set.
right_margin¶
Width of the right margin, in pixels.
right_margin_set¶
Whether the right-margin property is set.
rise¶
Offset of text above the baseline, in Pango units.
Negative values go below the baseline.
rise_set¶
Whether the rise property is set.
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.
scale_set¶
Whether the scale property is set.
sentence¶
Whether this tag represents a single sentence.
This affects cursor movement.
sentence_set¶
Whether the sentence property is set.
show_spaces¶
How to render invisible characters.
show_spaces_set¶
Whether the show-spaces property is set.
size¶
Font size in Pango units.
size_points¶
Font size in points.
size_set¶
Whether the size property is set.
stretch¶
Font stretch as a PangoStretch, e.g. Pango.Stretch.CONDENSED.
stretch_set¶
Whether the stretch property is set.
strikethrough¶
Whether to strike through the text.
strikethrough_rgba¶
This property modifies the color of strikeouts.
If not set, strikeouts will use the foreground color.
strikethrough_rgba_set¶
If the strikethrough-rgba property has been set.
strikethrough_set¶
Whether the strikethrough property is set.
style¶
Font style as a PangoStyle, e.g. Pango.Style.ITALIC.
style_set¶
Whether the style property is set.
tabs¶
Custom tabs for this text.
tabs_set¶
Whether the tabs property is set.
text_transform¶
How to transform the text for display.
text_transform_set¶
Whether the text-transform property is set.
underline¶
Style of underline for this text.
underline_rgba¶
This property modifies the color of underlines.
If not set, underlines will use the foreground color.
If TextTag.underline is set to Pango.Underline.ERROR,
an alternate color may be applied instead of the foreground. Setting
this property will always override those defaults.
underline_rgba_set¶
If the underline-rgba property has been set.
underline_set¶
Whether the underline property is set.
variant¶
Font variant as a PangoVariant, e.g. Pango.Variant.SMALL_CAPS.
variant_set¶
Whether the variant property is set.
weight¶
Font weight as an integer.
weight_set¶
Whether the weight property is set.
word¶
Whether this tag represents a single word.
This affects line breaks and cursor movement.
word_set¶
Whether the word property is set.
wrap_mode¶
Whether to wrap lines never, at word boundaries, or at character boundaries.
wrap_mode_set¶
Whether the wrap-mode property is set.