Text and Textures
Drawing labels and images.
These calls draw a label or an image the way the shape calls draw a shape:
from _process, in draw order, with the current color, transform and
viewport, for one frame. For text or images that stay on screen, use Godot’s
Label, Label3D or Sprite2D.
Text
text_2d(position, text) draws a string on the canvas, with the left end of
its baseline at position. text(world_position, text) takes a 3D position
and draws the label on the canvas, over everything in 3D. Both have a _colored form as well.
font and font_size are draw state. An empty font uses the engine’s
fallback. text_size(text) measures a string at the current font and size
without drawing it.
Textures
texture_2d(center, size, texture) draws an image into a rectangle, tinted by
color. size is measured in size_space. texture(center, size, texture)
in 3D.
Draw Calls
Consecutively drawn labels share a draw call.
Textured rectangles share a draw call only if they use the same texture.