Version: v0.2.2 Latest Latest

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 2 Imported by: 0



Package metrics provides font metrics.



This section is empty.


This section is empty.


func CharWidth

func CharWidth(fontName string, c int) int

CharWidth returns the character width for a char and font in glyph space units.

func FontBoundingBox

func FontBoundingBox(fontName string) *types.Rectangle

FontBoundingBox returns the font bounding box for a given font as specified in the corresponding AFM file.

func FontNames

func FontNames() []string

FontNames returns the list of supported font names.

func FontSize

func FontSize(text, fontName string, width float64) int

FontSize returns the needed font size (aka. font scaling factor) in points for rendering a given text string using a given font name with a given user space width.

func TextWidth

func TextWidth(text, fontName string, fontSize int) float64

TextWidth represents the width in user space units for a given text string, font name and font size.

func UserSpaceFontBBox

func UserSpaceFontBBox(fontName string, fontSize int) *types.Rectangle

UserSpaceFontBBox returns the font box for given font name and font size in user space coordinates.


This section is empty.

Source Files


Path Synopsis
Package standard provides font metrics for Adobe standard fonts.
Package standard provides font metrics for Adobe standard fonts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL