otf

package
v0.0.0-...-2b69d2e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2014 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package otf implements a parser for TrueType and OpenType fonts. Those formats are documented at http://developer.apple.com/fonts/TTRefMan/ and http://www.microsoft.com/typography/otspec/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

type Font struct {
	FullName       string // full font name
	PostscriptName string // Postscript name

	UnitsPerEm             int     // scaling factor for (nearly) all values here
	XMin, XMax, YMin, YMax int     // bounding box
	Ascender               int     // typographic ascender
	Descender              int     // typographic descender
	CapHeight              int     // height of an uppercase letter (from baseline)
	ItalicAngle            float32 // italic angle
	// contains filtered or unexported fields
}

func Open

func Open(filename string) (*Font, error)

Open reads in a font file stored on the filesystem.

func Parse

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

Parse parses the font file specified by data.

func (*Font) CFF

func (f *Font) CFF() []byte

func (*Font) HMetric

func (f *Font) HMetric(i Index) HMetric

func (*Font) Index

func (f *Font) Index(x rune) Index

Index returns a Font's index for the given rune.

func (*Font) Index2

func (f *Font) Index2(x rune) Index

func (*Font) Kerning

func (f *Font) Kerning(scale int, a, b Index) int

Kerning returns the kerning for the given glyph pair.

func (*Font) Ligatures

func (f *Font) Ligatures(glyphs []Index) []Index

func (*Font) NumGlyphs

func (f *Font) NumGlyphs() int

func (*Font) Scale

func (f *Font) Scale(value, scale int) int

func (*Font) SmallCaps

func (f *Font) SmallCaps(glyphs []Index) []Index

func (*Font) StringToGlyphs

func (f *Font) StringToGlyphs(text string) []Index

func (*Font) TTF

func (f *Font) TTF() []byte

type FontError

type FontError string

FontError is used to report various errors about invalid TTF and OTF files.

func (FontError) Error

func (e FontError) Error() string

Error returns the detailed error message.

type HMetric

type HMetric struct {
	Width, Left int
}

An HMetric holds the horizontal metrics of a single glyph.

type Index

type Index uint16

An Index is a Font's index of a rune.

type Kerner

type Kerner interface {
	Kern(a, b Index) int
}

type Kerning

type Kerning struct {
	First  Index
	Second Index
	Horiz  int
}

type Ligature

type Ligature struct {
	Old []Index
	New Index
}

Jump to

Keyboard shortcuts

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