package opentype
import "gioui.org/font/opentype"
Package opentype implements text layout and shaping for OpenType files.
NOTE: the OpenType specification allows for fonts to include bitmap images in a variety of formats. In the interest of small binary sizes, the opentype package only automatically imports the PNG image decoder. If you have a font with glyphs in JPEG or TIFF formats, register those decoders with the image package in order to ensure those glyphs are visible in text.
Index ¶
- func DescriptionToFont(md fontapi.Description) giofont.Font
- func FontToDescription(font giofont.Font) fontapi.Description
- func ParseCollection(src []byte) ([]giofont.FontFace, error)
- type Face
- func Parse(src []byte) (Face, error)
- func (f Face) Face() *fontapi.Face
- func (f Face) Font() giofont.Font
- Bugs
Functions ¶
func DescriptionToFont ¶
func DescriptionToFont(md fontapi.Description) giofont.Font
func FontToDescription ¶
func FontToDescription(font giofont.Font) fontapi.Description
func ParseCollection ¶
ParseCollection parse an Opentype font file, with support for collections. Single font files are supported, returning a slice with length 1. The returned fonts are automatically wrapped in a text.FontFace with inferred font font. BUG(whereswaldon): the only Variant that can be detected automatically is "Mono".
Types ¶
type Face ¶
type Face struct {
// contains filtered or unexported fields
}
Face is a thread-safe representation of a loaded font. For efficiency, applications should construct a face for any given font file once, reusing it across different text shapers.
func Parse ¶
Parse constructs a Face from source bytes.
func (Face) Face ¶
Face returns a thread-unsafe wrapper for this Face suitable for use by a single shaper. Face many be invoked any number of times and is safe so long as each return value is only used by one goroutine.
func (Face) Font ¶
FontFace returns a text.Font with populated font metadata for the font. BUG(whereswaldon): the only Variant that can be detected automatically is "Mono".
Bugs ¶
☞ the only Variant that can be detected automatically is "Mono".
☞ the only Variant that can be detected automatically is "Mono".
Source Files ¶
opentype.go
- Version
- v0.8.0 (latest)
- Published
- Jan 14, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 12 hours ago –
Tools for package owners.