In preparation for using Shaper with an io.Reader, rework the API to not refer
to strings. In particular, introduce Glyph for holding the rune in addition to
the advance. For fast traversing of the underlying text, add Len to Line with
the UTF8 length.
Layout is a useless wrapper around []Line; remove it while we're
here.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
MacroOp is about to lose the ability to run a different operation list
than the one it was recorded on. Text shape caches rely on that property,
and must use the new CallOp operation added for purpose.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Registering the font as a side effect of importing the gofont package
was too magic. Require an explicit Register call instead. As a side
effect, it is more clear which font is the default (the first one
registered).
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Opentype parsing, layout and shaping will be used by subpackages to package
font. Move the opentype package accordingly.
Remove the Must helper function; programs will no longer use the opentype
package in the normal case.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package font holds a singleton text.Shaper for general use. Subpackages
call Register to add fonts to the registry.
The intention is that programs can add a typeface by importing a package:
import _ "gioui.org/font/gofont"
Signed-off-by: Elias Naur <mail@eliasnaur.com>