IGlyphDrawing
trait · ferroui-base · v0.5.0
trait IGlyphDrawing
Represents a glyph that knows how to draw itself into a 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.
Members
type_
fn type_(self: &Self) -> GlyphDrawingType
Gets the format this drawing was produced from. Callers can use this to branch on rendering behaviour without downcasting.
bounds
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.
draw
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.
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.