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

get_wordwrap_string_size always return the max width of a wordwrapped string #55861

Open
gweltou opened this issue Dec 12, 2021 · 0 comments
Open

Comments

@gweltou
Copy link

gweltou commented Dec 12, 2021

Godot version

v3.4.stable.official [206ba70]

System information

Ubuntu 20.04.3 LTS

Issue description

The width value returned by get_wordwrap_string_size is always the same (i.e. the max width the string will be with wordwrapping enabled).

While it may not necessarily be a bug, it makes the function useless in the case you want to know the size of a string smaller than the width value given. (And a returned value that is always the same as a given argument is pretty useless in any case)

The wanted behaviour in this case would be something like :

var s = "abc"
var max_size = 50
var string_size = font.get_string_size(s)
var string_size_wordwrap = font.get_wordwrap_string_size(s, max_size)
var string_size_min =  Vector2(min(string_size.x, string_size_wordwrap.x), string_size_wordwrap.y)

Steps to reproduce

print(font.get_wordwrap_string_size("", 50))
will return a size of (50, 24)

Minimal reproduction project

No response

@gweltou gweltou changed the title get_wordwrap_string_size always return the max width of a string get_wordwrap_string_size always return the max width of a wordwrapped string Dec 12, 2021
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