# GlyphRun

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

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

```rust
struct GlyphRun
```

Represents a sequence of glyphs from a single face of a single font at a
single size, and with a single rendering style.

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

## Members

- [`from_glyph_indices`](#function-from_glyph_indices)
- [`new`](#function-new)
- [`glyph_typeface`](#function-glyph_typeface)
- [`font_rendering_em_size`](#function-font_rendering_em_size)
- [`set_font_rendering_em_size`](#function-set_font_rendering_em_size)
- [`bounds`](#function-bounds)
- [`ink_bounds`](#function-ink_bounds)
- [`metrics`](#function-metrics)
- [`baseline_origin`](#function-baseline_origin)
- [`set_baseline_origin`](#function-set_baseline_origin)
- [`characters`](#function-characters)
- [`set_characters`](#function-set_characters)
- [`glyph_infos`](#function-glyph_infos)
- [`set_glyph_infos`](#function-set_glyph_infos)
- [`bidi_level`](#function-bidi_level)
- [`set_bidi_level`](#function-set_bidi_level)
- [`is_left_to_right`](#function-is_left_to_right)
- [`build_geometry`](#function-build_geometry)
- [`try_build_geometry`](#function-try_build_geometry)
- [`get_distance_from_character_hit`](#function-get_distance_from_character_hit)
- [`get_character_hit_from_distance`](#function-get_character_hit_from_distance)
- [`get_next_caret_character_hit`](#function-get_next_caret_character_hit)
- [`get_previous_caret_character_hit`](#function-get_previous_caret_character_hit)
- [`find_glyph_index`](#function-find_glyph_index)
- [`find_nearest_character_hit`](#function-find_nearest_character_hit)
- [`dispose`](#function-dispose)
- [`get_intersections`](#function-get_intersections)
- [`try_create_immutable_glyph_run_reference`](#function-try_create_immutable_glyph_run_reference)

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

### from_glyph_indices

```rust
fn from_glyph_indices(glyph_typeface: Rc<GlyphTypeface>, font_rendering_em_size: f64, characters: ReadOnlyMemory<u16>, glyph_indices: &[u16], baseline_origin: Option<Point>, bidi_level: i32) -> Rc<Self>
```

Creates a glyph run from glyph indices: every glyph is its own cluster
and gets the font's horizontal advance.

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

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

### new

```rust
fn new(glyph_typeface: Rc<GlyphTypeface>, font_rendering_em_size: f64, characters: ReadOnlyMemory<u16>, glyph_infos: GlyphInfoList, baseline_origin: Option<Point>, bidi_level: i32) -> Rc<Self>
```

Creates a glyph run.

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

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

### glyph_typeface

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

Gets the glyph typeface for the glyph run.

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

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

### font_rendering_em_size

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

Gets the em size used for rendering the glyph run.

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

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

### set_font_rendering_em_size

```rust
fn set_font_rendering_em_size(self: &Self, value: f64)
```

Sets the em size used for rendering the glyph run.

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

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

### bounds

```rust
fn bounds(self: &Self) -> Rect
```

Gets the conservative bounding box of the glyph run.

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

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

### ink_bounds

```rust
fn ink_bounds(self: &Self) -> Rect
```

Gets the ink bounds of the glyph run.

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

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

### metrics

```rust
fn metrics(self: &Self) -> GlyphRunMetrics
```

Gets the metrics of the glyph run.

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

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

### baseline_origin

```rust
fn baseline_origin(self: &Self) -> Point
```

Gets the baseline origin of the glyph run.

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

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

### set_baseline_origin

```rust
fn set_baseline_origin(self: &Self, value: Point)
```

Sets the baseline origin of the glyph run.

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

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

### characters

```rust
fn characters(self: &Self) -> ReadOnlyMemory<u16>
```

Gets the list of UTF-16 code points that represent the Unicode content of the glyph run.

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

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

### set_characters

```rust
fn set_characters(self: &Self, value: ReadOnlyMemory<u16>)
```

Sets the list of UTF-16 code points that represent the Unicode content of the glyph run.

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

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

### glyph_infos

```rust
fn glyph_infos(self: &Self) -> GlyphInfoList
```

Gets the list of glyphs to use to render this run.

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

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

### set_glyph_infos

```rust
fn set_glyph_infos(self: &Self, value: GlyphInfoList)
```

Sets the list of glyphs to use to render this run.

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

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

### bidi_level

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

Gets the bidirectional nesting level of the glyph run.

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

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

### set_bidi_level

```rust
fn set_bidi_level(self: &Self, value: i32)
```

Sets the bidirectional nesting level of the glyph run.

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

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

### is_left_to_right

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

Returns `true` if the text direction is left-to-right. Otherwise, returns `false`.

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

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

### build_geometry

```rust
fn build_geometry(self: &Self) -> crate::Ref<crate::media::Geometry>
```

Obtains geometry for the glyph run.

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

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

### try_build_geometry

```rust
fn try_build_geometry(self: &Self) -> Option<crate::Ref<crate::media::Geometry>>
```

Obtains a complete monochrome outline suitable for converting text to
editable paths. Returns `None` if the platform cannot verify completeness
or a glyph requires bitmap or colour rendering. An available empty
outline (for example, a space) is a successful empty geometry.

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

<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
```

Retrieves the offset from the leading edge of the glyph run to the
leading or trailing edge of a caret stop containing the specified
character hit.

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

<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, bool)
```

Retrieves the character hit information that corresponds to the
specified distance into the glyph run. The flag tells whether the
distance was inside the run.

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

<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
```

Retrieves the next valid caret character hit in the logical direction in the glyph run.

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

<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
```

Retrieves the previous valid caret character hit in the logical direction in the glyph run.

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

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

### find_glyph_index

```rust
fn find_glyph_index(self: &Self, character_index: i32) -> usize
```

Finds a glyph index for given character index.

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

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

### find_nearest_character_hit

```rust
fn find_nearest_character_hit(self: &Self, index: i32) -> (CharacterHit, f64)
```

Finds the nearest character hit at given index. Also returns the width
of the found cluster.

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

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

### dispose

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

Releases the platform resources of the run.

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

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

### get_intersections

```rust
fn get_intersections(self: &Self, lower_limit: f32, upper_limit: f32) -> Vec<f32>
```

Gets the intersections of specified upper and lower limit.

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

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

### try_create_immutable_glyph_run_reference

```rust
fn try_create_immutable_glyph_run_reference(self: &Self) -> Option<Rc<dyn IImmutableGlyphRunReference>>
```

Creates an immutable reference to the platform resources of this run.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`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`
- `PartialEq`

## Availability

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