Getting a label node's font

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Remixful
:warning: Old Version Published before Godot 3 was released.

I imported a font and put it as the “Custom Font” property for one of the Label nodes in the scene.


How do I retrieve the current “Custom Font” that this Label is using with GDScript?
For example, I want to use the Font classes’ get_string_size function. I’m aware that the Control class has a get_font function but there’s no description or any documentation on how to use it correctly.

Any help would be much appreciated!

- Remixful

:bust_in_silhouette: Reply From: volzhs

You can see what string you need to use for get_font when mouse over

var font = get_node("Label").get_font("font")
var size = font.get_string_size("asdf")