Skip to content

Conversation

@rh101
Copy link
Contributor

@rh101 rh101 commented Jun 11, 2025

Describe your changes

This PR is an attempt to address several issues:

  1. Incorrect text wrapping in the middle of words even when _lineBreakWithoutSpaces is false
  2. Incorrect text wrapping when shrink should be used
  3. Missing character at the end of text line depending on alignment
  4. Label doing a forced content recalculation every loop when no content or dimensions have changed, and when certain text, dimensions and overflow settings are used.

I've tested as much as I've been able to, including the tests in cpp-tests, but it would be good if these changes are tested by others on their projects to see if there are any issues.

Label test vertical slider flipped the opposite direction so that 0% is down the bottom and 100% is up the top.

Issue ticket number and link

#2503

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.

@halx99 halx99 linked an issue Jun 11, 2025 that may be closed by this pull request
@halx99 halx99 added the enhancement New feature or request label Jun 11, 2025
@halx99 halx99 added this to the 2.7.0 milestone Jun 11, 2025
@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

In some cases (always disable wrap) the text is not shown or write over the border:

Left: (Draw over the border)
image
Center (correct)
image
Right (no label shown)
image

@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

In some cases (always disable wrap) the text is not shown or write over the border:

Thanks for testing that. I'll look into it.

@rh101 rh101 marked this pull request as draft June 11, 2025 15:01
@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

@aismann How did you get the bounding box to appear just around that section, and not all labels? Which debug config option is it?

Also, for the right alignment, I can't reproduce the issue. Can you explain step by step how you got that result where not text is displayed?

@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

I tested using the build / win32
That's the release version of the PR build.
Set Right
Disable the "Enable Wrap" and than I moved only the slider below very slow to the right direction.
And than its happening.

The center alignment is also not correct in the screenshot you provided, since they're also over the boundary of the label.

But it can be the boundary box is not drawing correct (never checked)

@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

Both Win32/x64 debug and release versions end with the same result:

LabelTest60

(Used Screen2Gif to capture it)

@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

@aismann Is it still happening with the latest commit?

@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

@aismann Is it still happening with the latest commit?

Yes. Slider have to move slower and then you get the same behavior as I saw

@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

@aismann Is it still happening with the latest commit?

Yes. Slider have to move slower and then you get the same behavior as I saw

The slider starts at 52 out of 100 by default. Increasing it 1 at a time is still not showing what you're seeing. Is your cpp-tests modified in some way?
LabelTest60b

@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

Animation
I used cpp-test from PR build:
Artifact download URL: https://github.com/axmolengine/axmol/actions/runs/15588824234/artifacts/3306811427

@rh101
I dont us the sprite debug => you have a bonding box on all "objects"

@rh101
Copy link
Contributor Author

rh101 commented Jun 11, 2025

I used cpp-test from PR build: Artifact download URL: https://github.com/axmolengine/axmol/actions/runs/15588824234/artifacts/3306811427

I downloaded that and ran it, and still cannot reproduce the issue. The dimensions of the label should not affect its visibility in this case, since they're still valid.

Are you able to test the current dev branch without this PR to see if it happens as well?

@rh101 I dont us the sprite debug => you have a bonding box on all "objects"

Thanks, I realized that earlier, since I had the debugging mode enabled the whole time, and forgot that the default tests also draw a bounding box.

@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

Yes and I got also "the missing last character" which is fixed in your PR
image

@aismann
Copy link
Contributor

aismann commented Jun 11, 2025

Maybe some hardware settings?

I/[2025-06-11 19:28:13.205][PID:46c4][TID:4f34]
{
        axmol.build_type: RELEASE
        axmol.testcpp.autorun: false
        supports_OES_depth24: true
        max_texture_size: 16384
        axmol.texture.pvrv2_has_alpha_premultiplied: false
        supports_BGRA8888: false
        supports_ETC1: false
        max_vertex_attributes: 16
        supports_vertex_array_object: false
        axmol.3d.animate_quality: 2
        axmol.3d.max_spot_light_in_shader: 1
        max_texture_units: 32
        supports_discard_framebuffer: true
        supports_S3TC: false
        version: OpenGL ES 3.0.0 (ANGLE 2.1.21145 git hash: dfa3a3070f78)
        axmol.3d.max_point_light_in_shader: 1
        supports_OES_map_buffer: true
        supports_OES_packed_depth_stencil: true
        axmol.compiled_with_profiler: false
        renderer: ANGLE (NVIDIA, NVIDIA Quadro P2200 Direct3D11 vs_5_0 ps_5_0, D3D11-31.0.15.5309)
        supports_ASTC: false
        axmol.gl.projection: 3d
        glsl: OpenGL ES GLSL ES 3.00 (ANGLE 2.1.21145 git hash: dfa3a3070f78)
        max_samples_allowed: 0
        axmol.version: axmol-2.4.0-05c5fb4
        supports_ETC2: true
        vendor: Google Inc. (NVIDIA)
        axmol.texture.pixel_format_for_png: rgba8888
        supports_NPOT: true
        supports_ATITC: false
        axmol.fps: 60
        supports_PVRTC: false
        axmol.compiled_with_gl_state_cache: true
        axmol.3d.max_dir_light_in_shader: 1
        axmol.simd: SSE41
        axmol.display_fps: true
}

@halx99
Is there a missing update on the win32 build?
I got axmol.version: axmol-2.4.0-05c5fb4 (string not updated)?

@halx99
Copy link
Collaborator

halx99 commented Jun 12, 2025

Maybe some hardware settings?

I/[2025-06-11 19:28:13.205][PID:46c4][TID:4f34]
{
        axmol.build_type: RELEASE
        axmol.testcpp.autorun: false
        supports_OES_depth24: true
        max_texture_size: 16384
        axmol.texture.pvrv2_has_alpha_premultiplied: false
        supports_BGRA8888: false
        supports_ETC1: false
        max_vertex_attributes: 16
        supports_vertex_array_object: false
        axmol.3d.animate_quality: 2
        axmol.3d.max_spot_light_in_shader: 1
        max_texture_units: 32
        supports_discard_framebuffer: true
        supports_S3TC: false
        version: OpenGL ES 3.0.0 (ANGLE 2.1.21145 git hash: dfa3a3070f78)
        axmol.3d.max_point_light_in_shader: 1
        supports_OES_map_buffer: true
        supports_OES_packed_depth_stencil: true
        axmol.compiled_with_profiler: false
        renderer: ANGLE (NVIDIA, NVIDIA Quadro P2200 Direct3D11 vs_5_0 ps_5_0, D3D11-31.0.15.5309)
        supports_ASTC: false
        axmol.gl.projection: 3d
        glsl: OpenGL ES GLSL ES 3.00 (ANGLE 2.1.21145 git hash: dfa3a3070f78)
        max_samples_allowed: 0
        axmol.version: axmol-2.4.0-05c5fb4
        supports_ETC2: true
        vendor: Google Inc. (NVIDIA)
        axmol.texture.pixel_format_for_png: rgba8888
        supports_NPOT: true
        supports_ATITC: false
        axmol.fps: 60
        supports_PVRTC: false
        axmol.compiled_with_gl_state_cache: true
        axmol.3d.max_dir_light_in_shader: 1
        axmol.simd: SSE41
        axmol.display_fps: true
}

@halx99 Is there a missing update on the win32 build? I got axmol.version: axmol-2.4.0-05c5fb4 (string not updated)?

Try delete core/axmolver.h, then regenerate cmake

@rh101
Copy link
Contributor Author

rh101 commented Jun 12, 2025

Yes and I got also "the missing last character" which is fixed in your PR

Thank you for testing that. This PR will stay in draft mode until I can figure out what is causing that issue.

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

Try delete core/axmolver.h, then regenerate cmake

@halx99
On my own build its correct.
Its your build/check process. I used the executable from generated win32 build (cpp-test from PR build):
https://github.com/axmolengine/axmol/actions/runs/15588824234/artifacts/3306811427

Improve method names
@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

@rh101
Tested on Android Phone. Works correct!
Its only my PC (GraCard?) which has this "issue".

@rh101
Copy link
Contributor Author

rh101 commented Jun 12, 2025

@rh101 Tested on Android Phone. Works correct! Its only my PC (GraCard?) which has this "issue".

I tested it on Android as well, and it's working perfectly, and I still cannot reproduce the issue on my own Windows 10 PC, so I'm still looking into all possible reason why it may happen when running on your PC.

There is a clamping issue that I need to fix, so I'll commit more changes soon.

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

... so I'll commit more changes soon.

Plz show the slider value also on the screen.
So I can get the value(s) which has the trouble.

And the font size maybe also.
And the position of the font

@rh101
Copy link
Contributor Author

rh101 commented Jun 12, 2025

Plz show the slider value also on the screen. So I can get the value(s) which has the trouble.

And the font size maybe also. And the position of the font

Both implemented, so if and when you have some time, please test out the latest builds.

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

Tested. Works as exepected now.
Thanks for PR. Good job as always.

Can be merged now.

Short info:
The amol version looks better now:
axmol.version: axmol-2.6.1-59c544c

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

@rh101
class ax::Label rendering is faster now, right?

@rh101
Copy link
Contributor Author

rh101 commented Jun 12, 2025

Tested. Works as exepected now.

Excellent! I'm fixing one last issue that I noticed when I tested this on MacOS, which is related to the stroke support on the text. It's not visible in Windows since it's not supported on that platform, which is why I didn't see it (log calls have Stroke Currently only supported on iOS and Android!). EDIT: Stroke is not supported on MacOS either, and it was misleading me since it showed an outline in the test 63:System Font Test on MacOS, but the behavior hasn't changed between original and PR versions, so not something related to this PR.

Anyhow, once that is done, then this PR should be good to go, unless anyone finds any other issues that I may have missed.

@rh101 class ax::Label rendering is faster now, right?

Possibly, but I'm not sure. It definitely doesn't keep updating the content every loop when there are no changes, so at least it won't use resources for no reason.

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

@rh101
I got this debug infos:

image

Only a hold in mind:
setAdditionalKerning => has maybe "problems" if using LabelType::STRING_TEXTURE Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE`

@rh101 rh101 marked this pull request as ready for review June 12, 2025 10:53
@halx99
Copy link
Collaborator

halx99 commented Jun 12, 2025

Try delete core/axmolver.h, then regenerate cmake

@halx99 On my own build its correct. Its your build/check process. I used the executable from generated win32 build (cpp-test from PR build): https://github.com/axmolengine/axmol/actions/runs/15588824234/artifacts/3306811427

I checked, it's also correct:

image

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

I played a little bit around with the RelWithDebInfo/cpp-tests.exe:
Artifact download URL: https://github.com/axmolengine/axmol/actions/runs/15608576508/artifacts/3313570068

It crashed pressing 13. Bugs

axmol.version: axmol-2.6.1-59c544c
=> is also crashing

Try with the 2.6.1 release: axmol.version: axmol-2.6.1-f4855f6
=>Works

@rh101, @halx99
Plz can you check it too?

@aismann
Copy link
Contributor

aismann commented Jun 12, 2025

@rh101 @halx99
I found the mistake:
It was my Clipper2 1.5.4 PR
I tested on Bug350 and upload this played around source also with the clipper PR.
Sorry!

@halx99 halx99 merged commit d86e579 into axmolengine:dev Jun 16, 2025
50 of 57 checks passed
@rh101 rh101 deleted the label-fix branch June 16, 2025 15: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.

Odd behavior with label overflow setting: Label::Overflow::SHRINK

3 participants