Skip to content

feat: add optional improved text wrapping#6265

Merged
pajlada merged 10 commits intoChatterino:masterfrom
Nerixyz:feat/better-layout-at-the-cost-of-unholy-private-apis
Jul 20, 2025
Merged

feat: add optional improved text wrapping#6265
pajlada merged 10 commits intoChatterino:masterfrom
Nerixyz:feat/better-layout-at-the-cost-of-unholy-private-apis

Conversation

@Nerixyz
Copy link
Copy Markdown
Contributor

@Nerixyz Nerixyz commented Jun 13, 2025

It's a heartbreaking story, but improving the text wrapping while remaining fairly efficient requires private Qt APIs (#5944). Specifically, I ran into this because Twitch now allows Arabic display names. Those can get longer (e.g. \uFDFD). horizontalAdvanceing on single characters there will yield incorrect widths. Thus, when the channel view is narrow enough for the username to require wrapping, the message text would appear in the wrong position ("Noto Sans" font).

In the linked issue, I already experimented with using QStackTextEngine to do the wrapping. Since it's a private API, I put it behind a configuration option. On Ubuntu we already build Qt, so we control the exact Qt version and can use private APIs.

Copy link
Copy Markdown
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with allowing users enabling this, but I don't want this enabled by default anywhere (even where we're comfortable with it).

If you change it to just the compile flag, I'd be OK merging this.

Copy link
Copy Markdown
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just this thing I'm unsure of what it does, otherwise looks good

Comment thread CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
Comment thread src/controllers/plugins/api/Message.cpp Outdated
@pajlada pajlada enabled auto-merge (squash) July 20, 2025 14:19
@pajlada pajlada merged commit 971c380 into Chatterino:master Jul 20, 2025
19 of 20 checks passed
Nerixyz added a commit to Nerixyz/chatterino2 that referenced this pull request Jul 28, 2025
See the cmake flag `CHATTERINO_ALLOW_PRIVATE_QT_API` for details on how to test this.
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.

2 participants