# CmapFormat4Table

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/fonts/tables/cmap/struct-cmapformat4table/

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

```rust
struct CmapFormat4Table
```

A format 4 `cmap` subtable (segment mapping to delta values).

Lookups read the table data lazily and never allocate.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L10)

## Members

- [`new`](#function-new)
- [`language`](#function-language)
- [`get_glyph`](#function-get_glyph)
- [`contains_glyph`](#function-contains_glyph)
- [`get_glyphs`](#function-get_glyphs)
- [`try_get_glyph`](#function-try_get_glyph)

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

### new

```rust
fn new(table: ReadOnlyMemory<u8>) -> Result<Self, FontTableError>
```

Parses the subtable header; `Err` when the header is truncated.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L22)

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

### language

```rust
fn language(self: &Self) -> u16
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L82)

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

### get_glyph

```rust
fn get_glyph(self: &Self, code_point: i32) -> u16
```

The glyph for the code point, 0 when it is not mapped.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L88)

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

### contains_glyph

```rust
fn contains_glyph(self: &Self, code_point: i32) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L107)

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

### get_glyphs

```rust
fn get_glyphs(self: &Self, code_points: &[i32], glyph_ids: &mut [u16])
```

Maps every code point to its glyph (0 when unmapped).

Panics when `glyph_ids` is shorter than `code_points`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L136)

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

### try_get_glyph

```rust
fn try_get_glyph(self: &Self, code_point: i32) -> Option<u16>
```

The glyph for the code point; `None` when it is not mapped or maps to
glyph 0.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/cmap/cmap_format4_table.rs#L191)

## Trait implementations

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

## Availability

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