Loading Embedded OpenType (EOT) font files | .NET

Loading EOT fonts with Aspose.Font for .NET

Embedded OpenType (EOT) is a compact, web‑oriented font format originally introduced by Microsoft for use with Internet Explorer. Although its popularity has declined in favor of WOFF/WOFF2, many legacy web applications still rely on EOT files. The Aspose.Font library provides a pure .NET API that lets you read, modify, convert, and write EOT fonts without the need for a graphics subsystem.

What you need

RequirementDetails
.NET Runtime.NET 6.0 or later (the library also supports .NET Framework 4.6.2+)
Aspose.Font for .NETInstall via NuGet: dotnet add package Aspose.Font
IDEVisual Studio 2022, VS Code, or any editor that supports C#
LicenseA valid Aspose.Font license is required for production use. The library can be evaluated in trial mode with a watermark.

Loading an EOT Font

Step‑by‑step

  1. Initialize the file source. Point the application to the physical location of your font file. Using a verbatim string (@) handles the backslashes in Windows paths correctly.
  2. Load and open the font using the Font.Open method that loads the binary data into an object. This is when the library validates if the file is corrupted or protected.
  3. If the font was loaded correctly, you can extract technical data.
 1using Aspose.Font;
 2using Aspose.Font.Sources;
 3
 4// Path to the EOT file
 5string eotPath = @"C:\Fonts\MyWebFont.eot";
 6
 7// Create a FontDefinition from the file source
 8FontDefinition fontDef = new FontDefinition(
 9    FontType.EOT,                // Explicitly specify the format
10    new FileSystemFontSource(eotPath)
11);
12
13// Load the font into memory
14Font font = Font.Open(fontDef);
15
16// Verify that the font was loaded correctly
17Console.WriteLine($"Family: {font.FamilyName}");
18Console.WriteLine($"Style: {font.Style}");
19Console.WriteLine($"Units per EM: {font.UnitsPerEm}");

Key points

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.