-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concept frame: truncate overly long titles #126
Conversation
Previously, if the text was too wide to fit in the header we would simply not render any title. This changes the logic to a simplistic attempt to truncate the text to fit, by repeatedly removing the last character and re-measuring the width.
Thanks, that looks like a sensible approach overall 👍 I have mostly two points / questions:
|
Cheaply dealing with long titles nicely is a bit awkward given the limitations of the simple API exposed by the Assuming that you don't want to bring too much font/layout related complexity into this crate, simply clipping the render seems like a cheap and effective approach, if you don't mind not having the ellipsis. |
The ellipsis could be implemented on top of this clipping approach in the case where the text wasn't centred; logic could be added to measure the width of the ellipsis glyph (or just |
I'd agree with this on the principle, but having just tested your PR it appears the buttons are drawn on top of the text but still with their transparent background (when using the default color scheme), so the button images are mixed with the text behind it, rather than overwriting it. BTW, we're currently kind of stuck wrt to andrew, which seems to no longer be maintained. So I'd be open to replacing it with an other crate if there is a nice one available somewhere. |
Hmm, I was testing in mutter nested in X. I'll take a look at this on a real wayland system tomorrow.
Hmm. I have some of that functionality (bitmaps, line drawing, a little bit of avx acceleration for some operations) in https://github.com/wez/wezterm/blob/master/window/src/bitmaps/mod.rs and some much more advanced font shaping stuff for ligatures and emoji in a different layer in that repo. Some of that could be extracted out to be used here if there isn't a compelling alternative. The font stuff is harder because the harfbuzz dep requires some more intrusive build machinery, which seems undesirable in As a slight aside from this PR, but on that topic: I would like to be able to render my own titlebar contents in my application and eliminate the use of font-config and system freetype that is currently pulled in via I think I'd like to see an extension trait for concept frame that allows the embedding application to receive the bitmap slice and state for each UI element and let the application render those for itself. It's getting late here now and I haven't fully thought this out... I'll put some more thought into this in the new few days. |
If that's the thing you want you can do that right now by implementing |
Closing this as since #183 the frame provided by SCTK no longer provides a title writing. This is left for custom implementations of the |
Previously, if the text was too wide to fit in the header we
would simply not render any title.
This changes the logic to a simplistic attempt to truncate the
text to fit, by repeatedly removing the last character and
re-measuring the width.