Aspose.Font 23.12.0

dotnet add package Aspose.Font --version 23.12.0
NuGet\Install-Package Aspose.Font -Version 23.12.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aspose.Font" Version="23.12.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Aspose.Font --version 23.12.0
#r "nuget: Aspose.Font, 23.12.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Aspose.Font as a Cake Addin
#addin nuget:?package=Aspose.Font&version=23.12.0

// Install Aspose.Font as a Cake Tool
#tool nuget:?package=Aspose.Font&version=23.12.0

Font Manipulation via .NET API

Version 23.12.0 Nuget

banner

Product Page | Docs | API Reference | Examples | Blog | Search | Free Support | Temporary License

Aspose.Font for .NET is a library that enables your .NET applications to load, edit, convert, and save font data. Aspose.Font for .NET also enables your .NET applications to draw text with the specified font.

Font Processing Features

  • Load font files from the disc as well as stream.
  • Read font information(name, family, etc., plus other string metadata) and save updated font files to disc.
  • Convert fonts from one font format to another.
  • Merge TrueType fonts.
  • Create TrueType fonts from existing ones using the font merge feature.
  • Render text using font glyphs.
  • Render text using custom interfaces.
  • Supports ligatures and advanced OpenType features: glyph substitution (GSUB) and glyph positioning (GPOS) for rendering.
  • Extract embedded licensing information from font files.
  • Read Glyphs and Metrics information from Font files.
  • Detect Latin Symbols in Fonts.

Supported Formats

Font Formats supported for reading and writing

TTF, WOFF/WOFF2

Font Formats supported for reading

TTC, OpenType, CFF, Type1, EOT

Font Formats supported for writing

SVG

Platform Independence

Aspose.Font for .NET can be integrated with any kind of ASP.NET Web Application or a Windows Application.

Getting Started

Are you ready to give Aspose.Font for .NET a try? Simply execute Install-Package Aspose.Font from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have Aspose.Font for .NET and want to upgrade the version, please execute Update-Package Aspose.Font to get the latest version.

Loading of font with TrueType format (.ttf)

using Aspose.Font;
using Aspose.Font.Sources;

// Font file name with the full path
string fontPath = Path.Combine(DataDir, "Montserrat-Regular.ttf");

// Initialize FontFileDefinition based on FileSystemStreamSource object, set fileExtension to "ttf" 
FontFileDefinition fileDef = new FontFileDefinition("ttf", new FileSystemStreamSource(fontPath));

// Initialize FontDefinition using just created FontFileDefinition object, passing TTF as the FontType value
FontDefinition fontDef = new FontDefinition(FontType.TTF, fileDef);

// Load the font
Font font = Font.Open(fontDef);

Extracting font name, font family

using Aspose.Font;

//Reference to font object loaded from some source
Font font;
string fontName = font.FontName;
string fontFamily = font.FontFamily;

Convert TTF to WOFF2

using Aspose.Font.Sources;
using System.IO;

// Open TTF font
string fontPath = Path.Combine(DataDir, "Montserrat-Regular.ttf");
FontDefinition fontDefinition = new FontDefinition(FontType.TTF, new FontFileDefinition(new FileSystemStreamSource(fontPath)));
Font font = Font.Open(fontDefinition);

// Write the output settings for the WOFF2 format
string outPath = Path.Combine(OutputDir, "out.woff2");
FileStream outStream = File.Create(outPath);

// Make conversion from TTF to WOFF2 and save the result using SaveToFormat() method of the base abstract Font class instance
font.SaveToFormat(outStream, FontSavingFormats.WOFF2);

Render text

using System.IO;
using Aspose.Font;
using Aspose.Font.Renderers;

//Reference to font object loaded from some source
Font font;
//Text to render using the specified font
string text = "Hello world";
//Set font size to 12
using (Stream st = RenderingUtils.DrawText(font, text, 12))
{
	//Save rendered text to the file
	byte[] buff = new byte[st.Length];
	st.Read(buff);	
	File.WriteAllBytes("Text.png", buff);
}                        

Generate TrueType font

using Aspose.Font.Ttf;
using Aspose.Font.TtfHelpers;

// Original font to take glyphs from
TtfFont srcFont;

//To create a font we can use functionality of the IFontCharactersMerger interface.
//The IFontCharactersMerger.MergeFonts() method is designed to create a font as a result of merging two fonts.
//It takes two arrays of glyphs or character codes and puts into resultant font only glyphs from these arrays.
//But we can use a trick by passing two references on same font and provide only single array of character codes.

IFontCharactersMerger merger = HelpersFactory.GetFontCharactersMerger(srcFont, srcFont);

TtfFont destFont = merger.MergeFonts(new uint[] { 'a', 'c', 'e' }, new uint[0], "TestFont");

//Save resultant font
destFont.Save("TestFont.ttf");

Product Page | Docs | API Reference | Examples | Blog | Search | Free Support | Temporary License

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Aspose.Font:

Package Downloads
Aspose.Total

Aspose.Total for .NET is the most complete package of all .NET file format APIs offered by Aspose. It empowers developers to create, edit, render, print and convert between a wide range of popular document formats within any .NET, C#, ASP.NET and VB.NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
23.12.0 4,023 12/18/2023
23.11.0 3,352 11/10/2023
23.10.0 3,524 10/13/2023
20.10.0 6,645 10/15/2020
20.9.0 2,291 9/3/2020