freetype2

package module
v0.0.0-...-477063b Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2013 License: MIT Imports: 7 Imported by: 0

README

freetype2

Package freetype2 is a minimal wrapper for the FreeType 2 library, with an API focused around scalable vector fonts.

FreeType is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output (glyph images). It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well.

Note that FreeType is a font service and doesn't provide APIs to perform higher-level features like text layout or graphics processing (e.g., colored text rendering, ‘hollowing’, etc.). However, it greatly simplifies these tasks by providing a simple, easy to use, and uniform interface to access the content of font files.

Visit http://freetype.org for more on FreeType 2.

Installation

go get j4k.co/freetype2

New to Go? Have a look at how import paths work.

Documentation

Overview

Package freetype2 is a minimal wrapper for the FreeType 2 library, with an API focused around scalable vector fonts.

"FreeType is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output (glyph images). It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well.

Note that FreeType is a font service and doesn't provide APIs to perform higher-level features like text layout or graphics processing (e.g., colored text rendering, ‘hollowing’, etc.). However, it greatly simplifies these tasks by providing a simple, easy to use, and uniform interface to access the content of font files."

Visit http://freetype.org for more on FreeType 2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Face

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

Face represents a typeface of a single style.

func (*Face) Bounds

func (f *Face) Bounds() image.Rectangle

Bounds returns the overall bounding box for the font, in pixels.

func (*Face) FixedWidth

func (f *Face) FixedWidth() bool

FixedWidth returns true if font face is monospaced, where each glyph occupies the same horizontal space.

func (*Face) Height

func (f *Face) Height() int

Height returns the default line spacing in pixels.

func (*Face) Image

func (f *Face) Image(dst draw.Image, pt image.Point, ch rune) error

Image directly copies the rendered bitmap data for the glyph into dst with its top-left corner at pt. Currently, only *image.Alpha is supported.

func (*Face) MaxAdvance

func (f *Face) MaxAdvance() int

MaxAdvance returns the maximum advance width in pixels.

func (*Face) MaxVerticalAdvance

func (f *Face) MaxVerticalAdvance() int

MaxVerticalAdvance returns the maximum advance height (for vertical layout) in pixels.

func (*Face) Metrics

func (f *Face) Metrics(dst *Metrics, ch rune) error

Metrics computes the pixel unit metrics for the glyph.

func (*Face) NumFaces

func (f *Face) NumFaces() int

NumFaces returns the number of faces in the font we loaded from.

func (*Face) Pt

func (f *Face) Pt(pt, dpi int) error

Pt sets character size in points, and resolution in dots-per-inch (typically 72).

func (*Face) Px

func (f *Face) Px(px int) error

Px sets character size in pixels.

type Library

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

Library represents a collection of font face.s

func New

func New() (*Library, error)

New allocates a new Library.

func (*Library) NewFace

func (l *Library) NewFace(data []byte, faceIndex int) (*Face, error)

NewFace creates a new face from the bytes of a font file. If

type Metrics

type Metrics struct {
	Width, Height      int
	HorizontalBearingX int
	HorizontalBearingY int
	AdvanceWidth       int
	VerticalBearingX   int
	VerticalBearingY   int
	AdvanceHeight      int
}

Metrics represents measurements of a glyph in pixels.

Jump to

Keyboard shortcuts

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