svgtext

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ceil

func Ceil(w float64) int

Ceil rounds a measured width up to whole user units, so layout derived from it can never land a fraction of a pixel short.

func MaxInt

func MaxInt(values ...int) int

func TruncRunes

func TruncRunes(s string, n int) string

TruncRunes shortens s to at most n runes, marking the cut. It counts runes, never bytes: a byte slice through "—" emits invalid UTF-8.

func Width

func Width(s string, size float64, bold bool) float64

Width is the drawn width of s at the given font size, in user units.

func Wrap

func Wrap(s string, maxW float64, size float64, bold bool) (lines []string, widest float64)

Wrap breaks s into lines no wider than maxW, splitting on spaces. A single word wider than maxW gets its own line rather than being cut: the canvas grows for it instead. It also returns the widest line it produced, which can exceed maxW: a single word longer than the limit has nowhere to break, so the caller has to widen its canvas rather than let SVG clip the overhang.

Types

This section is empty.

Jump to

Keyboard shortcuts

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