# TextLine

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/text_formatting/trait-textline/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait TextLine: 'static
```

Represents a line of text that is used for text rendering.

All character indices and lengths are UTF-16 code units in text source
coordinates.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L15)

## Members

- [`text_runs`](#function-text_runs)
- [`first_text_source_index`](#function-first_text_source_index)
- [`length`](#function-length)
- [`text_line_break`](#function-text_line_break)
- [`baseline`](#function-baseline)
- [`extent`](#function-extent)
- [`has_collapsed`](#function-has_collapsed)
- [`has_overflowed`](#function-has_overflowed)
- [`height`](#function-height)
- [`new_line_length`](#function-new_line_length)
- [`overhang_after`](#function-overhang_after)
- [`overhang_leading`](#function-overhang_leading)
- [`overhang_trailing`](#function-overhang_trailing)
- [`start`](#function-start)
- [`trailing_whitespace_length`](#function-trailing_whitespace_length)
- [`width`](#function-width)
- [`width_including_trailing_whitespace`](#function-width_including_trailing_whitespace)
- [`draw`](#function-draw)
- [`collapse`](#function-collapse)
- [`justify`](#function-justify)
- [`get_character_hit_from_distance`](#function-get_character_hit_from_distance)
- [`get_distance_from_character_hit`](#function-get_distance_from_character_hit)
- [`get_next_caret_character_hit`](#function-get_next_caret_character_hit)
- [`get_previous_caret_character_hit`](#function-get_previous_caret_character_hit)
- [`get_backspace_caret_character_hit`](#function-get_backspace_caret_character_hit)
- [`get_text_bounds`](#function-get_text_bounds)
- [`dispose`](#function-dispose)
- [`as_any`](#function-as_any)

<a id="function-text_runs"></a>

### text_runs

```rust
fn text_runs(self: &Self) -> Ref<'_, [Rc<dyn TextRun>]>
```

Gets the text runs that are contained within a line (visual order).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L17)

<a id="function-first_text_source_index"></a>

### first_text_source_index

```rust
fn first_text_source_index(self: &Self) -> i32
```

Gets the first text source index in the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L20)

<a id="function-length"></a>

### length

```rust
fn length(self: &Self) -> i32
```

Gets the total number of text source positions of the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L23)

<a id="function-text_line_break"></a>

### text_line_break

```rust
fn text_line_break(self: &Self) -> Option<Rc<TextLineBreak>>
```

Gets the state of the line when broken by line breaking process.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L26)

<a id="function-baseline"></a>

### baseline

```rust
fn baseline(self: &Self) -> f64
```

Gets the distance from the top to the baseline of the current line of text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L29)

<a id="function-extent"></a>

### extent

```rust
fn extent(self: &Self) -> f64
```

Gets the distance from the top-most to bottom-most black pixel in a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L32)

<a id="function-has_collapsed"></a>

### has_collapsed

```rust
fn has_collapsed(self: &Self) -> bool
```

Gets a value that indicates whether the line is collapsed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L35)

<a id="function-has_overflowed"></a>

### has_overflowed

```rust
fn has_overflowed(self: &Self) -> bool
```

Gets a value that indicates whether content of the line overflows the
specified paragraph width.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L39)

<a id="function-height"></a>

### height

```rust
fn height(self: &Self) -> f64
```

Gets the height of a line of text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L42)

<a id="function-new_line_length"></a>

### new_line_length

```rust
fn new_line_length(self: &Self) -> i32
```

Gets the number of newline characters at the end of a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L45)

<a id="function-overhang_after"></a>

### overhang_after

```rust
fn overhang_after(self: &Self) -> f64
```

Gets the distance that black pixels extend beyond the bottom alignment edge of a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L48)

<a id="function-overhang_leading"></a>

### overhang_leading

```rust
fn overhang_leading(self: &Self) -> f64
```

Gets the distance that black pixels extend prior to the left leading alignment edge of the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L51)

<a id="function-overhang_trailing"></a>

### overhang_trailing

```rust
fn overhang_trailing(self: &Self) -> f64
```

Gets the distance that black pixels extend following the right trailing alignment edge of the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L54)

<a id="function-start"></a>

### start

```rust
fn start(self: &Self) -> f64
```

Gets the distance from the start of a paragraph to the starting point of a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L57)

<a id="function-trailing_whitespace_length"></a>

### trailing_whitespace_length

```rust
fn trailing_whitespace_length(self: &Self) -> i32
```

Gets the number of whitespace code points beyond the last non-blank
character in a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L61)

<a id="function-width"></a>

### width

```rust
fn width(self: &Self) -> f64
```

Gets the width of a line of text, excluding trailing whitespace characters.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L64)

<a id="function-width_including_trailing_whitespace"></a>

### width_including_trailing_whitespace

```rust
fn width_including_trailing_whitespace(self: &Self) -> f64
```

Gets the width of a line of text, including trailing whitespace characters.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L67)

<a id="function-draw"></a>

### draw

```rust
fn draw(self: &Self, drawing_context: &mut dyn ITextDrawingSink, line_origin: Point)
```

Draws the text line onto the drawing context at the given origin.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L70)

<a id="function-collapse"></a>

### collapse

```rust
fn collapse(self: Rc<Self>, collapsing_properties_list: &[Option<Rc<dyn TextCollapsingProperties>>]) -> Rc<dyn TextLine>
```

Create a collapsed line based on collapsed text properties. Returns
the line itself when nothing has to be collapsed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L74)

<a id="function-justify"></a>

### justify

```rust
fn justify(self: &Self, justification_properties: &dyn JustificationProperties)
```

Justifies the line by applying given justification properties.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L80)

<a id="function-get_character_hit_from_distance"></a>

### get_character_hit_from_distance

```rust
fn get_character_hit_from_distance(self: &Self, distance: f64) -> CharacterHit
```

Gets the character hit corresponding to the specified distance from
the beginning of the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L84)

<a id="function-get_distance_from_character_hit"></a>

### get_distance_from_character_hit

```rust
fn get_distance_from_character_hit(self: &Self, character_hit: CharacterHit) -> f64
```

Gets the distance from the beginning of the line to the specified character hit.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L87)

<a id="function-get_next_caret_character_hit"></a>

### get_next_caret_character_hit

```rust
fn get_next_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
```

Gets the next character hit for caret navigation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L90)

<a id="function-get_previous_caret_character_hit"></a>

### get_previous_caret_character_hit

```rust
fn get_previous_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
```

Gets the previous character hit for caret navigation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L93)

<a id="function-get_backspace_caret_character_hit"></a>

### get_backspace_caret_character_hit

```rust
fn get_backspace_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
```

Gets the previous character hit after backspacing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L96)

<a id="function-get_text_bounds"></a>

### get_text_bounds

```rust
fn get_text_bounds(self: &Self, first_text_source_character_index: i32, text_length: i32) -> Vec<TextBounds>
```

Get an array of bounding rectangles of a range of characters within a text line.

Returns a list of bounding rectangles, or an empty list for an empty range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L101)

<a id="function-dispose"></a>

### dispose

```rust
fn dispose(self: &Self)
```

Releases the resources of the line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L104)

<a id="function-as_any"></a>

### as_any

```rust
fn as_any(self: &Self) -> &dyn Any
```

The line as `Any`, for downcasting to the concrete line type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_line.rs#L107)

## Trait implementations

- [`TextLine`](/docs/0.5.0/api/ferroui-base/media/text_formatting/trait-textline/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
