Skip to content

refactor: floatify messages - #6231

Merged
pajlada merged 3 commits into
Chatterino:masterfrom
Nerixyz:refactor/floatify-fonts
May 24, 2025
Merged

pajlada merged 3 commits into
Chatterino:masterfrom
Nerixyz:refactor/floatify-fonts

Conversation

@Nerixyz

@Nerixyz Nerixyz commented May 23, 2025 •

Copy link
Copy Markdown
Contributor

(motivation is in #6230)

This changes the layout to use qreal (essentially a double) instead of int. The reason it's needed here is that when switching the font metrics to use qreal, we can get element-widths that aren't whole integers. The most notable effect is on spaces, because those should now render as desired by the font (we previously truncated them to be on DIP granularity).

One thing to look out for is that now layouting and rendering might be slower because we use floating point arithmetic, however, I still think this is the right approach. We might be able to get away with using integers for the heights of messages, but I'm not sure how much impact that will have.

Fixes #6230.

At least on my PC (clang-cl + LTO), this isn't a huge performance hit in release mode. In debug mode it's a bit slower, but that's to be expected.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

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/messages/layouts/MessageLayoutElement.hpp
@Nerixyz
Nerixyz marked this pull request as ready for review May 24, 2025 09:09
@pajlada
pajlada enabled auto-merge (squash) May 24, 2025 09:33
@pajlada
pajlada merged commit b78e1ed into Chatterino:master May 24, 2025
@Nerixyz
Nerixyz deleted the refactor/floatify-fonts branch May 24, 2025 10:10
babicekmarek pushed a commit to babicekmarek/streamally-chatterino that referenced this pull request Sep 14, 2026
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.

Use QFontMetricsF over QFontMetrics

2 participants