[−][src]Crate ab_glyph
API for loading, scaling, positioning and rasterizing OpenType font glyphs.
Example
use ab_glyph::{FontRef, Font, Glyph, point}; let font = FontRef::try_from_slice(include_bytes!("../../dev/fonts/Exo2-Light.otf"))?; // Get a glyph for 'q' with a scale & position. let q_glyph: Glyph = font.glyph_id('q').with_scale_and_position(24.0, point(100.0, 0.0)); // Draw it. if let Some(q) = font.outline_glyph(q_glyph) { q.draw(|x, y, c| { /* draw pixel `(x, y)` with coverage: `c` */ }); }
Structs
FontArc |
|
FontRef | Font data handle stored as a |
FontVec | Font data handle stored in a |
Glyph | A glyph with pixel scale & position. |
GlyphId | Glyph id. |
InvalidFont | Invalid font data error. |
Outline | A "raw" collection of outline curves for a glyph, unscaled & unpositioned. |
OutlinedGlyph | A glyph that has been outlined at a scale & position. |
PxScale | Pixel scale. |
PxScaleFactor | 2D scale factors for use with unscaled metrics. |
PxScaleFont | A |
Rect | A rectangle, with top-left corner at |
Enums
OutlineCurve | Glyph outline primitives. |
Traits
Font | Functionality required from font data. |
ScaleFont | A |
Functions
point |
|
Type Definitions
Point | An (x, y) coordinate. |