# GlyfTable

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

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

```rust
struct GlyfTable
```

Reader for the 'glyf' table. Provides on-demand access to individual glyph
data using the 'loca' index. Designed for high-performance lookups on the
hot path.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L41)

## Members

- [`TABLE_NAME`](#assoc_const-table_name)
- [`TAG`](#assoc_const-tag)
- [`glyph_count`](#function-glyph_count)
- [`try_load`](#function-try_load)
- [`try_get_glyph_data`](#function-try_get_glyph_data)
- [`try_get_glyph_bounds`](#function-try_get_glyph_bounds)

<a id="assoc_const-table_name"></a>

### TABLE_NAME

```rust
const TABLE_NAME: &'static str
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L47)

<a id="assoc_const-tag"></a>

### TAG

```rust
const TAG: OpenTypeTag
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L48)

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

### glyph_count

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

Gets the total number of glyphs defined in the font.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L55)

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

### try_load

```rust
fn try_load(font: &dyn IFontMemory, head: &HeadTable, maxp: &MaxpTable) -> Option<GlyfTable>
```

Attempts to load the 'glyf' table from the specified font data.

Never fails: `None` when the font has no 'glyf' or no 'loca' table.

* `font` - The font from which to retrieve the 'glyf' table.
* `head` - The 'head' table containing font header information required
  for loading the 'glyf' table.
* `maxp` - The 'maxp' table providing maximum profile information needed
  to interpret the 'glyf' table.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L68)

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

### try_get_glyph_data

```rust
fn try_get_glyph_data(self: &Self, glyph_index: i32) -> Option<ReadOnlyMemory<u8>>
```

Attempts to retrieve the raw glyph data for the specified glyph index.

If the glyph exists but has no data (for example, a missing or empty
glyph), the method returns an empty memory region. If the glyph index
is invalid or out of range, the method returns `None`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L81)

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

### try_get_glyph_bounds

```rust
fn try_get_glyph_bounds(self: &Self, glyph_index: i32) -> Option<(i16, i16, i16, i16)>
```

Reads a glyph's bounding box `(x_min, y_min, x_max, y_max)` from its
'glyf' header without parsing contours.

The values are the control-point bounding box stored in the glyph header
(the min/max of all on- and off-curve points), in font design units.
This is a slight superset of the rendered ink bounds for glyphs with
off-curve points. Composite glyphs carry their overall bounding box in
the header too, so no recursion is needed. Returns all-zero bounds for
empty glyphs (e.g. whitespace); returns `None` when the glyph index is
out of range or the glyph data is too short to contain a header.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/fonts/tables/glyf/glyf_table.rs#L106)

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