FontMetric(), SysMetric()

Everything you ever wanted to know about your fonts and the display subsystem, dredged right out of the heart of the Windows API.

Usage

nResult = FONTMETRIC( nFontAttribute 
                     [, cFontName, nFontSize [, cFontStyle ] ] )
nResult = SYSMETRIC( nScreenAttribute )

Parameter

Value

Meaning

nFontAttribute

Numeric, 1 – 20

An index to the specific attribute of the font you want returned. See the Help file for the list.

cFontName

Character

Name of the font to be examined.

Omitted

Uses the current font in the active window.

nFontSize

Numeric

Size in points of the font to be examined.

Omitted

May only be omitted if cFontName, above, is also omitted. Uses the current font in the active window.

cFontStyle

Character

Font Style—see the Help file for the entire list.

Omitted

If all of the optional parameters are omitted, uses the font style of the active window. If a font name and size are specified, uses the Normal style of the specified font.

nScreenAttribute

Numeric, 1 – 32

Returns information on the screen's measurements.


Use these functions to determine the characteristics of fonts and of the display in order to place your output most precisely. These functions are, for all practical purposes, identical to their Windows API counterparts, FontMetric() and GetSystemMetric(). These functions only deal with pixels, rather than the foxel measurement system available through the ScaleMode property.

Example

WAIT WINDOW "Current screen resolution is " + ;
        LTRIM(STR(SYSMETRIC(1))) + " by " + ;
        LTRIM(STR(SYSMETRIC(2)))
 
? FONTMETRIC(7,"Times New Roman",10,"B") && 17 pixels

See Also

AFont(), FontBold, FontItalic, FontName, FontOutline, FontShadow, FontSize, FontStrikethru, FontUnderline, GetFont(), ScaleMode, TextWidth, TextHeight, TxtWidth(), WFont()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .