opentype

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Unlicense, MIT, Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package opentype implements text layout and shaping for OpenType files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	// contains filtered or unexported fields
}

Collection is a collection of one or more fonts. When used as a text.Face, each rune will be assigned a glyph from the first font in the collection that supports it.

func ParseCollection

func ParseCollection(src []byte) (*Collection, error)

ParseCollection parses an SFNT font collection, such as TTC or OTC data, from a []byte data source.

If passed data for a single font, a TTF or OTF instead of a TTC or OTC, it will return a collection containing 1 font.

func ParseCollectionReaderAt

func ParseCollectionReaderAt(src io.ReaderAt) (*Collection, error)

ParseCollectionReaderAt parses an SFNT collection, such as TTC or OTC data, from an io.ReaderAt data source.

If passed data for a single font, a TTF or OTF instead of a TTC or OTC, it will return a collection containing 1 font.

func (*Collection) Font

func (c *Collection) Font(i int) (*Font, error)

Font returns the i'th font in the collection.

func (*Collection) Layout

func (c *Collection) Layout(ppem fixed.Int26_6, maxWidth int, txt io.Reader,
) ([]text.Line, error)

func (*Collection) NumFonts

func (c *Collection) NumFonts() int

NumFonts returns the number of fonts in the collection.

func (*Collection) Shape

func (c *Collection) Shape(ppem fixed.Int26_6, str text.Layout) op.CallOp

type Font

type Font struct {
	// contains filtered or unexported fields
}

Font implements text.Face. Its methods are safe to use concurrently.

func Parse

func Parse(src []byte) (*Font, error)

NewFont parses an SFNT font, such as TTF or OTF data, from a []byte data source.

func (*Font) Layout

func (f *Font) Layout(ppem fixed.Int26_6, maxWidth int, txt io.Reader,
) ([]text.Line, error)

func (*Font) Metrics

func (f *Font) Metrics(ppem fixed.Int26_6) font.Metrics

func (*Font) Shape

func (f *Font) Shape(ppem fixed.Int26_6, str text.Layout) op.CallOp

Jump to

Keyboard shortcuts

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