# CharacterToGlyphMap

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

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

```rust
struct CharacterToGlyphMap
```

Maps Unicode code points to glyph indices using the font's `cmap` table.

A cheap handle: cloning shares the underlying subtable. The default value
maps nothing. Lookups never allocate.

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

## Members

- [`format`](#function-format)
- [`get_glyph`](#function-get_glyph)
- [`contains_glyph`](#function-contains_glyph)
- [`get_glyphs`](#function-get_glyphs)
- [`try_get_glyph`](#function-try_get_glyph)
- [`get_mapped_ranges`](#function-get_mapped_ranges)
- [`as_read_only_dictionary`](#function-as_read_only_dictionary)

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

### format

```rust
fn format(self: &Self) -> CmapFormat
```

The format of the subtable the map reads.

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

<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 (the reference's
indexer and `GetGlyph`).

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

<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/character_to_glyph_map.rs#L58)

<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/character_to_glyph_map.rs#L70)

<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/character_to_glyph_map.rs#L81)

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

### get_mapped_ranges

```rust
fn get_mapped_ranges(self: &Self) -> CodepointRangeEnumerator
```

Enumerates the code point ranges the map covers.

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

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

### as_read_only_dictionary

```rust
fn as_read_only_dictionary(self: &Self) -> CharacterToGlyphMapDictionary
```

A dictionary view (code point to glyph) of the map.

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

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

## Availability

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