# TextState Class

> The text state includes parameters that affect text.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class TextState
```

**Namespace:** `datalogics_interface`

## Description

The text state includes parameters that affect text.

These parameters include character and word spacing, font, font size, and horizontal scale.

**Referenced by:** [`TextRun`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextRun.md)

**Uses types:** [`TextRenderMode`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/TextRenderMode.md)

## Constructors

### TextState

```cpp
datalogics_interface::TextState::TextState()
```

*constructor*

Create a default text state.

### TextState

```cpp
datalogics_interface::TextState::TextState(const TextState &)
```

*constructor*

**Parameters**

- (unnamed) ([`const TextState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md))

Copy constructor.

### TextState

```cpp
datalogics_interface::TextState::TextState(TextState &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`TextState &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md))

### ~TextState

```cpp
datalogics_interface::TextState::~TextState()
```

*destructor*

## Methods

### get_character_spacing

```cpp
double datalogics_interface::TextState::get_character_spacing() const
```

**Returns:** `double`

The current character spacing (corresponding to the Tc operator), in unscaled text space units.

### get_font_size

```cpp
double datalogics_interface::TextState::get_font_size() const
```

**Returns:** `double`

The current font size (corresponding to the Tf operator).

### get_horizontal_scale

```cpp
double datalogics_interface::TextState::get_horizontal_scale() const
```

**Returns:** `double`

The current horizontal scaling (corresponding to the Tz operator), as a percentage of the normal glyph width. Default is 100.

### get_render_mode

```cpp
TextRenderMode datalogics_interface::TextState::get_render_mode() const
```

**Returns:** [`TextRenderMode`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/TextRenderMode.md)

The current text rendering mode (corresponding to the Tr operator).

### get_text_rise

```cpp
double datalogics_interface::TextState::get_text_rise() const
```

**Returns:** `double`

The current text rise (corresponding to the Ts operator), in unscaled text space units.

### get_word_spacing

```cpp
double datalogics_interface::TextState::get_word_spacing() const
```

**Returns:** `double`

The current word spacing (corresponding to the Tw operator), in unscaled text space units.

### operator=

```cpp
TextState & datalogics_interface::TextState::operator=(const TextState &)
```

**Parameters**

- (unnamed) ([`const TextState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md))

**Returns:** [`TextState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md)

Copy assignment.

### operator=

```cpp
TextState & datalogics_interface::TextState::operator=(TextState &&) noexcept
```

**Parameters**

- (unnamed) ([`TextState &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md))

**Returns:** [`TextState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextState.md)

### set_character_spacing

```cpp
void datalogics_interface::TextState::set_character_spacing(double spacing)
```

**Parameters**

- `spacing` (`double`): - the new/updated character spacing

**Returns:** `void`

The current character spacing (corresponding to the Tc operator), in unscaled text space units.

### set_font_size

```cpp
void datalogics_interface::TextState::set_font_size(double size)
```

**Parameters**

- `size` (`double`): - the new/updated font size

**Returns:** `void`

The current font size (corresponding to the Tf operator).

### set_horizontal_scale

```cpp
void datalogics_interface::TextState::set_horizontal_scale(double scale)
```

**Parameters**

- `scale` (`double`): - the new/updated horizontal scaling

**Returns:** `void`

The current horizontal scaling (corresponding to the Tz operator), as a percentage of the normal glyph width. Default is 100.

### set_render_mode

```cpp
void datalogics_interface::TextState::set_render_mode(TextRenderMode mode)
```

**Parameters**

- `mode` ([`TextRenderMode`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/TextRenderMode.md)): - the new/updated text rendering mode

**Returns:** `void`

The current text rendering mode (corresponding to the Tr operator).

### set_text_rise

```cpp
void datalogics_interface::TextState::set_text_rise(double rise)
```

**Parameters**

- `rise` (`double`): - the new/updated text rise

**Returns:** `void`

The current text rise (corresponding to the Ts operator), in unscaled text space units.

### set_word_spacing

```cpp
void datalogics_interface::TextState::set_word_spacing(double spacing)
```

**Parameters**

- `spacing` (`double`): - the new/updated character spacing

**Returns:** `void`

The current word spacing (corresponding to the Tw operator), in unscaled text space units.
