# ShapedTextRun

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

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

```rust
struct ShapedTextRun
```

A text run that holds shaped characters.

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

## Members

- [`new`](#function-new)
- [`bidi_level`](#function-bidi_level)
- [`shaped_buffer`](#function-shaped_buffer)
- [`run_properties`](#function-run_properties)
- [`text_metrics`](#function-text_metrics)
- [`glyph_run`](#function-glyph_run)
- [`add_ref`](#function-add_ref)
- [`try_measure_characters`](#function-try_measure_characters)
- [`try_measure_characters_backwards`](#function-try_measure_characters_backwards)
- [`dispose`](#function-dispose)

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

### new

```rust
fn new(shaped_buffer: Rc<ShapedBuffer>, properties: Rc<dyn TextRunProperties>) -> Self
```



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

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

### bidi_level

```rust
fn bidi_level(self: &Self) -> i8
```

The bidi level of the run.

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

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

### shaped_buffer

```rust
fn shaped_buffer(self: &Self) -> &Rc<ShapedBuffer>
```

The shaped glyphs of the run.

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

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

### run_properties

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

The run's properties (never absent for a shaped run).

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

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

### text_metrics

```rust
fn text_metrics(self: &Self) -> TextMetrics
```

The metrics of the run's font at the run's em size.

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

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

### glyph_run

```rust
fn glyph_run(self: &Self) -> &Rc<GlyphRun>
```

The glyph run of the shaped glyphs (created on first use).

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

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

### add_ref

```rust
fn add_ref(self: &Rc<Self>) -> Rc<Self>
```

Registers another owner of the run; every owner calls `ShapedTextRun::dispose` once.

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

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

### try_measure_characters

```rust
fn try_measure_characters(self: &Self, available_width: f64) -> Option<i32>
```

Measures the number of characters that fit into available width.

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

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

### try_measure_characters_backwards

```rust
fn try_measure_characters_backwards(self: &Self, available_width: f64) -> Option<(i32, f64)>
```

Measures the number of characters that fit into available width when
measuring from the end; returns the count and the width they take.

Internal upstream; public so that the Skia unit tests reach it.

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

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

### dispose

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

Releases one reference; the glyph run and the shaped buffer are
disposed with the last one.

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

## 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/)
- [`DrawableTextRun`](/docs/0.5.0/api/ferroui-base/media/text_formatting/trait-drawabletextrun/)

## Availability

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