# TextCharacters

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

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

```rust
struct TextCharacters
```

A text run that holds text characters.

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

## Members

- [`from_str`](#function-from_str)
- [`new`](#function-new)
- [`run_properties`](#function-run_properties)
- [`get_shapeable_characters`](#function-get_shapeable_characters)
- [`try_get_shapeable_length`](#function-try_get_shapeable_length)

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

### from_str

```rust
fn from_str(text: &str, text_run_properties: Rc<dyn TextRunProperties>) -> Self
```

Constructs a run for text content from a string.

Panics when the font rendering em size of the properties is not positive.

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

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

### new

```rust
fn new(text: ReadOnlyMemory<u16>, text_run_properties: Rc<dyn TextRunProperties>) -> Self
```

Constructs a run for text content from a memory region.

Panics when the font rendering em size of the properties is not positive.

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

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

### run_properties

```rust
fn run_properties(self: &Self) -> &Rc<dyn TextRunProperties>
```

The run's properties (never absent for text characters).

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

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

### get_shapeable_characters

```rust
fn get_shapeable_characters(self: &Self, text: ReadOnlyMemory<u16>, bidi_level: i8, font_manager: &FontManager, previous_properties: &mut Option<Rc<dyn TextRunProperties>>, results: &mut Vec<Rc<dyn TextRun>>)
```

Gets a list of `UnshapedTextRun`.

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

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

### try_get_shapeable_length

```rust
fn try_get_shapeable_length(text: &[u16], glyph_typeface: &GlyphTypeface, default_glyph_typeface: Option<&GlyphTypeface>, default_can_shape_script: bool, require_full_cluster: bool) -> Option<usize>
```

Tries to get a shapeable length that is supported by the specified typeface.

* `text` — the characters to shape.
* `glyph_typeface` — the typeface that is used to find matching characters.
* `default_glyph_typeface` — the default typeface, or `None` when there is none to
  return to (the probe for the default typeface itself).
* `default_can_shape_script` — whether the default typeface can shape this run's script.
  When `false` it only reclaims spacing whitespace, which needs no shaping.
* `require_full_cluster` — when `true`, a grapheme cluster only counts as supported when
  the typeface has a glyph for every scalar it contains (base plus combining marks);
  when `false`, only the base scalar is tested.

Returns the shapeable length, or `None` when it is zero.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`TextRun`](/docs/0.5.0/api/ferroui-base/media/text_formatting/trait-textrun/)

## Availability

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