# C1.Util.DX.DirectWrite.FontFace.TryGetFontTable

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_" data-uid="C1.Util.DX.DirectWrite.FontFace.TryGetFontTable*">TryGetFontTable Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_" data-uid="C1.Util.DX.DirectWrite.FontFace.TryGetFontTable*"></a>
<h4 id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_System_Int32_C1_Util_DX_DataPointer__System_IntPtr__" data-uid="C1.Util.DX.DirectWrite.FontFace.TryGetFontTable(System.Int32,C1.Util.DX.DataPointer@,System.IntPtr@)">TryGetFontTable(int, out DataPointer, out IntPtr)</h4>
<div class="markdown level1 summary"><p>Finds the specified OpenType font table if it exists and returns a reference to it. The function accesses the underlying font data through the <span class="xref">C1.Win.DX.DirectWrite.FontFileStream</span> interface implemented by the font file loader.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool TryGetFontTable(int openTypeTableTag, out DataPointer tableData, out IntPtr tableContext)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function TryGetFontTable(openTypeTableTag As Integer, ByRef tableData As DataPointer, ByRef tableContext As IntPtr) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">openTypeTableTag</span></td>
      <td><p>The four-character tag of a OpenType font table to find. Use the DWRITE_MAKE_OPENTYPE_TAG macro to create it as an UINT32. Unlike GDI, it does not support the special TTCF and null tags to access the whole font.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DataPointer.html">DataPointer</a></td>
      <td><span class="parametername">tableData</span></td>
      <td><p>When this method returns, contains the address of  a reference to the base of the table in memory. The reference is valid only as long as the font face used to get the font table still exists; (not any other font face, even if it actually refers to the same physical font).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">tableContext</span></td>
      <td><p>When this method returns, the address of a reference to  the opaque context, which must be freed by calling {{ReleaseFontTable}}. The context actually comes from the lower-level <span class="xref">C1.Win.DX.DirectWrite.FontFileStream</span>, which may be implemented by the application or DWrite itself. It is possible for a NULL tableContext to be returned, especially if the implementation performs direct memory mapping on the whole file. Nevertheless, always release it later, and do not use it as a test for function success. The same table can be queried multiple times, but because each returned context can be different, you must release each context separately.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p>TRUE if the font table exists; otherwise, FALSE.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_System_Int32_C1_Util_DX_DataPointer__System_IntPtr___remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The context for the same tag may be different for each call, so each one must be held and released separately.</p>
</div>


<a id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_" data-uid="C1.Util.DX.DirectWrite.FontFace.TryGetFontTable*"></a>
<h4 id="C1_Util_DX_DirectWrite_FontFace_TryGetFontTable_System_Int32_System_IntPtr_System_Int32__System_IntPtr__" data-uid="C1.Util.DX.DirectWrite.FontFace.TryGetFontTable(System.Int32,System.IntPtr,System.Int32@,System.IntPtr@)">TryGetFontTable(int, IntPtr, out int, out IntPtr)</h4>
<div class="markdown level1 summary"><p>HRESULT IDWriteFontFace::TryGetFontTable([In] unsigned int openTypeTableTag,[Out, Buffer] const void** tableData,[Out] unsigned int* tableSize,[Out] void** tableContext,[Out] BOOL* exists)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool TryGetFontTable(int openTypeTableTag, IntPtr tableData, out int tableSize, out IntPtr tableContext)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function TryGetFontTable(openTypeTableTag As Integer, tableData As IntPtr, ByRef tableSize As Integer, ByRef tableContext As IntPtr) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">openTypeTableTag</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">tableData</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">tableSize</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">tableContext</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
