> For the complete documentation index, see [llms.txt](https://pinvokeisalive.gitbook.io/pinvoke/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinvokeisalive.gitbook.io/pinvoke/desktopfunctions/gdi32/getoutlinetextmetrics.md).

# GetOutlineTextMetrics

### C# Signature:

```cs
[DllImport("gdi32.dll")]
static extern uint GetOutlineTextMetrics(IntPtr hdc, uint cbData, IntPtr ptrZero);
```

### Sample Code:

```cs
private static void GetOutlineMetrics(IntPtr hdc)
{
    uint cbBuffer = GetOutlineTextMetrics(hdc, 0, IntPtr.Zero);
    if (cbBuffer == 0)
        return;
    IntPtr buffer = Marshal.AllocHGlobal((int)cbBuffer);
      try
    {
        if (GetOutlineTextMetrics(hdc, cbBuffer, buffer) != 0)
        {
            OUTLINETEXTMETRIC otm = new OUTLINETEXTMETRIC();
            otm = (OUTLINETEXTMETRIC)Marshal.PtrToStructure(buffer, typeof(OUTLINETEXTMETRIC));
            string otmpFamilyName = Marshal.PtrToStringAnsi(new IntPtr((int)buffer + otm.otmpFamilyName));
            string otmpFaceName = Marshal.PtrToStringAnsi(new IntPtr((int)buffer + otm.otmpFaceName));;
            string otmpStyleName = Marshal.PtrToStringAnsi(new IntPtr((int)buffer + otm.otmpStyleName));;
            string otmpFullName = Marshal.PtrToStringAnsi(new IntPtr((int)buffer + otm.otmpFullName));;
        }
    }
    finally
    {
        Marshal.FreeHGlobal(buffer);
    }
}
```
