Skip to content
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

Label property visible_characters behaving illogically #69456

Closed
Pilvinen opened this issue Dec 1, 2022 · 1 comment
Closed

Label property visible_characters behaving illogically #69456

Pilvinen opened this issue Dec 1, 2022 · 1 comment

Comments

@Pilvinen
Copy link

Pilvinen commented Dec 1, 2022

Godot version

3.5.1.stable.mono.official [6fed1ff]

System information

Linux NVIDIA GLES3

Issue description

Label's visible_characters is not considering space as a visible character.

Perhaps this is a logical fallacy (or someone's idea of a joke), but I just lost 12 hours of time in total, today and yesterday, trying to figure out why my sound wasn't syncing with text being displayed via Tween using Label's visible_characters.

It happened because - say, if a string contains 100 characters counted with someText.Count and now you base your calculations on that to calculate how long your sound effect should be played while Tween interpolates characters via visible_characters ... well, say that text has 30 spaces ... your calculations are now off 30 * durationPerChar simply because Label doesn't consider space to be a "visible character".

I'm saying this is a bug.

While space is a transparent character, it most definitely is not non-visible character - it takes space on the screen.

I can't envision any situation where it would be beneficial to anyone to not consider space to be a character as far as the visible_characters property goes.

As a workaround I switched to RichTextLabel which, logically, does consider space to be a visible character for this same purpose. However this discrepancy in behavior between Label and RichTextLabel has no justification in my mind.

Please consider fixing this - even if it's going to break all projects currently depending on the faulty behavior.

Thank you for your time.

Steps to reproduce

  1. Use Tween's InterpolateProperty to interpolate text in Label from 0 to text.Count using visible_characters property.
  2. Set Tween's duration to something like 5-10 seconds.
  3. Do something else in sync by calculating steps based on text.Count and duration. The more text you interpolate the more obvious the issue becomes (as there are more spaces).
  4. Connect a signal and do something when tween_completed fires.

What happens is - tween_completed does not fire when all the text has been made visible. The more spaces you have the longer it takes after that.

All this results in the calculations being off and you now have to either try to compensate and calculate how many spaces you have in each of your texts or switch to RichTextLabel which behaves correctly.

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Dec 1, 2022

Duplicate of #34775.

Please consider fixing this - even if it's going to break all projects currently depending on the faulty behavior.

While this can be changed in 4.0, we can't make compatibility-breaking changes in 3.x unless they are opt-in.

Perhaps this is a logical fallacy (or someone's idea of a joke)

I have to remind you that we have a Code of Conduct. Please stay constructive.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants