gtk.text_tag

Module for [TextTag] class

Types 3

A tag that can be applied to text contained in a [gtk.text_buffer.TextBuffer].

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.TextTagTable] for a given [gtk.text_buffer.TextBuffer] before using them with that buffer.

[gtk.text_buffer.TextBuffer.createTag] is the best way to create tags. See “gtk4-demo” for numerous examples.

For each property of [gtk.text_tag.TextTag], 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.

Methods
GType _gType() @property
TextTag self()Returns `this`, for use in `with` statements.
TextTagGidBuilder builder()Get builder for [gtk.text_tag.TextTag] Returns: New builder object
bool accumulativeMargin() @propertyGet `accumulativeMargin` property. Returns: Whether the margins accumulate or override each other.
void accumulativeMargin(bool propval) @propertySet `accumulativeMargin` property. Params: propval = Whether the margins accumulate or override each other.
bool allowBreaks() @propertyGet `allowBreaks` property. Returns: Whether breaks are allowed.
void allowBreaks(bool propval) @propertySet `allowBreaks` property. Params: propval = Whether breaks are allowed.
bool allowBreaksSet() @property
void allowBreaksSet(bool propval) @property
void background(string propval) @propertySet `background` property. Params: propval = Background color as a string.
bool backgroundFullHeight() @propertyGet `backgroundFullHeight` property. Returns: Whether the background color fills the entire line height or only the height of the tagged characters.
void backgroundFullHeight(bool propval) @propertySet `backgroundFullHeight` property. Params: propval = Whether the background color fills the entire line height or only the height of the tagged characters.
bool backgroundFullHeightSet() @property
void backgroundFullHeightSet(bool propval) @property
gdk.rgba.RGBA backgroundRgba() @propertyGet `backgroundRgba` property. Returns: Background color as a [gdk.rgba.RGBA].
void backgroundRgba(gdk.rgba.RGBA propval) @propertySet `backgroundRgba` property. Params: propval = Background color as a [gdk.rgba.RGBA].
bool backgroundSet() @property
void backgroundSet(bool propval) @property
gtk.types.TextDirection direction() @propertyGet `direction` property. Returns: Text direction, e.g. right-to-left or left-to-right.
void direction(gtk.types.TextDirection propval) @propertySet `direction` property. Params: propval = Text direction, e.g. right-to-left or left-to-right.
bool editable() @propertyGet `editable` property. Returns: Whether the text can be modified by the user.
void editable(bool propval) @propertySet `editable` property. Params: propval = Whether the text can be modified by the user.
bool editableSet() @property
void editableSet(bool propval) @property
bool fallback() @propertyGet `fallback` property. Returns: Whether font fallback is enabled.
void fallback(bool propval) @propertySet `fallback` property. Params: propval = Whether font fallback is enabled.
bool fallbackSet() @property
void fallbackSet(bool propval) @property
string family() @propertyGet `family` property. Returns: Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
void family(string propval) @propertySet `family` property. Params: propval = Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
bool familySet() @property
void familySet(bool propval) @property
string font() @propertyGet `font` property. Returns: Font description as string, e.g. \"Sans Italic 12\".
void font(string propval) @propertySet `font` property. Params: propval = Font description as string, e.g. \"Sans Italic 12\".
pango.font_description.FontDescription fontDesc() @propertyGet `fontDesc` property. Returns: Font description as a [pango.font_description.FontDescription].
void fontDesc(pango.font_description.FontDescription propval) @propertySet `fontDesc` property. Params: propval = Font description as a [pango.font_description.FontDescription].
string fontFeatures() @propertyGet `fontFeatures` property. Returns: OpenType font features, as a string.
void fontFeatures(string propval) @propertySet `fontFeatures` property. Params: propval = OpenType font features, as a string.
bool fontFeaturesSet() @property
void fontFeaturesSet(bool propval) @property
void foreground(string propval) @propertySet `foreground` property. Params: propval = Foreground color as a string.
gdk.rgba.RGBA foregroundRgba() @propertyGet `foregroundRgba` property. Returns: Foreground color as a [gdk.rgba.RGBA].
void foregroundRgba(gdk.rgba.RGBA propval) @propertySet `foregroundRgba` property. Params: propval = Foreground color as a [gdk.rgba.RGBA].
bool foregroundSet() @property
void foregroundSet(bool propval) @property
int indent() @propertyGet `indent` property. Returns: Amount to indent the paragraph, in pixels.
void indent(int propval) @propertySet `indent` property. Params: propval = Amount to indent the paragraph, in pixels.
bool indentSet() @property
void indentSet(bool propval) @property
bool insertHyphens() @propertyGet `insertHyphens` property. Returns: Whether to insert hyphens at breaks.
void insertHyphens(bool propval) @propertySet `insertHyphens` property. Params: propval = Whether to insert hyphens at breaks.
bool insertHyphensSet() @property
void insertHyphensSet(bool propval) @property
bool invisible() @propertyGet `invisible` property. Returns: Whether this text is hidden.
void invisible(bool propval) @propertySet `invisible` property. Params: propval = Whether this text is hidden.
bool invisibleSet() @property
void invisibleSet(bool propval) @property
gtk.types.Justification justification() @propertyGet `justification` property. Returns: Left, right, or center justification.
void justification(gtk.types.Justification propval) @propertySet `justification` property. Params: propval = Left, right, or center justification.
bool justificationSet() @property
void justificationSet(bool propval) @property
string language() @propertyGet `language` property. Returns: The language this text is in, as an ISO code.
void language(string propval) @propertySet `language` property. Params: propval = The language this text is in, as an ISO code.
bool languageSet() @property
void languageSet(bool propval) @property
int leftMargin() @propertyGet `leftMargin` property. Returns: Width of the left margin in pixels.
void leftMargin(int propval) @propertySet `leftMargin` property. Params: propval = Width of the left margin in pixels.
bool leftMarginSet() @property
void leftMarginSet(bool propval) @property
int letterSpacing() @propertyGet `letterSpacing` property. Returns: Extra spacing between graphemes, in Pango units.
void letterSpacing(int propval) @propertySet `letterSpacing` property. Params: propval = Extra spacing between graphemes, in Pango units.
bool letterSpacingSet() @property
void letterSpacingSet(bool propval) @property
float lineHeight() @propertyGet `lineHeight` property. Returns: Factor to scale line height by.
void lineHeight(float propval) @propertySet `lineHeight` property. Params: propval = Factor to scale line height by.
bool lineHeightSet() @property
void lineHeightSet(bool propval) @property
string name() @propertyGet `name` property. Returns: The name used to refer to the tag.
pango.types.Overline overline() @propertyGet `overline` property. Returns: Style of overline for this text.
void overline(pango.types.Overline propval) @propertySet `overline` property. Params: propval = Style of overline for this text.
gdk.rgba.RGBA overlineRgba() @propertyGet `overlineRgba` property. Returns: This property modifies the color of overlines.
void overlineRgba(gdk.rgba.RGBA propval) @propertySet `overlineRgba` property. Params: propval = This property modifies the color of overlines.
bool overlineRgbaSet() @property
void overlineRgbaSet(bool propval) @property
bool overlineSet() @property
void overlineSet(bool propval) @property
void paragraphBackground(string propval) @propertySet `paragraphBackground` property. Params: propval = The paragraph background color as a string.
gdk.rgba.RGBA paragraphBackgroundRgba() @propertyGet `paragraphBackgroundRgba` property. Returns: The paragraph background color as a [gdk.rgba.RGBA].
void paragraphBackgroundRgba(gdk.rgba.RGBA propval) @propertySet `paragraphBackgroundRgba` property. Params: propval = The paragraph background color as a [gdk.rgba.RGBA].
bool paragraphBackgroundSet() @property
void paragraphBackgroundSet(bool propval) @property
int pixelsAboveLines() @propertyGet `pixelsAboveLines` property. Returns: Pixels of blank space above paragraphs.
void pixelsAboveLines(int propval) @propertySet `pixelsAboveLines` property. Params: propval = Pixels of blank space above paragraphs.
bool pixelsAboveLinesSet() @property
void pixelsAboveLinesSet(bool propval) @property
int pixelsBelowLines() @propertyGet `pixelsBelowLines` property. Returns: Pixels of blank space below paragraphs.
void pixelsBelowLines(int propval) @propertySet `pixelsBelowLines` property. Params: propval = Pixels of blank space below paragraphs.
bool pixelsBelowLinesSet() @property
void pixelsBelowLinesSet(bool propval) @property
int pixelsInsideWrap() @propertyGet `pixelsInsideWrap` property. Returns: Pixels of blank space between wrapped lines in a paragraph.
void pixelsInsideWrap(int propval) @propertySet `pixelsInsideWrap` property. Params: propval = Pixels of blank space between wrapped lines in a paragraph.
bool pixelsInsideWrapSet() @property
void pixelsInsideWrapSet(bool propval) @property
int rightMargin() @propertyGet `rightMargin` property. Returns: Width of the right margin, in pixels.
void rightMargin(int propval) @propertySet `rightMargin` property. Params: propval = Width of the right margin, in pixels.
bool rightMarginSet() @property
void rightMarginSet(bool propval) @property
int rise() @propertyGet `rise` property. Returns: Offset of text above the baseline, in Pango units.
void rise(int propval) @propertySet `rise` property. Params: propval = Offset of text above the baseline, in Pango units.
bool riseSet() @property
void riseSet(bool propval) @property
double scale() @propertyGet `scale` property. Returns: Font size as a scale factor relative to the default font size.
void scale(double propval) @propertySet `scale` property. Params: propval = Font size as a scale factor relative to the default font size.
bool scaleSet() @property
void scaleSet(bool propval) @property
bool sentence() @propertyGet `sentence` property. Returns: Whether this tag represents a single sentence.
void sentence(bool propval) @propertySet `sentence` property. Params: propval = Whether this tag represents a single sentence.
bool sentenceSet() @property
void sentenceSet(bool propval) @property
pango.types.ShowFlags showSpaces() @propertyGet `showSpaces` property. Returns: How to render invisible characters.
void showSpaces(pango.types.ShowFlags propval) @propertySet `showSpaces` property. Params: propval = How to render invisible characters.
bool showSpacesSet() @property
void showSpacesSet(bool propval) @property
int size() @propertyGet `size` property. Returns: Font size in Pango units.
void size(int propval) @propertySet `size` property. Params: propval = Font size in Pango units.
double sizePoints() @propertyGet `sizePoints` property. Returns: Font size in points.
void sizePoints(double propval) @propertySet `sizePoints` property. Params: propval = Font size in points.
bool sizeSet() @property
void sizeSet(bool propval) @property
pango.types.Stretch stretch() @propertyGet `stretch` property. Returns: Font stretch as a [pango.types.Stretch], e.g. [pango.types.Stretch.Condensed].
void stretch(pango.types.Stretch propval) @propertySet `stretch` property. Params: propval = Font stretch as a [pango.types.Stretch], e.g. [pango.types.Stretch.Condensed].
bool stretchSet() @property
void stretchSet(bool propval) @property
bool strikethrough() @propertyGet `strikethrough` property. Returns: Whether to strike through the text.
void strikethrough(bool propval) @propertySet `strikethrough` property. Params: propval = Whether to strike through the text.
gdk.rgba.RGBA strikethroughRgba() @propertyGet `strikethroughRgba` property. Returns: This property modifies the color of strikeouts.
void strikethroughRgba(gdk.rgba.RGBA propval) @propertySet `strikethroughRgba` property. Params: propval = This property modifies the color of strikeouts.
bool strikethroughRgbaSet() @propertyGet `strikethroughRgbaSet` property. Returns: If the `strikethrough-rgba` property has been set.
void strikethroughRgbaSet(bool propval) @propertySet `strikethroughRgbaSet` property. Params: propval = If the `strikethrough-rgba` property has been set.
bool strikethroughSet() @property
void strikethroughSet(bool propval) @property
pango.types.Style style() @propertyGet `style` property. Returns: Font style as a [pango.types.Style], e.g. [pango.types.Style.Italic].
void style(pango.types.Style propval) @propertySet `style` property. Params: propval = Font style as a [pango.types.Style], e.g. [pango.types.Style.Italic].
bool styleSet() @property
void styleSet(bool propval) @property
pango.tab_array.TabArray tabs() @propertyGet `tabs` property. Returns: Custom tabs for this text.
void tabs(pango.tab_array.TabArray propval) @propertySet `tabs` property. Params: propval = Custom tabs for this text.
bool tabsSet() @property
void tabsSet(bool propval) @property
pango.types.TextTransform textTransform() @propertyGet `textTransform` property. Returns: How to transform the text for display.
void textTransform(pango.types.TextTransform propval) @propertySet `textTransform` property. Params: propval = How to transform the text for display.
bool textTransformSet() @property
void textTransformSet(bool propval) @property
pango.types.Underline underline() @propertyGet `underline` property. Returns: Style of underline for this text.
void underline(pango.types.Underline propval) @propertySet `underline` property. Params: propval = Style of underline for this text.
gdk.rgba.RGBA underlineRgba() @propertyGet `underlineRgba` property. Returns: This property modifies the color of underlines.
void underlineRgba(gdk.rgba.RGBA propval) @propertySet `underlineRgba` property. Params: propval = This property modifies the color of underlines.
bool underlineRgbaSet() @propertyGet `underlineRgbaSet` property. Returns: If the `underline-rgba` property has been set.
void underlineRgbaSet(bool propval) @propertySet `underlineRgbaSet` property. Params: propval = If the `underline-rgba` property has been set.
bool underlineSet() @property
void underlineSet(bool propval) @property
pango.types.Variant variant() @propertyGet `variant` property. Returns: Font variant as a [pango.types.Variant], e.g. [pango.types.Variant.SmallCaps].
void variant(pango.types.Variant propval) @propertySet `variant` property. Params: propval = Font variant as a [pango.types.Variant], e.g. [pango.types.Variant.SmallCaps].
bool variantSet() @property
void variantSet(bool propval) @property
int weight() @propertyGet `weight` property. Returns: Font weight as an integer.
void weight(int propval) @propertySet `weight` property. Params: propval = Font weight as an integer.
bool weightSet() @property
void weightSet(bool propval) @property
bool word() @propertyGet `word` property. Returns: Whether this tag represents a single word.
void word(bool propval) @propertySet `word` property. Params: propval = Whether this tag represents a single word.
bool wordSet() @property
void wordSet(bool propval) @property
gtk.types.WrapMode wrapMode() @propertyGet `wrapMode` property. Returns: Whether to wrap lines never, at word boundaries, or at character boundaries.
void wrapMode(gtk.types.WrapMode propval) @propertySet `wrapMode` property. Params: propval = Whether to wrap lines never, at word boundaries, or at character boundaries.
bool wrapModeSet() @property
void wrapModeSet(bool propval) @property
void changed(bool sizeChanged)Emits the `signalGtk.TextTagTable::tag-changed` signal on the [gtk.texttagtable.TextTagTable] where the tag is included.
int getPriority()Get the tag priority. Returns: The tag’s priority.
void setPriority(int priority)Sets the priority of a [gtk.text_tag.TextTag].
Constructors
this(void * ptr, Flag!"Take" take)
this(string name = null)Creates a [gtk.text_tag.TextTag].
Methods
T accumulativeMargin(bool propval)Set `accumulativeMargin` property. Params: propval = Whether the margins accumulate or override each other.
T allowBreaks(bool propval)Set `allowBreaks` property. Params: propval = Whether breaks are allowed. Returns: Builder instance for fluent chaining
T allowBreaksSet(bool propval)
T background(string propval)Set `background` property. Params: propval = Background color as a string. Returns: Builder instance for fluent chaining
T backgroundFullHeight(bool propval)Set `backgroundFullHeight` property. Params: propval = Whether the background color fills the entire line height or only the height of the tagged characters. Returns: Builder instance for fluent ch...
T backgroundFullHeightSet(bool propval)
T backgroundRgba(gdk.rgba.RGBA propval)Set `backgroundRgba` property. Params: propval = Background color as a [gdk.rgba.RGBA]. Returns: Builder instance for fluent chaining
T backgroundSet(bool propval)
T direction(gtk.types.TextDirection propval)Set `direction` property. Params: propval = Text direction, e.g. right-to-left or left-to-right. Returns: Builder instance for fluent chaining
T editable(bool propval)Set `editable` property. Params: propval = Whether the text can be modified by the user. Returns: Builder instance for fluent chaining
T editableSet(bool propval)
T fallback(bool propval)Set `fallback` property. Params: propval = Whether font fallback is enabled.
T fallbackSet(bool propval)
T family(string propval)Set `family` property. Params: propval = Name of the font family, e.g. Sans, Helvetica, Times, Monospace. Returns: Builder instance for fluent chaining
T familySet(bool propval)
T font(string propval)Set `font` property. Params: propval = Font description as string, e.g. \"Sans Italic 12\".
T fontDesc(pango.font_description.FontDescription propval)Set `fontDesc` property. Params: propval = Font description as a [pango.font_description.FontDescription]. Returns: Builder instance for fluent chaining
T fontFeatures(string propval)Set `fontFeatures` property. Params: propval = OpenType font features, as a string. Returns: Builder instance for fluent chaining
T fontFeaturesSet(bool propval)
T foreground(string propval)Set `foreground` property. Params: propval = Foreground color as a string. Returns: Builder instance for fluent chaining
T foregroundRgba(gdk.rgba.RGBA propval)Set `foregroundRgba` property. Params: propval = Foreground color as a [gdk.rgba.RGBA]. Returns: Builder instance for fluent chaining
T foregroundSet(bool propval)
T indent(int propval)Set `indent` property. Params: propval = Amount to indent the paragraph, in pixels.
T indentSet(bool propval)
T insertHyphens(bool propval)Set `insertHyphens` property. Params: propval = Whether to insert hyphens at breaks. Returns: Builder instance for fluent chaining
T insertHyphensSet(bool propval)
T invisible(bool propval)Set `invisible` property. Params: propval = Whether this text is hidden.
T invisibleSet(bool propval)
T justification(gtk.types.Justification propval)Set `justification` property. Params: propval = Left, right, or center justification. Returns: Builder instance for fluent chaining
T justificationSet(bool propval)
T language(string propval)Set `language` property. Params: propval = The language this text is in, as an ISO code.
T languageSet(bool propval)
T leftMargin(int propval)Set `leftMargin` property. Params: propval = Width of the left margin in pixels. Returns: Builder instance for fluent chaining
T leftMarginSet(bool propval)
T letterSpacing(int propval)Set `letterSpacing` property. Params: propval = Extra spacing between graphemes, in Pango units. Returns: Builder instance for fluent chaining
T letterSpacingSet(bool propval)
T lineHeight(float propval)Set `lineHeight` property. Params: propval = Factor to scale line height by. Returns: Builder instance for fluent chaining
T lineHeightSet(bool propval)
T name(string propval)Set `name` property. Params: propval = The name used to refer to the tag.
T overline(pango.types.Overline propval)Set `overline` property. Params: propval = Style of overline for this text. Returns: Builder instance for fluent chaining
T overlineRgba(gdk.rgba.RGBA propval)Set `overlineRgba` property. Params: propval = This property modifies the color of overlines.
T overlineRgbaSet(bool propval)
T overlineSet(bool propval)
T paragraphBackground(string propval)Set `paragraphBackground` property. Params: propval = The paragraph background color as a string. Returns: Builder instance for fluent chaining
T paragraphBackgroundRgba(gdk.rgba.RGBA propval)Set `paragraphBackgroundRgba` property. Params: propval = The paragraph background color as a [gdk.rgba.RGBA]. Returns: Builder instance for fluent chaining
T paragraphBackgroundSet(bool propval)
T pixelsAboveLines(int propval)Set `pixelsAboveLines` property. Params: propval = Pixels of blank space above paragraphs. Returns: Builder instance for fluent chaining
T pixelsAboveLinesSet(bool propval)
T pixelsBelowLines(int propval)Set `pixelsBelowLines` property. Params: propval = Pixels of blank space below paragraphs. Returns: Builder instance for fluent chaining
T pixelsBelowLinesSet(bool propval)
T pixelsInsideWrap(int propval)Set `pixelsInsideWrap` property. Params: propval = Pixels of blank space between wrapped lines in a paragraph. Returns: Builder instance for fluent chaining
T pixelsInsideWrapSet(bool propval)
T rightMargin(int propval)Set `rightMargin` property. Params: propval = Width of the right margin, in pixels. Returns: Builder instance for fluent chaining
T rightMarginSet(bool propval)
T rise(int propval)Set `rise` property. Params: propval = Offset of text above the baseline, in Pango units.
T riseSet(bool propval)
T scale(double propval)Set `scale` property. Params: propval = Font size as a scale factor relative to the default font size.
T scaleSet(bool propval)
T sentence(bool propval)Set `sentence` property. Params: propval = Whether this tag represents a single sentence.
T sentenceSet(bool propval)
T showSpaces(pango.types.ShowFlags propval)Set `showSpaces` property. Params: propval = How to render invisible characters. Returns: Builder instance for fluent chaining
T showSpacesSet(bool propval)
T size(int propval)Set `size` property. Params: propval = Font size in Pango units. Returns: Builder instance for fluent chaining
T sizePoints(double propval)Set `sizePoints` property. Params: propval = Font size in points. Returns: Builder instance for fluent chaining
T sizeSet(bool propval)
T stretch(pango.types.Stretch propval)Set `stretch` property. Params: propval = Font stretch as a [pango.types.Stretch], e.g. [pango.types.Stretch.Condensed]. Returns: Builder instance for fluent chaining
T stretchSet(bool propval)
T strikethrough(bool propval)Set `strikethrough` property. Params: propval = Whether to strike through the text. Returns: Builder instance for fluent chaining
T strikethroughRgba(gdk.rgba.RGBA propval)Set `strikethroughRgba` property. Params: propval = This property modifies the color of strikeouts.
T strikethroughRgbaSet(bool propval)Set `strikethroughRgbaSet` property. Params: propval = If the `strikethrough-rgba` property has been set. Returns: Builder instance for fluent chaining
T strikethroughSet(bool propval)
T style(pango.types.Style propval)Set `style` property. Params: propval = Font style as a [pango.types.Style], e.g. [pango.types.Style.Italic]. Returns: Builder instance for fluent chaining
T styleSet(bool propval)
T tabs(pango.tab_array.TabArray propval)Set `tabs` property. Params: propval = Custom tabs for this text. Returns: Builder instance for fluent chaining
T tabsSet(bool propval)
T textTransform(pango.types.TextTransform propval)Set `textTransform` property. Params: propval = How to transform the text for display. Returns: Builder instance for fluent chaining
T textTransformSet(bool propval)
T underline(pango.types.Underline propval)Set `underline` property. Params: propval = Style of underline for this text. Returns: Builder instance for fluent chaining
T underlineRgba(gdk.rgba.RGBA propval)Set `underlineRgba` property. Params: propval = This property modifies the color of underlines.
T underlineRgbaSet(bool propval)Set `underlineRgbaSet` property. Params: propval = If the `underline-rgba` property has been set. Returns: Builder instance for fluent chaining
T underlineSet(bool propval)
T variant(pango.types.Variant propval)Set `variant` property. Params: propval = Font variant as a [pango.types.Variant], e.g. [pango.types.Variant.SmallCaps]. Returns: Builder instance for fluent chaining
T variantSet(bool propval)
T weight(int propval)Set `weight` property. Params: propval = Font weight as an integer. Returns: Builder instance for fluent chaining
T weightSet(bool propval)
T word(bool propval)Set `word` property. Params: propval = Whether this tag represents a single word.
T wordSet(bool propval)
T wrapMode(gtk.types.WrapMode propval)Set `wrapMode` property. Params: propval = Whether to wrap lines never, at word boundaries, or at character boundaries. Returns: Builder instance for fluent chaining
T wrapModeSet(bool propval)

Fluent builder for [gtk.text_tag.TextTag]

Methods