useFont
TheuseFont hook loads a font from a source and returns an SkFont object.
Parameters
| Name | Type | Description |
|---|---|---|
| source | DataSourceParam | Font file (require or URL) |
| size | number | Font size in points (default: 14) |
| onError | (err: Error) => void | Optional error handler |
Font Properties
TheSkFont interface provides methods for measuring and configuring text:
Measuring Text
Font Metrics
Font Styling
Font Enumerations
FontEdging
FontHinting
FontWeight
FontSlant
matchFont
Match a system font by family name and style:useFonts
Load multiple font families for use in Paragraphs:listFontFamilies
List all available system fonts:Glyph Operations
Getting Glyph IDs
Glyph Intercepts
Find where glyphs intersect with a horizontal line (useful for underlines):Font Styles
Predefined font style constants:Related
- Text Rendering - Render text with fonts
- Paragraphs - Advanced text layout
- Getting Started - Setup and installation