Systems that only support ES 2 are unlikely to have the required
extensions available. But we'll get a better exit error in that case.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
By returning the allocated data buffer, Ops can become an interface
in a future change without forcing operations to allocate.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With public ImageOp fields there was no way to mark an image.Image as modified.
Replace them with NewImageOp that always make a copy, and use the opportunity
to ensure the copy is ready to upload to a GPU texture.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package app is the only package that depends on native libraries and
Cgo. Minimize its API, thereby minimizing Gio clients' dependency on
it. In the future, a headless, testing or remote "Window" should be
very easy to replace app.Window.
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>
Before this change, the default font was the one registered with an empty
Typeface.
We're about to use the correct names for fonts, so change Shaper to
fallback to the first registered typeface instead.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It wasn't used, and it's not clear that it is useful at all in its current
form. For example, a single control with multiple handler keys (say, one for
scrolling and one for clicking) will only receive priority Foremost for one of
them.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
THe single-stepping Event was done so that SubmitEvents didn't have to
copy the text out if it wasn't needed.
This is a dubious optimization, because SubmitEvents are only generated
when Editor.Submit is true, in which case it is highly likely the user
wants the text.
Furthermore, I expect Editors with Submit enabled to be relatively short,
in the order of a message field in a chat program.
Finally, Editor will need support for undo at some point. Supporting undo
means we can support a lightweight SubmitEvent that points to an older Editor
state.
All in all (1) we gain a simpler Events method, and (2) we can allow the user
to call it before or after Editor.Layout. Before this change any the events were
gone after Layout was called.
Signed-off-by: Elias Naur <mail@eliasnaur.com>