DQBlen
FUNCTION

Prototype

DECLARE FUNCTION DQBlen (Text AS STRING)

Parameters

Text - Text string to retrieve the length of

Returns

An INTEGER holding the length in pixels of the given string, assuming the current font characters length

Description

Like LEN, DQBlen returns the length of a specified string, but in pixel units. As DirectQB supports non-fixed sized fonts, this function is useful to retrieve the length of a string in pixels, calculated using the length of the characters of the current font.

Notes:

none

Example

*****************************************************************************

' All integers for speed
DEFINT A-Z

'$INCLUDE:'DIRECTQB.BI'

' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END

DQBinitVGA

Length = DQBlen("The length of this string is:")
DQBprint VIDEO, "The length of this string is:" + STR$(Length) + " pixels", 0, 0, 31

' Waits for the user to press a key
WHILE INKEY$ = "": WEND

' Ends program
DQBclose

*****************************************************************************