Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>gettextmetrics()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GetTextMetrics()
Get the metrics for the current font
------------------------------------------------------------------------------

Syntax
GetTextMetrics( <hDC>, @ <aTextMetric> )   -->   lSuccess

Arguments
<hDC> specifies the device context for a window.

<aTextMetric> is a parameter passed by reference, which is set
to an array containing the metrics (characteristics) of the
current font.  This array will have 20 elements.  (The purpose
of each element is indicated by the TM_* values defined in
TEXTMETR.CH.)

Returns
If successful, logical TRUE (.T.) is returned, otherwise FALSE
(.F.) is returned.

Description
This function can be used to find in-depth information about
the current font, and is provided both as source
(TEXTMETR.PRG), and in the Clip-4-Win library.  (The source is
provided as an example of the CallDLL() function.)  The
details of fonts are too complex to describe in full in this
release of Clip-4-Win, but some of the more important members
are:

Name                Meaning

TM_AveCharWidth     the average width of characters in the font

TM_Weight           the weight ("thickness") of the font
                    (one of the FW_* values defined in FONT.CH)

TM_Italic           non-zero if an italic font

TM_Underlined       non-zero if an underlined font

TM_StruckOut        non-zero if a struck-out font

TM_PitchAndFamily   a combination of the TMPF_* values defined in
                    TEXTMETR.CH and the FF_* values in FONT.CH

TM_CharSet          one of the *_CHARSET values defined in FONT.CH

Example
if GetTextMetrics( hDC, @aTM )
     // ok, so aTM is an array of info
     nAveCharWidth = aTM[TM_AveCharWidth]
     nCharSet = aTM[TM_CharSet]
endif


See Also: ChooseFont() CreateFont()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson