# GrapeCity.Documents.Text.FontCollection.LoadFonts

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Text_FontCollection_LoadFonts_" data-uid="GrapeCity.Documents.Text.FontCollection.LoadFonts*">LoadFonts Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Text_FontCollection_LoadFonts_" data-uid="GrapeCity.Documents.Text.FontCollection.LoadFonts*"></a>
<h4 id="GrapeCity_Documents_Text_FontCollection_LoadFonts_System_Byte___System_Boolean_" data-uid="GrapeCity.Documents.Text.FontCollection.LoadFonts(System.Byte[],System.Boolean)">LoadFonts(byte[], bool)</h4>
<div class="markdown level1 summary"><p>Loads all fonts from a specified byte array into the collection.</p>
<p>
Use the <a class="xref" href="GrapeCity.Documents.Text.FontCollection.RegisterFont.html#GrapeCity_Documents_Text_FontCollection_RegisterFont_System_String_System_Boolean_">RegisterFont(string, bool)</a> method if there is a font file.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int LoadFonts(byte[] fontData, bool addToFallbacks = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function LoadFonts(fontData As Byte(), Optional addToFallbacks As Boolean = False) As Integer</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.byte">byte</a>[]</td>
      <td><span class="parametername">fontData</span></td>
      <td><p>The byte array with the font data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">addToFallbacks</span></td>
      <td><p>Specifies if all the registered fonts should be added to the fallback font collection.</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.int32">int</a></td>
      <td><p>The number of loaded fonts.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Text_FontCollection_LoadFonts_" data-uid="GrapeCity.Documents.Text.FontCollection.LoadFonts*"></a>
<h4 id="GrapeCity_Documents_Text_FontCollection_LoadFonts_System_IO_Stream_System_Int32_System_Boolean_" data-uid="GrapeCity.Documents.Text.FontCollection.LoadFonts(System.IO.Stream,System.Int32,System.Boolean)">LoadFonts(Stream, int, bool)</h4>
<div class="markdown level1 summary"><p>Loads all fonts from the specified stream into the collection.</p>
<p>
Use the <a class="xref" href="GrapeCity.Documents.Text.FontCollection.RegisterFont.html#GrapeCity_Documents_Text_FontCollection_RegisterFont_System_String_System_Boolean_">RegisterFont(string, bool)</a> method if there is a font file.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int LoadFonts(Stream stream, int bytesToRead = -1, bool addToFallbacks = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function LoadFonts(stream As Stream, Optional bytesToRead As Integer = -1, Optional addToFallbacks As Boolean = False) As Integer</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.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>The stream containing the font data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">bytesToRead</span></td>
      <td><p>The number of bytes to read from the stream; -1 causes reading till the end of stream.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">addToFallbacks</span></td>
      <td><p>Specifies if all the registered fonts should be added to the fallback font collection.</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.int32">int</a></td>
      <td><p>The number of loaded fonts.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
