opentype

package
v0.0.0-...-e3504ca Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT, Unlicense Imports: 8 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescriptionToFont

func DescriptionToFont(md metadata.Description) giofont.Font

func FontToDescription

func FontToDescription(font giofont.Font) metadata.Description

func ParseCollection

func ParseCollection(src []byte) ([]giofont.FontFace, error)

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 metadata. 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

func Parse(src []byte) (Face, error)

Parse constructs a Face from source bytes.

func (Face) Face

func (f Face) Face() font.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

func (f Face) Font() giofont.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".

Notes

Bugs

  • the only Variant that can be detected automatically is "Mono".

  • the only Variant that can be detected automatically is "Mono".

Jump to

Keyboard shortcuts

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