webfont

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: BSD-3-Clause Imports: 10 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package webfont converts a font in WOFF, WOFF2 or EOT into an sfnt file, the format of a TrueType or OpenType font file (D45). It is public, so that ivy and other programs can read fonts in a web format (D51). It ports no upstream. It follows the WOFF 1.0 and WOFF2 recommendations of the W3C and the EOT submission to the W3C.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(data []byte) ([]byte, error)

Convert returns the sfnt bytes of a font in WOFF, WOFF2 or EOT. It returns data as it is when data is already an sfnt file. It returns an error that wraps okage.ErrFontData for malformed data, and okage.ErrFontUnsupported for data in another format.

Types

type Format

type Format int

Format is the format of font data.

const (
	// FormatUnknown is data in no format of this list.
	FormatUnknown Format = iota
	// FormatSFNT is a TrueType or OpenType font, or a collection of them.
	FormatSFNT
	// FormatWOFF is a font in WOFF 1.0.
	FormatWOFF
	// FormatWOFF2 is a font or a collection in WOFF2.
	FormatWOFF2
	// FormatEOT is a font in EOT.
	FormatEOT
)

The formats of font data.

func DetectFormat

func DetectFormat(data []byte) Format

DetectFormat returns the format of data, from its first bytes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL