Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

textWidth()

Purpose

Find the width in pixels of a string

Description

Receives a single string argument, returns the width (in pixels) of the given string

Syntax

result = textWidth( text )

Arguments

text text to find the size of

result width of the text at the current textSize

Example

message = "Hello World"
for size = 1 to 200 step 1 loop
    clear()
    textSize( size )
    tw = textWidth( message )
    drawText( ( gWidth() - tw ) / 2, ( gHeight() - size ) / 2, size, white, message )
    update()
repeat

Associated Commands

cursor(), drawText(), ink(), len(), print(), printAt(), stringHash(), textSize(), tHeight(), tWidth()

logo

©2019 FUZE Technologies Ltd. FUZE is a registered trademark of FUZE Technologies Ltd. All rights reserved.

Useful links

  • Fuze Main Site
  • Fuze Arena on Twitter
  • Fuze Arena on Youtube
  • Download Buyer

Contact Information

  • FUZE Technologies Ltd
    15 Clearfields Farm
    Wotton Underwood
    Aylesbury, Buckinghamshire
    ​England, HP18 0RS

  • +44 (0) 1844 239 432

  • contact@fuze.co.uk

© Copyright FUZE Technologies Ltd. All rights reserved.