Expand description
Public API for loading fonts, selecting faces, shaping text, and exporting SVG.
The intended high-level flow is:
- Load a file with
FontFile - Pick one face as a
FontFace - Shape or render through
FontEngine
use fontcore::FontFile;
let face = FontFile::from_file("fonts/YourFont.ttf")?.current_face()?;
let svg = face.engine().with_font_size(32.0).render_svg("Hello")?;
assert!(svg.contains("<svg"));Enable features = ["raw"] if you need the older low-level parser surface.
Re-exports§
pub use commands as commads;pub use commands::SvgGlyphLayer;pub use commands::text2commands;pub use commands::Command;pub use commands::FillRule;pub use commands::FontMetrics;pub use commands::FontOptions;pub use commands::FontRef;pub use commands::FontStretch;pub use commands::FontStyle;pub use commands::FontVariant;pub use commands::FontVariationSetting;pub use commands::FontWeight;pub use commands::Glyph;pub use commands::GlyphBounds;pub use commands::GlyphFlow;pub use commands::GlyphGradientSpread;pub use commands::GlyphGradientStop;pub use commands::GlyphGradientUnits;pub use commands::GlyphLayer;pub use commands::GlyphLinearGradient;pub use commands::GlyphMetrics;pub use commands::GlyphPaint;pub use commands::GlyphRadialGradient;pub use commands::GlyphRun;pub use commands::PathGlyphLayer;pub use commands::PathPaintMode;pub use commands::PositionedGlyph;pub use commands::RasterGlyphLayer;pub use commands::RasterGlyphSource;pub use commands::TextDirection;pub use fontengine::FontEngine;pub use fontengine::ShapingPolicy;pub use fontface::FontFace;pub use fontface::FontFaceDescriptor;pub use fontface::FontFamily;pub use fontface::FontVariationAxis;pub use fontfile::load_font;pub use fontfile::load_font_from_buffer;pub use fontfile::load_font_from_file;pub use fontfile::load_font_from_net;pub use fontfile::open_font;pub use fontfile::open_font_from_buffer;pub use fontfile::open_font_from_file;pub use fontfile::open_font_from_net;pub use fontfile::ChunkedFontBuffer;pub use fontfile::FontFile;pub use fontfile::FontSource;pub use fontfile::fontload;Deprecated pub use fontfile::fontload_buffer;Deprecated pub use fontfile::fontload_file;Deprecated pub use fontfile::fontload_net;Deprecated pub use fontreader::BitmapGlyphCommands;pub use fontreader::BitmapGlyphFormat;pub use fontreader::GlyphCommands;pub use fontreader::PathCommand;
Modules§
- commands
- fontengine
- High-level shaping and rendering engine bound to one
crate::FontFace. - fontface
- Face-level metadata access and family fallback helpers.
- fontfile
- File and collection entry points for the public API.
- fontheader
- fontreader
- opentype
- woff
Type Aliases§
- Font
- Loaded
Font Deprecated