Skip to content

Clip and ellipsize GTK labels#4451

Draft
johnzhou721 wants to merge 2 commits into
beeware:mainfrom
johnzhou721:labelfix
Draft

Clip and ellipsize GTK labels#4451
johnzhou721 wants to merge 2 commits into
beeware:mainfrom
johnzhou721:labelfix

Conversation

@johnzhou721
Copy link
Copy Markdown
Contributor

Fixes #3780.

GTK labels are not clipped to their bounds; there is a native ellipsize option on the widget we should enable to automatically put ellipsis at the end of the text if necessary. Enabling this changes the way we use native functions to rehint, and the rehint code is modified accordingly.

We should still clip the widget to bounds, however, because the user may set a very very tiny label that can't even fit a single ellipsis, but still we have to clip the label properly to avoid overflow.

A drive-by fix to the example app involves bumping the width for the button box, as the buttons were hinted to >120px wide and was overlapping with the text.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

johnzhou721 and others added 2 commits June 5, 2026 17:52
Fixes beeware#3780.

GTK labels are not clipped to their bounds; there is a native
ellipsize option on the widget we should enable to automatically
put ellipsis at the end of the text if necessary.  Enabling this
changes the way we use native functions to rehint, and the rehint
code is modified accordingly.

We should still clip the widget to bounds, however, because the user
may set a very very tiny label that can't even fit a single ellipsis,
but still we have to clip the label properly to avoid overflow.

A drive-by fix to the example app involves bumping the width for
the button box, as the buttons were hinted to >120px wide and was
overlapping with the text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pack style engine width not correct size on linux?

1 participant