Low-level text management


gioui.org/font contains the central registry for fonts. This helps to reduce passing fonts around throughout the program.

There is one font bundled in package gioui.org/font/gofont, you can use gofont.Register() to register it to the global registry.

For loading other fonts there is gioui.org/font/opentype. After parsing the font(s) using opentype.Parse or opentype.ParseCollection they can be registered with font.Register.


For converting strings to clip shapes there is the gioui.org/text package.

It contains text.Cache that implements cached string to shape conversion, with appropriate fallbacks.

In most cases you can use widget.Label which handles wrapping and layout constraints. Or when you are using material design material.LabelStyle.