Back to / font / opentype

Package opentype

Latest Go to latest

The highest tagged major version is .

Published: Sep 21, 2020 | License: BSD-3-Clause | Module:


Package opentype implements the font.Face interface based on SFNT font file formats.


func NewFace

func NewFace(f *sfnt.Font, opts *FaceOptions) (font.Face, error)

NewFace returns a new font.Face for the given sfnt.Font. if opts is nil, sensible defaults will be used.

type Face

type Face struct {
	// contains filtered or unexported fields

Face implements the font.Face interface for sfnt.Font values.

func (*Face) Close

func (f *Face) Close() error

Close satisfies the font.Face interface.

func (*Face) Glyph

func (f *Face) Glyph(dot fixed.Point26_6, r rune) (dr image.Rectangle, mask image.Image, maskp image.Point, advance fixed.Int26_6, ok bool)

Glyph satisfies the font.Face interface.

func (*Face) GlyphAdvance

func (f *Face) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool)

GlyphAdvance satisfies the font.Face interface.

func (*Face) GlyphBounds

func (f *Face) GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

GlyphBounds satisfies the font.Face interface.

func (*Face) Kern

func (f *Face) Kern(r0, r1 rune) fixed.Int26_6

Kern satisfies the font.Face interface.

func (*Face) Metrics

func (f *Face) Metrics() font.Metrics

Metrics satisfies the font.Face interface.

type FaceOptions

type FaceOptions struct {
	Size    float64      // Size is the font size in points
	DPI     float64      // DPI is the dots per inch resolution
	Hinting font.Hinting // Hinting selects how to quantize a vector font's glyph nodes

FaceOptions describes the possible options given to NewFace when creating a new font.Face from a sfnt.Font.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier