Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -8199,6 +8199,9 @@
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/Fallback-Fonts-in-PPTXtoPDF-Conversion">Fallback Fonts</a>
</li>
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/Custom-fonts-registration-pptx-to-pdf">Custom Fonts Registration</a>
</li>
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/Performance-metrics">Performance Metrics</a>
</li>
Expand Down Expand Up @@ -8323,6 +8326,9 @@
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-image/net/Fallback-Fonts-in-PPTXtoImage-Conversion">Fallback Fonts</a>
</li>
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-image/net/Custom-fonts-registration-pptx-to-image">Custom Fonts Registration</a>
</li>
<li>
<a href="/document-processing/powerpoint/conversions/powerpoint-to-image/net/Performance-metrics">Performance Metrics</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
---
title: Custom font registration for PowerPoint-to-Image in .NET | Syncfusion
description: This section illustrates how to register custom fonts for PowerPoint-to-Image conversion using the Syncfusion .NET PowerPoint (Presentation) library
platform: document-processing
control: PowerPoint
documentation: UG
---

# Custom Font Registration for PowerPoint to Image Conversion in .NET

The Syncfusion document processing libraries provide support for registering custom font streams through the `FontManager` API. This feature enables applications to use fonts that are not installed on the operating system by maintaining a private font repository during PowerPoint to Image conversion.

This capability is particularly beneficial for cloud-hosted and cross-platform applications where access to system fonts may be limited or unavailable. Once registered the custom fonts, users can perform PowerPoint to Image conversion normally. Registered fonts are automatically used when available.

In many deployment environments, installing fonts on the operating system is either not possible or not desirable. Custom font registration enables applications to:

* Use required fonts without depending on system-installed fonts.
* Ensure consistent document rendering across environments.
* Reduce the need for complex font substitution logic.
* Improve font preservation during document conversion.
* Simplify deployment in cloud and containerized applications.

N> It is recommended to register all required fonts during application startup and clear them when the application shuts down. This ensures that fonts are loaded only once and reused throughout the application's lifetime, improving performance and reducing font lookup overhead.

## Supported Font Formats

The following font formats are supported for registration:

* TrueType Fonts (.ttf)
* OpenType Fonts (.otf)

The code examples in the sections that follow use the following namespace:

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
using Syncfusion.Drawing.Fonts;
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
using Syncfusion.Drawing.Fonts;
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Imports Syncfusion.Drawing.Fonts
{% endhighlight %}

{% endtabs %}

## Register Fonts from a Folder

Users can register all fonts available in a specific folder by specifying the folder path. This approach is useful when multiple font files are managed in a centralized location and need to be registered at once.

N> Supported in .NET 8.0 and later. The specified folder must have access to the file system; otherwise this method throws `DirectoryNotFoundException`.

The following code example shows how to register fonts from a folder.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
//Specify the path to the folder containing font files.
FontManager.RegisterFonts(@"C:\\CustomFonts");
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Specify the path to the folder containing font files.
FontManager.RegisterFonts(@"C:\\CustomFonts");
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Specify the path to the folder containing font files.
FontManager.RegisterFonts("C:\\CustomFonts")
{% endhighlight %}

{% endtabs %}

## Register Custom Fonts from Streams

Users can register one or more fonts directly from memory streams. This approach is recommended for cloud-hosted, containerized, and cloud-native applications where access to local font files may be limited.

The following code example shows how to register fonts from memory streams.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
List<Stream> fontStreams = new List<Stream>();
fontStreams.Add(File.OpenRead("Arial.ttf"));
fontStreams.Add(File.OpenRead("Calibri.ttf"));

FontManager.RegisterFonts(fontStreams);
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
List<Stream> fontStreams = new List<Stream>();
fontStreams.Add(File.OpenRead("Arial.ttf"));
fontStreams.Add(File.OpenRead("Calibri.ttf"));

FontManager.RegisterFonts(fontStreams);
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim fontStreams As New List(Of Stream)()
fontStreams.Add(File.OpenRead("Arial.ttf"))
fontStreams.Add(File.OpenRead("Calibri.ttf"))

FontManager.RegisterFonts(fontStreams)
{% endhighlight %}

{% endtabs %}

## Get Registered Font Names

Users can retrieve the names of all fonts currently registered in the custom font repository. This is useful for validating font registration, auditing available fonts, and troubleshooting font-related issues during PowerPoint to Image conversion. Each entry contains the font family name and style information.

The following code example shows how to retrieve and iterate through the list of registered font names.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
List<string> registeredFontNames = FontManager.RegisteredFontNames;
foreach (string registeredFontName in registeredFontNames)
{
Console.WriteLine(registeredFontName);
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
List<string> registeredFontNames = FontManager.RegisteredFontNames;
foreach (string registeredFontName in registeredFontNames)
{
Console.WriteLine(registeredFontName);
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim registeredFontNames As List(Of String) = FontManager.RegisteredFontNames
For Each registeredFontName As String In registeredFontNames
Console.WriteLine(registeredFontName)
Next
{% endhighlight %}

{% endtabs %}

## Clear Registered Fonts

Users can remove all registered fonts from the custom font repository and can optionally dispose of the associated font streams when they are no longer required. This helps release resources and prevents unnecessary memory usage in long-running applications.

The following code example shows how to clear the registered fonts and optionally dispose of the associated font resources.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
// Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true);
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
// Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true);
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true)
{% endhighlight %}

{% endtabs %}

## Recommended Usage Pattern

### Application Startup

The following code example shows how to register fonts during application startup.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
//Register fonts from the specified folder during application startup.
FontManager.RegisterFonts(@"Fonts");
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Register fonts from the specified folder during application startup.
FontManager.RegisterFonts(@"Fonts");
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Register fonts from the specified folder during application startup.
FontManager.RegisterFonts("Fonts")
{% endhighlight %}

{% endtabs %}

### Application Shutdown

The following code example shows how to clear registered fonts during application shutdown.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}
//Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true);
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true);
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Clear all registered fonts and dispose the associated font streams.
FontManager.ClearRegisteredFonts(true)
{% endhighlight %}

{% endtabs %}

During document conversion, fonts are utilized in the following priority order:

1. Registered Custom Fonts
2. Installed System Fonts
3. Substituted Fonts

This ensures that registered fonts are preferred over operating system fonts whenever a matching font is available.

## See also

* [Font Substitution in PowerPoint to Image Conversion](./Font-Substitution-in-PPTXtoImage-Conversion)
* [Fallback fonts in PowerPoint to Image Conversion](./Fallback-Fonts-in-PPTXtoImage-Conversion)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The Syncfusion<sup>&reg;</sup> PowerPoint to Image converter offers high versati
* Support to convert [specific slide](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image#convert-a-slide-to-image) of PowerPoint Presentation document to image.
* Set [fallback fonts](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/fallback-fonts-in-pptxtoimage-conversion) for characters when glyphs are not available.
* Support for [font substitution](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/font-substitution-in-pptxtoimage-conversion) when fonts are not available during PowerPoint to image conversion.
* Support for [custom fonts registration](./Custom-fonts-registration-pptx-to-image) through the `FontManager` API, enabling use of fonts that are not installed on the operating system.

## Assemblies and NuGet packages required

Expand Down Expand Up @@ -397,6 +398,14 @@ To avoid this, the Essential<sup>&reg;</sup> Presentation library allows you to

During PowerPoint to Image conversions, if a glyph of the input text is unavailable in the specified font, the text will not be rendered properly. To address this, the Syncfusion PowerPoint (Presentation) library allows users to specify fallback fonts. When a glyph is missing, the library will use one of the fallback fonts to render the text correctly in the output image. For further information, click [here](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/fallback-fonts-in-pptxtoimage-conversion).

## Custom font registration

In many deployment environments such as cloud-hosted, containerized, and cross-platform applications, installing fonts on the operating system is not possible or desirable. The [Syncfusion .NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) allows users to register custom fonts through the `FontManager` API, maintaining a private font repository within the library. This supports TrueType (`.ttf`) and OpenType (`.otf`) formats, registered from memory streams or a folder, and ensures consistent document rendering without depending on system-installed fonts.

N> Register the required fonts during application startup using `FontManager.RegisterFonts` and clear them during shutdown using `FontManager.ClearRegisteredFonts` for optimal performance.

For further information, click [here](./Custom-fonts-registration-pptx-to-image).

## Online Demo

* Explore how to convert the PowerPoint presentation to an image using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/pptxtoimage#/tailwind).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The Syncfusion<sup>&reg;</sup> PowerPoint to Image converter offers high versati
* Support to convert [specific slide](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image#convert-a-slide-to-image) of PowerPoint Presentation document to image.
* Set [fallback fonts](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/fallback-fonts-in-pptxtoimage-conversion) for characters when glyphs are not available.
* Support for [font substitution](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/font-substitution-in-pptxtoimage-conversion) when fonts are not available during PowerPoint to image conversion.
* Support for [custom fonts registration](./NET/Custom-fonts-registration-pptx-to-image) through the `FontManager` API, enabling use of fonts that are not installed on the operating system.

## Assemblies and NuGet packages required

Expand Down Expand Up @@ -389,6 +390,14 @@ To avoid this, the Essential<sup>&reg;</sup> Presentation library allows you to

During PowerPoint to Image conversions, if a glyph of the input text is unavailable in the specified font, the text will not be rendered properly. To address this, the Syncfusion<sup>&reg;</sup> PowerPoint (Presentation) library allows users to specify fallback fonts. When a glyph is missing, the library will use one of the fallback fonts to render the text correctly in the output image. For further information, click [here](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/fallback-fonts-in-pptxtoimage-conversion).

## Custom font registration

In many deployment environments such as cloud-hosted, containerized, and cross-platform applications, installing fonts on the operating system is not possible or desirable. The [Syncfusion .NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) allows users to register custom fonts through the `FontManager` API, maintaining a private font repository within the library. This supports TrueType (`.ttf`) and OpenType (`.otf`) formats, registered from memory streams or a folder, and ensures consistent document rendering without depending on system-installed fonts.

N> Register the required fonts during application startup using `FontManager.RegisterFonts` and clear them during shutdown using `FontManager.ClearRegisteredFonts` for optimal performance.

For further information, click [here](./NET/Custom-fonts-registration-pptx-to-image).

## Online Demo

* Explore how to convert the PowerPoint presentation to an image using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/pptxtoimage#/tailwind).
Expand Down
Loading