Using Win32 functions in Visual FoxPro Image Gallery
Font and Text
..msdn
CreateFont
DrawText
GetCharABCWidths
GetTextAlign
GetTextCharacterExtra
GetTextColor
GetTextExtentPoint32
GetTextFace
GetTextMetrics
SetTextAlign
SetTextCharacterExtra
SetTextColor
TextOut
Code examples:
Reading metrics for the currently selected font
GetTextMetrics
..msdn    Add comment     W32 Constants      Translate this page
The GetTextMetrics function fills the specified buffer with the metrics for the currently selected font.
Code examples:
Reading metrics for the currently selected font
Declaration:
BOOL GetTextMetrics(
    HDC hdc,            // handle to DC
    LPTEXTMETRIC lptm   // text metrics
);
FoxPro declaration:
DECLARE INTEGER GetTextMetrics IN gdi32;
    INTEGER   hdc,;
    STRING  @ lptm
Parameters:
hdc
[in] Handle to the device context.

lptm
[out] Pointer to the TEXTMETRIC structure that receives the text metrics.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
hWindow = _screen.HWnd
hDC = GetWindowDC(hWindow)

cBuffer = REPLICATE(CHR(0), 250)
= GetTextMetrics(hDC, @cBuffer)

* weight of the font:
? buf2dword(SUBSTR(cBuffer, 29,4))

= ReleaseDC(hWindow, hDC)

My comment:
The TEXTMETRIC structure is filled in GetTextMetrics call:
typedef struct tagTEXTMETRIC {
        LONG tmHeight;
        LONG tmAscent;
        LONG tmDescent;
        LONG tmInternalLeading;
        LONG tmExternalLeading;
        LONG tmAveCharWidth;
        LONG tmMaxCharWidth;
        LONG tmWeight;
        LONG tmOverhang;
        LONG tmDigitizedAspectX;
        LONG tmDigitizedAspectY;
        TCHAR tmFirstChar;
        TCHAR tmLastChar;
        TCHAR tmDefaultChar;
        TCHAR tmBreakChar;
        BYTE tmItalic;
        BYTE tmUnderlined;
        BYTE tmStruckOut;
        BYTE tmPitchAndFamily;
        BYTE tmCharSet;
} TEXTMETRIC, *PTEXTMETRIC;
Word Index links for the GetTextMetrics :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2002-11-02 14:21:53
Modified: 2007-06-11 16:06:11
Visited in last 7 days: 20
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.166.199.178)
11 sec.Function: 'WindowProc'
25 sec.Function: 'DrawMenuBar'
38 sec.Function: 'SQLRowCount'
49 sec.Function: 'GetBinaryType'
1.02 min.Function: 'GetSysColorBrush'
1.23 min.Function: 'LoadImage'
1.45 min.Function: 'StrFromTimeInterval'
1.65 min.Function: 'GetSystemRegistryQuota'
1.85 min.Function: 'StrCpy'
2.03 min.Function: 'ExtractAssociatedIcon'
Google
Advertise here!