Function GetTextWidth

GetTextWidth(text)
The function returns a text width in pixels using current font setting. Example:
sText = "Hello World"
SetFontSize(50)
nScreenCenterX = GetWidth() / 2
nScreenCenterY = GetHeight() / 2
nWidth = GetTextWidth(sText)
nHeight = GetTextHeight(sText)
DrawText(nScreenCenterX -  nWidth / 2, nScreenCenterY - nHeight / 2, sText)
This is how result would look like (red coordinates are just for reference):

See also: