1.201 <GtkTextTag>

Class: <GtkTextTag>

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.

Fields

parent-instance
priv

Properties

Property: text-tag:accumulative-margin self

Whether 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).

Property: text-tag:allow-breaks self

Whether breaks are allowed.

Its value is a boolean.

Set it with (set! (text-tag:allow-breaks self) value).

Property: text-tag:allow-breaks-set self

Whether the allow-breaks property is set.

Its value is a boolean.

Set it with (set! (text-tag:allow-breaks-set self) value).

Property: text-tag:background self

Background color as a string.

Its value is a string, or #f.

It can only be set, with (set! (text-tag:background self) value).

Property: text-tag:background-full-height self

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).

Property: text-tag:background-full-height-set self

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).

Property: text-tag:background-rgba self

Background color as a <GdkRGBA>.

Its value is a <GdkRGBA>, or #f.

Set it with (set! (text-tag:background-rgba self) value).

Property: text-tag:background-set self

Whether the background property is set.

Its value is a boolean.

Set it with (set! (text-tag:background-set self) value).

Property: text-tag:direction self

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).

Property: text-tag:editable self

Whether the text can be modified by the user.

Its value is a boolean.

Set it with (set! (text-tag:editable self) value).

Property: text-tag:editable-set self

Whether the editable property is set.

Its value is a boolean.

Set it with (set! (text-tag:editable-set self) value).

Property: text-tag:fallback self

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).

Property: text-tag:fallback-set self

Whether the fallback property is set.

Its value is a boolean.

Set it with (set! (text-tag:fallback-set self) value).

Property: text-tag:family self

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).

Property: text-tag:family-set self

Whether the family property is set.

Its value is a boolean.

Set it with (set! (text-tag:family-set self) value).

Property: text-tag:font self

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).

Property: text-tag:font-desc self

Font description as a <PangoFontDescription>.

Its value is a <PangoFontDescription>, or #f.

Set it with (set! (text-tag:font-desc self) value).

Property: text-tag:font-features self

OpenType font features, as a string.

Its value is a string, or #f.

Set it with (set! (text-tag:font-features self) value).

Property: text-tag:font-features-set self

Whether the font-features property is set.

Its value is a boolean.

Set it with (set! (text-tag:font-features-set self) value).

Property: text-tag:foreground self

Foreground color as a string.

Its value is a string, or #f.

It can only be set, with (set! (text-tag:foreground self) value).

Property: text-tag:foreground-rgba self

Foreground color as a <GdkRGBA>.

Its value is a <GdkRGBA>, or #f.

Set it with (set! (text-tag:foreground-rgba self) value).

Property: text-tag:foreground-set self

Whether the foreground property is set.

Its value is a boolean.

Set it with (set! (text-tag:foreground-set self) value).

Property: text-tag:indent self

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).

Property: text-tag:indent-set self

Whether the indent property is set.

Its value is a boolean.

Set it with (set! (text-tag:indent-set self) value).

Property: text-tag:insert-hyphens self

Whether to insert hyphens at breaks.

Its value is a boolean.

Set it with (set! (text-tag:insert-hyphens self) value).

Property: text-tag:insert-hyphens-set self

Whether the insert-hyphens property is set.

Its value is a boolean.

Set it with (set! (text-tag:insert-hyphens-set self) value).

Property: text-tag:invisible self

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).

Property: text-tag:invisible-set self

Whether the invisible property is set.

Its value is a boolean.

Set it with (set! (text-tag:invisible-set self) value).

Property: text-tag:justification self

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).

Property: text-tag:justification-set self

Whether the justification property is set.

Its value is a boolean.

Set it with (set! (text-tag:justification-set self) value).

Property: text-tag:language self

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).

Property: text-tag:language-set self

Whether the language property is set.

Its value is a boolean.

Set it with (set! (text-tag:language-set self) value).

Property: text-tag:left-margin self

Width of the left margin in pixels.

Its value is a 32-bit integer.

Set it with (set! (text-tag:left-margin self) value).

Property: text-tag:left-margin-set self

Whether the left-margin property is set.

Its value is a boolean.

Set it with (set! (text-tag:left-margin-set self) value).

Property: text-tag:letter-spacing self

Extra spacing between graphemes, in Pango units.

Its value is a 32-bit integer.

Set it with (set! (text-tag:letter-spacing self) value).

Property: text-tag:letter-spacing-set self

Whether the letter-spacing property is set.

Its value is a boolean.

Set it with (set! (text-tag:letter-spacing-set self) value).

Property: text-tag:line-height self

Factor to scale line height by.

Its value is a real number.

Set it with (set! (text-tag:line-height self) value).

Property: text-tag:line-height-set self

Whether the line-height property is set.

Its value is a boolean.

Set it with (set! (text-tag:line-height-set self) value).

Property: text-tag:name self

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.

Property: text-tag:overline self

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).

Property: text-tag:overline-rgba self

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).

Property: text-tag:overline-rgba-set self

Whether the overline-rgba property is set.

Its value is a boolean.

Set it with (set! (text-tag:overline-rgba-set self) value).

Property: text-tag:overline-set self

Whether the overline property is set.

Its value is a boolean.

Set it with (set! (text-tag:overline-set self) value).

Property: text-tag:paragraph-background self

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).

Property: text-tag:paragraph-background-rgba self

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).

Property: text-tag:paragraph-background-set self

Whether the paragraph-background property is set.

Its value is a boolean.

Set it with (set! (text-tag:paragraph-background-set self) value).

Property: text-tag:pixels-above-lines self

Pixels of blank space above paragraphs.

Its value is a 32-bit integer.

Set it with (set! (text-tag:pixels-above-lines self) value).

Property: text-tag:pixels-above-lines-set self

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).

Property: text-tag:pixels-below-lines self

Pixels of blank space below paragraphs.

Its value is a 32-bit integer.

Set it with (set! (text-tag:pixels-below-lines self) value).

Property: text-tag:pixels-below-lines-set self

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).

Property: text-tag:pixels-inside-wrap self

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).

Property: text-tag:pixels-inside-wrap-set self

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).

Property: text-tag:right-margin self

Width of the right margin, in pixels.

Its value is a 32-bit integer.

Set it with (set! (text-tag:right-margin self) value).

Property: text-tag:right-margin-set self

Whether the right-margin property is set.

Its value is a boolean.

Set it with (set! (text-tag:right-margin-set self) value).

Property: text-tag:rise self

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).

Property: text-tag:rise-set self

Whether the rise property is set.

Its value is a boolean.

Set it with (set! (text-tag:rise-set self) value).

Property: text-tag:scale self

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).

Property: text-tag:scale-set self

Whether the scale property is set.

Its value is a boolean.

Set it with (set! (text-tag:scale-set self) value).

Property: text-tag:sentence self

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).

Property: text-tag:sentence-set self

Whether the sentence property is set.

Its value is a boolean.

Set it with (set! (text-tag:sentence-set self) value).

Property: text-tag:show-spaces self

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).

Property: text-tag:show-spaces-set self

Whether the show-spaces property is set.

Its value is a boolean.

Set it with (set! (text-tag:show-spaces-set self) value).

Property: text-tag:size self

Font size in Pango units.

Its value is a 32-bit integer.

Set it with (set! (text-tag:size self) value).

Property: text-tag:size-points self

Font size in points.

Its value is a real number.

Set it with (set! (text-tag:size-points self) value).

Property: text-tag:size-set self

Whether the size property is set.

Its value is a boolean.

Set it with (set! (text-tag:size-set self) value).

Property: text-tag:stretch self

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).

Property: text-tag:stretch-set self

Whether the stretch property is set.

Its value is a boolean.

Set it with (set! (text-tag:stretch-set self) value).

Property: text-tag:strikethrough self

Whether to strike through the text.

Its value is a boolean.

Set it with (set! (text-tag:strikethrough self) value).

Property: text-tag:strikethrough-rgba self

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).

Property: text-tag:strikethrough-rgba-set self

If the strikethrough-rgba property has been set.

Its value is a boolean.

Set it with (set! (text-tag:strikethrough-rgba-set self) value).

Property: text-tag:strikethrough-set self

Whether the strikethrough property is set.

Its value is a boolean.

Set it with (set! (text-tag:strikethrough-set self) value).

Property: text-tag:style self

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).

Property: text-tag:style-set self

Whether the style property is set.

Its value is a boolean.

Set it with (set! (text-tag:style-set self) value).

Property: text-tag:tabs self

Custom tabs for this text.

Its value is a <PangoTabArray>, or #f.

Set it with (set! (text-tag:tabs self) value).

Property: text-tag:tabs-set self

Whether the tabs property is set.

Its value is a boolean.

Set it with (set! (text-tag:tabs-set self) value).

Property: text-tag:text-transform self

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).

Property: text-tag:text-transform-set self

Whether the text-transform property is set.

Its value is a boolean.

Set it with (set! (text-tag:text-transform-set self) value).

Property: text-tag:underline self

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).

Property: text-tag:underline-rgba self

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).

Property: text-tag:underline-rgba-set self

If the underline-rgba property has been set.

Its value is a boolean.

Set it with (set! (text-tag:underline-rgba-set self) value).

Property: text-tag:underline-set self

Whether the underline property is set.

Its value is a boolean.

Set it with (set! (text-tag:underline-set self) value).

Property: text-tag:variant self

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).

Property: text-tag:variant-set self

Whether the variant property is set.

Its value is a boolean.

Set it with (set! (text-tag:variant-set self) value).

Property: text-tag:weight self

Font weight as an integer.

Its value is a 32-bit integer.

Set it with (set! (text-tag:weight self) value).

Property: text-tag:weight-set self

Whether the weight property is set.

Its value is a boolean.

Set it with (set! (text-tag:weight-set self) value).

Property: text-tag:word self

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).

Property: text-tag:word-set self

Whether the word property is set.

Its value is a boolean.

Set it with (set! (text-tag:word-set self) value).

Property: text-tag:wrap-mode self

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).

Property: text-tag:wrap-mode-set self

Whether the wrap-mode property is set.

Its value is a boolean.

Set it with (set! (text-tag:wrap-mode-set self) value).

Procedures

Method: text-tag:changed self size-changed
Method: changed self size-changed

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.

self

Passed: a <GtkTextTag>.

a <GtkTextTag>

size-changed

Passed: a boolean.

whether the change affects the <GtkTextView> layout

Method: text-tag:get-priority self ⇒ %return
Method: get-priority self ⇒ %return

Get the tag priority.

self

Passed: a <GtkTextTag>.

a <GtkTextTag>

%return

Returned: a 32-bit integer.

The tag’s priority.

Procedure: text-tag:new [name] ⇒ %return

Creates a <GtkTextTag>.

name

Passed, or left out: a string, or #f.

tag name

%return

Returned: a <GtkTextTag>.

a new <GtkTextTag>

Method: text-tag:set-priority self priority
Method: set-priority self priority

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.

self

Passed: a <GtkTextTag>.

a <GtkTextTag>

priority

Passed: a 32-bit integer.

the new priority