Documentation ¶
Index ¶
- Variables
- func Extension(b []byte) string
- func MediaType(b []byte) (string, error)
- func NewSFNTReader(r io.Reader) (*bytes.Reader, error)
- func ParseEOT(b []byte) ([]byte, error)
- func ParseWOFF(b []byte) ([]byte, error)
- func ParseWOFF2(b []byte) ([]byte, error)
- func ToSFNT(b []byte) ([]byte, error)
- type Font
Constants ¶
This section is empty.
Variables ¶
var ErrExceedsMemory = fmt.Errorf("memory limit exceded")
ErrExceedsMemory is returned if the font is malformed.
var ErrInvalidFontData = fmt.Errorf("invalid font data")
ErrInvalidFontData is returned if the font is malformed.
var MaxMemory uint32 = 30 * 1024 * 1024
MaxMemory is the maximum memory that can be allocated by a font.
Functions ¶
func Extension ¶
Extension returns the file extension for a given font. An empty string is returned when the font is not recognized.
func NewSFNTReader ¶
NewReader takes an io.Reader and transforms it into an SFNT reader. That is, given TTF/OTF/WOFF/WOFF2/EOT input, it will return TTF/OTF output.
func ParseEOT ¶
ParseEOT parses the EOT font format and returns its contained SFNT font format (TTF or OTF). See https://www.w3.org/Submission/EOT/
func ParseWOFF ¶
ParseWOFF parses the WOFF font format and returns its contained SFNT font format (TTF or OTF). See https://www.w3.org/TR/WOFF/
func ParseWOFF2 ¶
ParseWOFF2 parses the WOFF2 font format and returns its contained SFNT font format (TTF or OTF). See https://www.w3.org/TR/WOFF2/