# FerroTextMeasurerFactory

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-pretext-media/struct-ferrotextmeasurerfactory/

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

```rust
struct FerroTextMeasurerFactory
```

Connects Pretext to the application's configured FerroUI text services.

Instances are UI-thread-affine and belong to their font-service scope. If
that scope is replaced, creation/shaping returns an error; create a new
factory for the new scope. Replacing a Pretext engine's backend does not
invalidate the native services retained by an existing prepared shaper.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Pretext/FerroUI.Pretext.Media/ferro_text_measurer_factory.rs#L31)

## Members

- [`try_current`](#function-try_current)
- [`with_culture`](#function-with_culture)
- [`create_layout`](#function-create_layout)
- [`create_text_service`](#function-create_text_service)

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

### try_current

```rust
fn try_current() -> Result<Self, PretextError>
```

Resolves the configured native services without panicking when the
application has not installed a font manager or text shaper.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Pretext/FerroUI.Pretext.Media/ferro_text_measurer_factory.rs#L41)

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

### with_culture

```rust
fn with_culture(self: Self, culture: Locale) -> Self
```

Selects the culture used by native font fallback and shaping.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Pretext/FerroUI.Pretext.Media/ferro_text_measurer_factory.rs#L83)

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

### create_layout

```rust
fn create_layout(self: &Self) -> PretextLayout
```

Creates an engine sharing this backend for measurement and shaping.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Pretext/FerroUI.Pretext.Media/ferro_text_measurer_factory.rs#L89)

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

### create_text_service

```rust
fn create_text_service(self: &Self, font: &str) -> Result<Rc<FerroTextService>, PretextError>
```

Creates a concrete service for direct native drawing as well as the
portable measurement/shaping contracts.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Pretext/FerroUI.Pretext.Media/ferro_text_measurer_factory.rs#L95)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- [`IPretextTextMeasurerFactory`](/docs/0.5.0/api/ferroui-pretext-contracts/trait-ipretexttextmeasurerfactory/)
- [`IPretextTextShaperFactory`](/docs/0.5.0/api/ferroui-pretext-contracts/trait-ipretexttextshaperfactory/)

## Availability

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