---
name: "wxTextAttr"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxTextAttr"
---

# wxTextAttr(3erl)

Functions for wxTextAttr class

## NAME

wxTextAttr - Functions for wxTextAttr class

## DESCRIPTION

*wxTextAttr* represents the character and paragraph attributes, or style, for a range of text in a *wxTextCtrl* or *wxRichTextCtrl* (not implemented in wx).

When setting up a *wxTextAttr* object, pass a bitlist mask to *setFlags/2* to indicate which style elements should be changed. As a convenience, when you call a setter such as SetFont, the relevant bit will be set.

See: *wxTextCtrl*, *wxRichTextCtrl* (not implemented in wx)

wxWidgets docs: wxTextAttr

## DATA TYPES

```
wxTextAttr() = wx:wx_object()
```

## EXPORTS

```
new() -> wxTextAttr()
```

Constructors.

```
new(ColText) -> wxTextAttr()
```

```
new(Attr) -> wxTextAttr()
```

Types:

Attr = wxTextAttr()\

```
new(ColText, Options :: [Option]) -> wxTextAttr()
```

Types:

ColText = wx:wx\_colour()\
 Option = \
\
     {colBack, wx:wx\_colour()} \|\
\
     {font, wxFont:wxFont()} \|\
\
     {alignment, wx:wx\_enum()}\

```
getAlignment(This) -> wx:wx_enum()
```

Types:

This = wxTextAttr()\

Returns the alignment flags.

See ?wxTextAttrAlignment for a list of available styles.

```
getBackgroundColour(This) -> wx:wx_colour4()
```

Types:

This = wxTextAttr()\

Returns the background colour.

```
getFont(This) -> wxFont:wxFont()
```

Types:

This = wxTextAttr()\

Creates and returns a font specified by the font attributes in the *wxTextAttr* object.

Note that *wxTextAttr* does not store a *wxFont* object, so this is only a temporary font.

For greater efficiency, access the font attributes directly.

```
getFontEncoding(This) -> wx:wx_enum()
```

Types:

This = wxTextAttr()\

Returns the font encoding.

```
getFontFaceName(This) -> unicode:charlist()
```

Types:

This = wxTextAttr()\

Returns the font face name.

```
getFontSize(This) -> integer()
```

Types:

This = wxTextAttr()\

Returns the font size in points.

```
getFontStyle(This) -> wx:wx_enum()
```

Types:

This = wxTextAttr()\

Returns the font style.

```
getFontUnderlined(This) -> boolean()
```

Types:

This = wxTextAttr()\

Returns true if the font is underlined.

```
getFontWeight(This) -> wx:wx_enum()
```

Types:

This = wxTextAttr()\

Returns the font weight.

```
getLeftIndent(This) -> integer()
```

Types:

This = wxTextAttr()\

Returns the left indent in tenths of a millimetre.

```
getLeftSubIndent(This) -> integer()
```

Types:

This = wxTextAttr()\

Returns the left sub-indent in tenths of a millimetre.

```
getRightIndent(This) -> integer()
```

Types:

This = wxTextAttr()\

Returns the right indent in tenths of a millimeter.

```
getTabs(This) -> [integer()]
```

Types:

This = wxTextAttr()\

Returns an array of tab stops, each expressed in tenths of a millimeter.

Each stop is measured from the left margin and therefore each value must be larger than the last.

```
getTextColour(This) -> wx:wx_colour4()
```

Types:

This = wxTextAttr()\

Returns the text foreground colour.

```
hasBackgroundColour(This) -> boolean()
```

Types:

This = wxTextAttr()\

Returns true if the attribute object specifies a background colour.

```
hasFont(This) -> boolean()
```

Types:

This = wxTextAttr()\

Returns true if the attribute object specifies any font attributes.

```
hasTextColour(This) -> boolean()
```

Types:

This = wxTextAttr()\

Returns true if the attribute object specifies a text foreground colour.

```
getFlags(This) -> integer()
```

Types:

This = wxTextAttr()\

Returns flags indicating which attributes are applicable.

See *setFlags/2* for a list of available flags.

```
isDefault(This) -> boolean()
```

Types:

This = wxTextAttr()\

Returns false if we have any attributes set, true otherwise.

```
setAlignment(This, Alignment) -> ok
```

Types:

This = wxTextAttr()\
 Alignment = wx:wx\_enum()\

Sets the paragraph alignment.

See ?wxTextAttrAlignment enumeration values.

Of these, wxTEXT\_ALIGNMENT\_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only.

```
setBackgroundColour(This, ColBack) -> ok
```

Types:

This = wxTextAttr()\
 ColBack = wx:wx\_colour()\

Sets the background colour.

```
setFlags(This, Flags) -> ok
```

Types:

This = wxTextAttr()\
 Flags = integer()\

Sets the flags determining which styles are being specified.

The ?wxTextAttrFlags values can be passed in a bitlist.

```
setFont(This, Font) -> ok
```

Types:

This = wxTextAttr()\
 Font = wxFont:wxFont()\

```
setFont(This, Font, Options :: [Option]) -> ok
```

Types:

This = wxTextAttr()\
 Font = wxFont:wxFont()\
 Option = {flags, integer()}\

Sets the attributes for the given font.

Note that *wxTextAttr* does not store an actual *wxFont* object.

```
setFontEncoding(This, Encoding) -> ok
```

Types:

This = wxTextAttr()\
 Encoding = wx:wx\_enum()\

Sets the font encoding.

```
setFontFaceName(This, FaceName) -> ok
```

Types:

This = wxTextAttr()\
 FaceName = unicode:chardata()\

Sets the font face name.

```
setFontFamily(This, Family) -> ok
```

Types:

This = wxTextAttr()\
 Family = wx:wx\_enum()\

Sets the font family.

```
setFontSize(This, PointSize) -> ok
```

Types:

This = wxTextAttr()\
 PointSize = integer()\

Sets the font size in points.

```
setFontPointSize(This, PointSize) -> ok
```

Types:

This = wxTextAttr()\
 PointSize = integer()\

Sets the font size in points.

```
setFontPixelSize(This, PixelSize) -> ok
```

Types:

This = wxTextAttr()\
 PixelSize = integer()\

Sets the font size in pixels.

```
setFontStyle(This, FontStyle) -> ok
```

Types:

This = wxTextAttr()\
 FontStyle = wx:wx\_enum()\

Sets the font style (normal, italic or slanted).

```
setFontUnderlined(This, Underlined) -> ok
```

Types:

This = wxTextAttr()\
 Underlined = boolean()\

Sets the font underlining (solid line, text colour).

```
setFontWeight(This, FontWeight) -> ok
```

Types:

This = wxTextAttr()\
 FontWeight = wx:wx\_enum()\

Sets the font weight.

```
setLeftIndent(This, Indent) -> ok
```

Types:

This = wxTextAttr()\
 Indent = integer()\

```
setLeftIndent(This, Indent, Options :: [Option]) -> ok
```

Types:

This = wxTextAttr()\
 Indent = integer()\
 Option = {subIndent, integer()}\

Sets the left indent and left subindent in tenths of a millimetre.

The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph.

A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented relative to the subsequent lines.

*wxRichTextBuffer* (not implemented in wx) uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.

```
setRightIndent(This, Indent) -> ok
```

Types:

This = wxTextAttr()\
 Indent = integer()\

Sets the right indent in tenths of a millimetre.

```
setTabs(This, Tabs) -> ok
```

Types:

This = wxTextAttr()\
 Tabs = \[integer()\]\

Sets the tab stops, expressed in tenths of a millimetre.

Each stop is measured from the left margin and therefore each value must be larger than the last.

```
setTextColour(This, ColText) -> ok
```

Types:

This = wxTextAttr()\
 ColText = wx:wx\_colour()\

Sets the text foreground colour.

```
destroy(This :: wxTextAttr()) -> ok
```

Destroys the object.
