# GrapeCity.ActiveReports.Document.SectionDocument.FontResolver

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_Document_SectionDocument_FontResolver_" data-uid="GrapeCity.ActiveReports.Document.SectionDocument.FontResolver*">FontResolver Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Document_SectionDocument_FontResolver_" data-uid="GrapeCity.ActiveReports.Document.SectionDocument.FontResolver*"></a>
<h4 id="GrapeCity_ActiveReports_Document_SectionDocument_FontResolver" data-uid="GrapeCity.ActiveReports.Document.SectionDocument.FontResolver">FontResolver</h4>
<div class="markdown level1 summary"><p>Gets or sets a value representing the implementation of the resolution of the font resources required to render a document in the <a class="xref" href="GrapeCity.ActiveReports.Document.CompatibilityModes.html#GrapeCity_ActiveReports_Document_CompatibilityModes_CrossPlatform">CrossPlatform</a> compatibility mode.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[Browsable(false)]
[CLSCompliant(false)]
public IFontResolver FontResolver { get; set; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</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="GrapeCity.ActiveReports.IFontResolver.html">IFontResolver</a></td>
      <td><p>An object that implements <a class="xref" href="GrapeCity.ActiveReports.IFontResolver.html">IFontResolver</a>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Document_SectionDocument_FontResolver_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>A value of <b>null</b> indicates  that the default resolver is used.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Document_SectionDocument_FontResolver_examples">Examples</h5>
<p>Custom font resolver implementation</p>
<pre><code class="lang-csharp">public sealed class CustomFontResolver : GrapeCity.ActiveReports.IFontResolver
{
    static readonly GrapeCity.Documents.Text.FontCollection _fonts = new GrapeCity.Documents.Text.FontCollection();
    static CustomFontResolver()
    {
        _fonts.RegisterDirectory(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts));
        _fonts.RegisterDirectory(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft/Windows/Fonts"));
        // required reference to DS.Documents.Imaging.Windows
        GrapeCity.Documents.Text.Windows.FontLinkHelper.UpdateFontLinks(_fonts, true);
        _fonts.DefaultFont = _fonts.FindFamilyName("Arial");
    }
    public static readonly GrapeCity.ActiveReports.IFontResolver Instance = new CustomFontResolver();
    private CustomFontResolver() { }
    GrapeCity.Documents.Text.FontCollection GrapeCity.ActiveReports.IFontResolver.GetFonts(string familyName, bool isBold, bool isItalic)
    {
        // suggested to cache values
        var fonts = new GrapeCity.Documents.Text.FontCollection();
        var font = _fonts.FindFamilyName(familyName, isBold, isItalic);
        if (font != null) fonts.Add(font);
        fonts.Add(_fonts.DefaultFont);
        return fonts;
    }
}</code></pre>
<p>Set font resolver</p>
<pre><code class="lang-csharp">var sectionDocument = new GrapeCity.ActiveReports.Document.SectionDocument();
sectionDocument.Load("Document.rdf");
sectionDocument.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.CrossPlatform;
sectionDocument.FontResolver = CustomFontResolver.Instance;</code></pre>

</div>
