font

package
v0.0.0-...-d153ec4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PtI = fixed.I

Functions

func PtToF

func PtToF(pt Pt) float64

Types

type Dot

type Dot float64

Dot is the measurement used by layla and is defined as 1/8 mm or 1/203 inch. We use the 200 dpi dot as default, because it easier to work with than mm or 300 dpi dots. During layout we round to half dots so we do not lose information relevant for 300 dpi renders. Otherwise we try to round positions down and dimensions up, as not to sqeeze and wrap text.

func (Dot) At

func (dot Dot) At(dpi int) int

At returns dot at a specific resolution in dots per inch.

func (Dot) Ceil

func (dot Dot) Ceil() Dot

func (Dot) CeilHalf

func (dot Dot) CeilHalf() Dot

func (Dot) Floor

func (dot Dot) Floor() Dot

func (Dot) FloorHalf

func (dot Dot) FloorHalf() Dot

func (Dot) Mm

func (dot Dot) Mm() float64

Mm converts dot into mm and returns it.

func (Dot) Round

func (dot Dot) Round() Dot

func (Dot) RoundHalf

func (dot Dot) RoundHalf() Dot

type Face

type Face struct {
	*Manager
	font.Face
	Add Dot
}

func (*Face) Extra

func (f *Face) Extra() Dot

func (*Face) Rune

func (f *Face) Rune(r, last rune) Dot

func (*Face) Text

func (f *Face) Text(text string, last rune) (res Dot, _ rune)

type Key

type Key struct {
	Name string
	Size float64
}

type Manager

type Manager struct {
	Compat bool
	// contains filtered or unexported fields
}

func NewManager

func NewManager(dpi, subx, suby int) *Manager

func (*Manager) DPI

func (m *Manager) DPI() int

func (*Manager) DotToPt

func (m *Manager) DotToPt(dot Dot) Pt

func (*Manager) Err

func (m *Manager) Err() error

func (*Manager) Face

func (m *Manager) Face(name string, size float64) (font.Face, error)

func (*Manager) Path

func (m *Manager) Path(name string) (string, error)

func (*Manager) PtToDot

func (m *Manager) PtToDot(pt Pt) Dot

func (*Manager) RegisterTTF

func (m *Manager) RegisterTTF(name string, path string) *Manager

func (*Manager) SubPixels

func (m *Manager) SubPixels() (x, y int)

type Pt

type Pt = fixed.Int26_6

func PtF

func PtF(f float64) Pt

type Src

type Src struct {
	*truetype.Font
	Path string
	Name string
}

Jump to

Keyboard shortcuts

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