# IGlyphDrawing

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/trait-iglyphdrawing/

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

```rust
trait IGlyphDrawing
```

Represents a glyph that knows how to draw itself into a [`DrawingContext`](/docs/0.5.0/api/ferroui-base/media/struct-drawingcontext/).

Implementations are produced by the per-format renderers (color layers from
COLR/CPAL, bitmap strikes from sbix/CBDT, etc.) and shielded behind this contract
so callers can render any color glyph without caring which font-table format
produced it. For plain outline glyphs, use `GlyphTypeface::get_glyph_outline`
instead: outlines are returned as a geometry rather than via this interface.

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

## Members

- [`type_`](#function-type_)
- [`bounds`](#function-bounds)
- [`draw`](#function-draw)

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

### type_

```rust
fn type_(self: &Self) -> GlyphDrawingType
```

Gets the format this drawing was produced from. Callers can use this to
branch on rendering behaviour without downcasting.

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

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

### bounds

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

Gets the axis-aligned bounding rectangle of the drawing, in drawing-space
coordinates (Y-down).

The rectangle is relative to the drawing's local origin. To get bounds at a
specific paint location, translate by the origin passed to `IGlyphDrawing::draw`.
Implementations are expected to compute this once (e.g. from the font's clip
box or layer extents) and cache it.

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

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

### draw

```rust
fn draw(self: &Self, context: &mut DrawingContext<'_>, origin: Point)
```

Draws the glyph into `context` at `origin`.

`origin` is the drawing-space point (Y-down) at which the glyph's local origin
should land. For text rendering this is typically the pen position on the
baseline. Implementations apply the Y-flip from font-space (Y-up) internally, so
callers don't need to flip `origin` themselves.

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

## Availability

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