ttf

package
v0.0.0-...-5c1ce85 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 14 Imported by: 6

Documentation

Overview

Package ttf provides a truetype font Backend

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func New

func New(cnv *drawtex.Canvas) *Backend

func NewFrom

func NewFrom(cnv *drawtex.Canvas, fnts *Fonts) *Backend

func (*Backend) Kern

func (be *Backend) Kern(ft1 font.Font, sym1 string, ft2 font.Font, sym2 string, dpi float64) float64

Kern returns the kerning distance between two symbols.

func (*Backend) Metrics

func (be *Backend) Metrics(symbol string, fnt font.Font, dpi float64, math bool) font.Metrics

Metrics returns the metrics.

func (*Backend) RenderGlyph

func (be *Backend) RenderGlyph(x, y float64, font font.Font, symbol string, dpi float64)

RenderGlyphs renders the glyph g at the reference point (x,y).

func (*Backend) RenderRectFilled

func (be *Backend) RenderRectFilled(x1, y1, x2, y2 float64)

RenderRectFilled draws a filled black rectangle from (x1,y1) to (x2,y2).

func (*Backend) UnderlineThickness

func (*Backend) UnderlineThickness(font font.Font, dpi float64) float64

UnderlineThickness returns the line thickness that matches the given font. It is used as a base unit for drawing lines such as in a fraction or radical.

func (*Backend) XHeight

func (be *Backend) XHeight(fnt font.Font, dpi float64) float64

XHeight returns the xheight for the given font and dpi.

type Fonts

type Fonts struct {
	Default *sfnt.Font

	Rm   *sfnt.Font
	It   *sfnt.Font
	Bf   *sfnt.Font
	BfIt *sfnt.Font
}

Jump to

Keyboard shortcuts

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