Newsletter, October 2022
Mipmaps and text patches

This month Elias upgraded our handling of image scaling by automatically generating mipmaps for all images. This ensures that images look good when downscaled, and also boosts performance when downscaling images. You don’t need to make any application changes to take advantage of this new feature.

I (Chris) spent the past month entirely focused on font fallback and bidirectional text. It was tricky work, but satisfying, and yesterday I posted the first patchset implementing both font fallback and bidirectional text support. The two features are tightly related, as they both involve enabling lines of text to contain substrings with varying fonts and metadata. Additionally, benchmark results indicate that the majority of text shaping use-cases were made significantly faster by these changes. I’d like to thank Plato Team for supporting the development of these critical text features.

Sponsorship

This month, Gio thanks the following organizations and community members for their ongoing support!

Supporting the whole team:

Supporting a maintainer:

Sponsorship money given to Gio enables Elias and I to cover the costs of running Gio’s infrastructure, to pay for some of our time spent maintaining and improving Gio, and to plan for funding significant feature work. You can support Gio by contributing on OpenCollective or GitHub Sponsors.

core gio

As part of my work on text handling, I dug into widget.Editor and extensively tested its current behaviors, fixing some bugs along the way. Elias enabled mipmapping and ensured that Android devices default to the OpenGL backend like Linux currently does.

Chris Waldon:

  • widget: use reliable text direction checks, not heuristics. This commit switches the way in which the editor and helper functions check for RTL text from a heuristic to using the actual text direction. b46c0f59
  • widget: test firstPos. This commit adds a test to lock in the correct behavior of the firstPos helper method. 1be58a2b
  • widget: define incrementing combinedPos and test. This commit restructures seekPosition from a complex state-manipulating loop into a simple loop of iteratively applying an increment operation to the combinedPos. The increment operation itself is now tested, and much easier to understand. b67b3229
  • widget: test and document clusterIndexFor. This commit adds documentation and tests for the clusterIndexFor helper, making it easier to understand what it does and how to use it safely. 64db3720
  • widget: test positionGreaterOrEqual. This commit adds an exhaustive test case for the positionGreaterOrEqual helper function that our text widgets use to compare locations within shaped text. dee3cc44
  • widget: test and document seekPosition. This commit adds a test for the seekPosition helper, a function which can be used to move a combinedPos forward through a body of text until it approaches a position. 23406645
  • widget: redefine >= and ++ on combinedPos. This commit redefines incrementing a combinedPos to either move a single rune forward, or transition from EOL->BOL, or both. This allows traversal of lines without a trailing newline character to reach the position after the final glyph of content. Fixes #400 f7c14e99
  • widget: adjust editor tests to new pos iteration. This commit fixes the expectations of our ligature iteration tests to match the new behavior of the text position iterator. Now the cursor can reach the position after the final glyph on a line, if that glyph is not a newline. 9f62230c

Elias Naur:

  • app: make OpenGL default on Android. Like commit dbf6429, this change makes the OpenGL backend default for Android. b707b199
  • app: disable OpenGL backend when the noopengl tag is present. The tag noopengl is useful for testing the Vulkan backend which is no longer default. e69ef4f0
  • gpu: implement automatic mipmaps for images. All GPU APIs except OpenGL ES 2 can generate mipmaps for textures. This trades 33% more GPU memory use for improved rendering quality and speed for downscaled images. bebc73db
  • gesture,widget: detect multi-click on pointer.Press. References: #455 5c896eab
  • widget: implement triple click line selection in Editor. Fixes: #455 c67d8cde

Egon Elbre:

  • f32: nicer Affine2D string formatting. dead6e00

gio-x

Users of x have reported an error with ambiguous imports for a while, and this month I learned how to fix it. The problem was that we used to keep gioui.org/x/{notify,haptic,pref,explorer} in separate go modules because they each added significant dependencies. However, after Go 1.17 that wasn’t necessary anymore so we consolidated everything to one module. This left the old modules still existing and available from the go module cache, so that running go get gioui.org/x/notify@latest had two candidates: the notify package in the x module and the old x/notify module. It took some research to discover the correct way to retract every version of a module (thanks Dominik Honnef for the help), but now the old modules are no longer available and go get should succeed for any package in x.

Chris Waldon:

  • richtext: fix interactive span aliasing. This commit fixes a subtle bug that only permitted a single interactive span per richtext.TextStyle. The loop iterating the spans copied the spans as a loop variable and assigned an important piece of tracking metadata only on the copy. This resulted in all interactive spans thinking they were the first, and thus the final span was the only active one. 5b57729
  • notify: retract all old module versions. This commit adds back a temporary go.mod to gioui.org/x/notify in order to retract itself and all older versions. It will be removed in a subsequent commit. Fixes #401 67f8600
  • notify: drop temporary go.{mod,sum}. 55202d2
  • explorer,haptic,pref: add temporary retraction go.mods. This commit retracts all versions of explorer, haptic, and pref that were published as separate modules from gioui.org/x. 75f9807
  • explorer,haptic,pref: drop temporary go.{mod,sum}. d485904