Group: Font and Text - Library: gdi32
The GetTextMetrics function fills the specified buffer with the metrics for the currently selected font.
Reading metrics for the currently selected font
BOOL GetTextMetrics(
HDC hdc, // handle to DC
LPTEXTMETRIC lptm // text metrics
);
DECLARE INTEGER GetTextMetrics IN gdi32;
INTEGER hdc,;
STRING @ lptm
hdc [in] Handle to the device context.
lptm [out] Pointer to the TEXTMETRIC structure that receives the text metrics.
If the function succeeds, the return value is nonzero.
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;