# GrapeCity.ActiveReports.Design.Designer.FontResolver

## Content

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



<h1 id="GrapeCity_ActiveReports_Design_Designer_FontResolver_" data-uid="GrapeCity.ActiveReports.Design.Designer.FontResolver*">FontResolver Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Design_Designer_FontResolver_" data-uid="GrapeCity.ActiveReports.Design.Designer.FontResolver*"></a>
<h4 id="GrapeCity_ActiveReports_Design_Designer_FontResolver" data-uid="GrapeCity.ActiveReports.Design.Designer.FontResolver">FontResolver</h4>
<div class="markdown level1 summary"><p>Gets or sets a value representing the font resolver used by the designer to resolve fonts in reports.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">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="../MESCIUS.ActiveReports/GrapeCity.ActiveReports.IFontResolver.html">IFontResolver</a></td>
      <td><p>An <a class="xref" href="../MESCIUS.ActiveReports/GrapeCity.ActiveReports.IFontResolver.html">IFontResolver</a> that handles font resolution. The default is <code>null</code>, which indicates that the default font resolver is used.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Design_Designer_FontResolver_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The font resolver is responsible for determining the specific font instance to use when rendering text in reports. This can be particularly useful in scenarios
where custom fonts are used or when there is a need to map generic font names to specific font files. Implementing a custom <a class="xref" href="../MESCIUS.ActiveReports/GrapeCity.ActiveReports.IFontResolver.html">IFontResolver</a> allows
for precise control over font selection and rendering in the designer environment.</p>
<p>Note: Setting this property to a custom font resolver overrides the default font resolution mechanism. Ensure that the custom resolver properly handles 
all font requests to avoid rendering issues.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Design_Designer_FontResolver_examples">Examples</h5>
<p>This property allows you to specify custom fonts for use in both the preview and design of reports. To utilize this feature, you must first define a custom font resolver:</p>
<pre><code class="lang-csharp">//Custom font resolver
public sealed class DirectoryFontResolver : GrapeCity.ActiveReports.IFontResolver
{
	Documents.Text.FontCollection _fonts;
	public DirectoryFontResolver(string fontsDirectory)
	{
		_fonts = new Documents.Text.FontCollection();
		// load standard Windows fonts
		_fonts.RegisterDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Fonts));
		// load fonts from custom directory
		_fonts.RegisterDirectory(fontsDirectory);
		_fonts.DefaultFont = _fonts.FindFamilyName("Arial");
	}
	Documents.Text.FontCollection IFontResolver.GetFonts(string familyName, bool isBold, bool isItalic)
	{
		var fonts = new Documents.Text.FontCollection();
		fonts.Add(_fonts.FindFamilyName(familyName, isBold, isItalic) ?? _fonts.DefaultFont);
		return fonts;
	}
}</code></pre>
<p>After defining a custom font resolver, you can then associate it with the designer instance.</p>
<pre><code class="lang-csharp">class MyDesignerForm : Form
{
	public MyDesignerForm()
	{
		InitializeComponent();
		//note the designer must be added to the form and its name have to be '_designer'.
		_designer.FontResolver = new DirectoryFontResolver("c:\\Fonts");
	}
}</code></pre>

</div>
