Skip to content

Fix character, underline and strikethrough drawing over label boundary for Overflow::CLAMP mode #2515

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

Merged
merged 2 commits into from
Apr 29, 2025

Conversation

rh101
Copy link
Contributor

@rh101 rh101 commented Apr 29, 2025

Describe your changes

Ensure that underline and strike-through lines are clamped correctly when overflow is set to Overflow::CLAMP

This also fixes the issue of characters being drawn over the label boundary when using Overflow::CLAMP.

Label tests 56 and 57 cover this in the cpp-tests project.

Issue ticket number and link

#2513
#2516

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

@rh101 rh101 changed the title Fix underline and strikethrough for Overflow::CLAMP mode Fix character, underline and strikethrough drawing over label boundary for Overflow::CLAMP mode Apr 29, 2025
@halx99 halx99 added this to the 2.6.0 milestone Apr 29, 2025
@aismann
Copy link
Contributor

aismann commented Apr 29, 2025

For backwards compatilibty and "no API change":
bool isHorizontalClamped(float letterPositionX, int lineIndex, float letterWidth = 0);

@rh101
Copy link
Contributor Author

rh101 commented Apr 29, 2025

For backwards compatilibty and "no API change": bool isHorizontalClamped(float letterPositionX, int lineIndex, float letterWidth = 0);

There is no change to the API, since the method is not virtual, and also not part of the public API, so it will not be called outside of Label.

If update it regardless of that, but it really is unnecessary.
Actually, letterWidth cannot be set to 0 as default, since that would not behave as it did previously, so it must remain as-is. There is no API change, so it's a non-issue.

@aismann aismann requested review from aismann and removed request for aismann April 29, 2025 09:44
@halx99 halx99 added the enhancement New feature or request label Apr 29, 2025
@halx99 halx99 merged commit 25af1a1 into axmolengine:dev Apr 29, 2025
15 checks passed
@rh101 rh101 deleted the label-clamp-fix branch April 29, 2025 16:06
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.

3 participants