Getting default editor font for draw_string

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

I have a node that I want to draw some text for in the editor.

extends Node2D
func _draw():
    if (get_tree() != null) and get_tree().is_editor_hint():
        draw_string(..., get_pos(), some_text, Color(1, 1, 1))

For draw_string I want to use the default editor font; it wouldn’t make sense to add a Font property to this node and this is only for drawing in the editor. How do I get the default font?

:bust_in_silhouette: Reply From: volzhs
var label =
var font = label.get_font("")
draw_string(font, get_pos(), some_text, Color(1, 1, 1))

Feels kind of hacky to have to create a label first but it does work.

Aaron | 2016-08-23 21:45