CanvasItemDrawString Method |
Draws text using the specified font at the position (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If clip_w is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
Example using the default project font:
# If using this method in a script that redraws constantly, move the # `default_font` declaration to a member variable assigned in `_ready()` # so the Control is only created once. var default_font = Control.new().get_font("font") draw_string(default_font, Vector2(64, 64), "Hello world")
See also Draw(RID, Vector2, String, NullableColor, Int32, NullableColor).
Namespace: Godot
public void DrawString( Font font, Vector2 position, string text, Color? modulate = null, int clipW = -1 )
[Missing <param name="font"/> documentation for "M:Godot.CanvasItem.DrawString(Godot.Font,Godot.Vector2,System.String,System.Nullable{Godot.Color},System.Int32)"]
[Missing <param name="position"/> documentation for "M:Godot.CanvasItem.DrawString(Godot.Font,Godot.Vector2,System.String,System.Nullable{Godot.Color},System.Int32)"]
[Missing <param name="text"/> documentation for "M:Godot.CanvasItem.DrawString(Godot.Font,Godot.Vector2,System.String,System.Nullable{Godot.Color},System.Int32)"]
[Missing <param name="clipW"/> documentation for "M:Godot.CanvasItem.DrawString(Godot.Font,Godot.Vector2,System.String,System.Nullable{Godot.Color},System.Int32)"]