Version: v2.0.0 Latest Latest

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0




This section is empty.


This section is empty.


func SegmentsToPathData

func SegmentsToPathData(segments sfnt.Segments) string

SegmentsToPathData builds the input to an SVG path element's "d" property from the given glyph segments


type FontMetrics

type FontMetrics struct {
	Original pkgfont.Metrics

	Height  float32
	Ascent  float32
	Descent float32
	XHeight float32

FontMetrics describes a number of important sizes for the rendering of a particular font. It wraps the original pkgfont.Metrics struct from which it has been converted.

func CalculateFontMetrics

func CalculateFontMetrics(font *sfnt.Font, fontSize float32) (*FontMetrics, error)

CalculateFontMetrics retrieves the font metrics from the given font and returns them converted to float32

type RenderResult

type RenderResult struct {
	// The paths of the rendered text, as an SVG fragment
	Paths string

	// The width of the rendered text
	Width float32

func RenderStringToSVG

func RenderStringToSVG(font *sfnt.Font, text string, fontSize float32, fillColor string) (*RenderResult, error)

RenderStringToSVG uses the given font to render the given string into SVG paths at the given font size (pixels per em). It returns the SVG path elements that represent the given string, without an enclosing element and the total width of the rendered text.

Source Files

Jump to

Keyboard shortcuts

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