font

package
v0.0.0-...-1210f28 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: ISC Imports: 0 Imported by: 0

Documentation

Overview

Package font provides an interface for dealing with fonts. This allows other parts of the engine to stay platform independent.

Index

Constants

This section is empty.

Variables

View Source
var Load func(Query) Font

Load is a function that loads a font from a query. An implementation must set this variable to an appropriate function.

Functions

This section is empty.

Types

type Font

type Font interface {
	Height() int
	Ascender() int
	Width(s string) int
}

A Font is used in layout to calculate text metrics. It is also passed to the paint.List, to select the correct font for rendering.

type Query

type Query struct {
	// Names is a string of NUL-separated fields.
	// Each field is one font name that should be tried.
	Names string

	// Size is the requested font size (ascender + descender), in pixels.
	Size int

	// Weight is the requested weight. It will usually be a number between 100 and 900.
	Weight int

	// Italic is true when an oblique or italic font is requested.
	// We don't differenciate between the two.
	Italic bool
}

A Query contains information about a requested font.

type Zero

type Zero struct{}

A Zero font.

func (Zero) Ascender

func (Zero) Ascender() int

func (Zero) Height

func (Zero) Height() int

func (Zero) Width

func (Zero) Width(_ string) int

Jump to

Keyboard shortcuts

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