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

Text overrun, (for label and text based nodes others) signal and methods #7937

Open
Rebell10n opened this issue Sep 30, 2023 · 1 comment
Open

Comments

@Rebell10n
Copy link

Rebell10n commented Sep 30, 2023

Describe the project you are working on

Well the part I struggle with is, the text overrun look very bad with my actual police in game. It erase too much characters than it should be in ellipsis mode, like 1 characters goes overrun, erase 3 of them. And just trim doesn't seems enought for me.
So I wanted to include a custom text overrun behavior, made with scripts.
Currently it does work cuz I do that while counting the char and size is fixed...
But the next step require label that will have relatives and unfixed sizes...

Describe the problem or limitation you are having in your project

So to avoid doing that :

if Name_Label.text.length() > 23:
	Name_Label.text = Name_Label.text.substr(0, 22)

I wanted to do something like that :

func _on_text_overrun( trimmed:String ):
	var s = Name_Label.text.length()
	var e = trimmed.length()
	Name_Label.text = Name_Label.text.substr(0, s-e-1)

or simply :

if Name_Label.is_text_overruning():
	var s = Name_Label.text.length()
	var e =Name_Label.text_overrun.length()
	Name_Label.text = Name_Label.text.substr(0, s-e-1)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Adding signals and/or methods relative to detect and get overruning text. Like how I showed before or differently

If this enhancement will not be used often, can it be worked around with a few lines of script?

It probably can, but now with just a "few", more like a lot of code, just to detect if that overrun, and that still be trashy code cuz the only way to detect that for now is to compare how much characters the label contain, and compare with his size, while counting how much each char has which size.
And it's should be available to everyone easily I think.

Is there a reason why this should be core and not an add-on in the asset library?

No idea, I guess because everyone should have access to that easily, but maybe this isn't worth it to have in the core ? You should be the one to tell me that if that case I guess...

@Rebell10n
Copy link
Author

Rebell10n commented Oct 1, 2023

I think fatigue getting you, well I kinda understand since the numbers of issues posted you have to deal with, but I think that not the same topic lol.

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