mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
90e57c2b183acf84d51d3aa0ec17e45afeef23c1
There are many times when an application wants to know metadata about shaped text without allocating a stateful text widget such as widget.Selectable. This commit introduces widget.TextInfo and adds an extra LayoutDetailed method to widget.Label returning this struct. Currently the struct only provides the information necessary to determine whether the text was truncated (useful for deciding whether a tooltip makes sense), but it can be expanded to include text metrics in the future for applications which require those. In the future other text widgets may surface methods of acquiring widget.TextInfos, but the critical gap in the API is that we can't currently determine whether a stateless label was truncated, so I'm starting here. I considered making Label.Layout() always return this, but I didn't want to introduce a breaking API change yet. I have some other thoughts I want to explore about the label API which might trigger breaking changes (moving parameters into fields). Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Gio - https://gioui.org
Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly (experimental).
Installation, examples, documentation
Go to gioui.org.
Issues
File bugs and TODOs through the issue tracker or send an email to ~eliasnaur/gio@todo.sr.ht. For general discussion, use the mailing list: ~eliasnaur/gio@lists.sr.ht.
Contributing
Post discussion to the mailing list and patches to gio-patches. No Sourcehut account is required and you can post without being subscribed.
See the contribution guide for more details.
An official GitHub mirror is available.
Description
Languages
Go
89.6%
C
7%
Java
1.7%
Objective-C
1.6%