Skip to content

Conversation

@j-jorge
Copy link
Contributor

@j-jorge j-jorge commented Dec 19, 2025

Solves #2927.

I could not find flags for FT_Load_Glyph that would make it significantly faster, so I have just changed the way the font size is computed. Previously ax::Label::alignText would decrease the font size until it found one that fit the text in the label's size. Now it will use a binary search to find this size.

On my app, at launch, the original version spent an accumulated 1.73 s. in ax::Label::alignText, with this patch it spends 0.82 s. Both averaged on 10 runs, release builds running on a Pixel 3a.

I've checked this patch in all tests of the Label entry in cpp-tests.

@j-jorge j-jorge changed the title Skip font rendering until the placement respects the overflow constraints on the labels. Use binary search to find fitting font size for labels shrinking on overflow. Dec 20, 2025
@j-jorge j-jorge marked this pull request as ready for review December 20, 2025 21:02
@halx99 halx99 added this to the 2.11.1 milestone Dec 21, 2025
@halx99 halx99 merged commit 9df3592 into axmolengine:release/2.x Dec 21, 2025
17 checks passed
@halx99 halx99 added the enhancement New feature or request label Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants