Skip to content

raylib.MeasureText

JoeStrout edited this page Apr 29, 2026 · 3 revisions

Measure string width for default font

Parameters

Parameter Default Value Note
text
fontSize 20

Return value

Condition Return Value
(always) number

Notes

Example

// Centre text horizontally on a 800-pixel-wide window
screenW = 800
msg = "Game Over"
w = raylib.MeasureText(msg, 40)
raylib.DrawText(msg,  screenW - w) / 2, 300, 40, raylib.RED

Clone this wiki locally