Visible to Intel only — GUID: GUID-639543F2-FADC-4EEC-9A5A-1C618A10B1E0
Visible to Intel only — GUID: GUID-639543F2-FADC-4EEC-9A5A-1C618A10B1E0
GETGTEXTEXTENT
Graphics Function: Returns the width in pixels that would be required to print a given string of text (including any trailing blanks) with OUTGTEXT using the current font. This routine is only available for Windows.
Module
USE IFQWIN
result = GETGTEXTEXTENT (text)
text |
(Input) Character*(*). Text to be analyzed. |
Results
The result type is INTEGER(2). The result is the width of text in pixels if successful; otherwise, -1 (for example, if fonts have not been initialized with INITIALIZEFONTS).
This function is useful for determining the size of text that uses proportionally spaced fonts. You must initialize fonts with INITIALIZEFONTS before calling any font-related function, including GETGTEXTEXTENT.
Example
! Build as QuickWin or Standard Graphics
USE IFQWIN
INTEGER(2) status, pwidth
CHARACTER(80) text
status= INITIALIZEFONTS( )
status= SETFONT('t''Arial''h22w10')
pwidth= GETGTEXTEXTENT('How many pixels wide is this?')
WRITE(*,*) pwidth
END