GetOutlineTextMetricsA function (wingdi.h)

The GetOutlineTextMetrics function retrieves text metrics for TrueType fonts.


UINT GetOutlineTextMetricsA(
  [in]            HDC                  hdc,
  [in]            UINT                 cjCopy,
  [out, optional] LPOUTLINETEXTMETRICA potm


[in] hdc

A handle to the device context.

[in] cjCopy

The size, in bytes, of the array that receives the text metrics.

[out, optional] potm

A pointer to an OUTLINETEXTMETRIC structure. If this parameter is NULL, the function returns the size of the buffer required for the retrieved metric data.

Return value

If the function succeeds, the return value is nonzero or the size of the required buffer.

If the function fails, the return value is zero.


The OUTLINETEXTMETRIC structure contains most of the text metric information provided for TrueType fonts (including a TEXTMETRIC structure). The sizes returned in OUTLINETEXTMETRIC are in logical units; they depend on the current mapping mode.


The wingdi.h header defines GetOutlineTextMetrics as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Font and Text Functions

Fonts and Text Overview