I found the interplay of List's Layout/init/next/more/end methods
somewhat confusing and hard to reason about, so I refactored them.
Signed-off-by: Larry Clapp <larry@theclapp.org>
Added tests to make sure that opentype.Collection can be used as a
text.Face, and that it correctly implements fallback behavior for
glyph lookups.
Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
This change allows font collection files (extensions .ttc or .otc)
to be used as a text.Face. These files contain an ordered list of
SFNT fonts, each supporting a maximum of 2^16 glyphs. When used as
a text.Face, each rune in the string to layout or render will be
assigned to the first font with a glyph for that rune, or to the
replacement character from the first font in the file otherwise.
With this change, it is possible to support multiple unicode planes
in a single text.Face by using a Collection with more than one
internal SFNT file. For example, it is now possible to display
characters from the basic multilingual plane and emoji in a single
widget.Label by loading an appropriate OTC file.
Fixes gio#104
Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
Implementations of text.Face are reused across multiple windows for efficiency.
Make the opentype implementation safe for concurrent use and document it.
Updates gio#104
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A single EGL display may be shared among several contexts. Don't
eglTerminate a context display when destroying the context.
Updates gio#144
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Larry Clapp reported a panic from failing to start the display link.
Ignore the error and hope the error is transient.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Casting a *XClientMessageEvent or *XSelectionEvent to *XEvent is
technically incorrect because the union XEvent is the larger structure.
Use an XEvent variable as the backing storage for the specialized
event types instead.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This CL implements the app.Main function as a blocking-forever function
for JS, Wayland, Windows and X11.
This works better for applications that can now programmatically close
windows.
The Gio GioAppDelegate created the GioViewController programmatically.
When using gogio's -buildmode=archive users may want to use a different
method (for example storyboards) but there can only be one app delegate.
Move the GioAppDelegate to gogio's exe buildmode, and export the
GioViewController for embedding use.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We'd like to remove GioAppDelegate when Gio is embedded with
gogio's -buildmode=archive. Minimize the code in GioAppDelegate.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It's not used in text shaping, so let's not require it.
Note that the concrete opentype package still retains the Metrics
implementation.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change, Android and iOS were special for two reasons:
app.Main would return immediately, and the program main was invoked from
a goroutine. We can reduce that to one special case by either
- run the program main from the main thread,
- or make app.Main block.
Choose to run main on the main thread.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Fixes a bug due to that f32.Rect.Intersect will not return the
empty rectangle for non intersecting rectangles - but instead
a swapped rectangle. By removing the .Canon() call in gpu.go we
ensure that non overlapping clipping rects and paint rects will
lead to no painting.
The Canon() call is not needed since boundsForTransformedRect()
was previously updated to always return a canonical rectangle.
Test case added.
Signed-off-by: Viktor <viktor.ogeman@gmail.com>
If the Android NDK is not found in a standard location (e.g. you are
on an F-Droid build server), check the $ANDROID_NDK_ROOT environment
variable.
Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
The app.MinSize and app.MaxSize options restricts the window size:
w := app.NewWindow(
app.Size(unit.Dp(600), unit.Dp(596)),
app.MinSize(unit.Dp(600), unit.Dp(596)),
app.MaxSize(unit.Dp(600), unit.Dp(596)),
app.Title(APPNAME),
)
Signed-off-by: Jason <sourcehut@sweatyballs.es>