Before this change, the Editor computed a suitable padding for itself
from its font and text. Varying the padding according to the particular
font and text doesn't seem worth it and interferes with higher level widgets'
ability to overlay hints and the like on top of the editor.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We're about to remove the extra padding from Editor. To do that, the
clipping must account for text drawing that lie outside the viewport.
With accurate clip bounds, use it for Label as well.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
There is now a single shaping implementation, Shaper, for all fonts, replacing
Family that only covered a single typeface.
A typeface is identified by a name, where the empty string denotes the
default typeface.
Font is introduced to specify a particular font from the typeface, style,
weight and size.
Face is changed to an interface for a particular layout and shaping method.
The text/shape package is renamed to text/opentype and contains a Face
implementation based on golang.org/x/image/font/sfnt.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
To prepare for separating drawing from state tracking, refactor
Editor so that only its top level Layout method touches font
parameters and materials.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Instead of adding an implicit ClipOp, return a ClipOp ready to use, freeing the
caller from recording a macro.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The sfnt.Buffer embedded in the opentype type caused instances of
it to escape. Move the buffer to Family to avoid that.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It was easy to forget Family.Reset, and the per-frame caching strategy is
probably too aggressive. Use a static size for the caches and evict
according to a least recently used policy.
Reset is then no longer required, and we can delete it.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Text shaping is a common name for what package measure does. Rename
it to "shape" and move it below the text package.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Packages that provide support for external events such as pointer, key and
system are only the beginning. Future packages are expected for clipboard
access, drag and drop, gps positions and so on.
To keep the number of top-level packages under control, move such I/O packages
to the new `io` directory.
The `system` package name was the previous solution to keeping the number of
top-level packages under control: I named it `system` instead of the narrower
`profile` because I expected to put all the less common events into it, turning
`system` into a "package util" smell.
With `io`, package system can be renamed to `profile`.
Signed-off-by: Elias Naur <mail@eliasnaur.com>