immersive-home/app/lib/utils/font_tools.gd

10 lines
346 B
GDScript3
Raw Normal View History

2024-03-17 01:14:31 +02:00
## Returns the size of a Label3D in standard units
2024-04-24 15:00:08 +03:00
static func get_font_size(label: Label3D, chars=null) -> Vector2:
2024-03-15 19:27:03 +02:00
var font = label.font
if font == null:
return Vector2(0, 0)
var size = font.get_string_size(label.text if chars == null else chars, label.horizontal_alignment, label.width, label.font_size) * label.pixel_size
return size