You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
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 :
Steps to reproduce
print(font.get_wordwrap_string_size("", 50))
will return a size of
(50, 24)
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: