Font Command Line Converter | Aspose.Font CLI Tools
Overview
The Aspose.Font Convert tool is a powerful CLI application that facilitates the conversion of fonts between different formats, including TTF, WOFF, and more, to any desired font format. This tool is essential for developers and designers who need to ensure font compatibility across various platforms and devices.
Key Features
- Supported Input Formats: TTF, WOFF, WOFF2, EOT, Type1 (PFA, PFB), CFF.
- Supported Output Formats: TTF, WOFF, WOFF2, SVG.
- Flexible Usage: Can be used both via simple command-line commands and programmatically in your C# code, compatible with .NET 6.0/7.0.
Benefits
Using the Aspose.Font Convert tool provides several advantages:
- Efficiency: Quickly convert fonts between multiple formats without the need for complex software.
- Automation: Integrate font conversion into your automated workflows and scripts.
- Flexibility: Handle various font formats to ensure compatibility with different systems and applications.
Licensing
While the Aspose.Font Convert application is freely available, Aspose.Font .NET requires a valid license for use beyond trial limitations. You can apply your existing license or evaluate the application under the trial mode of Aspose.Font .NET.
How to install Font Command-Line Converter?
The Aspose.Font Convert tool can be installed either globally or locally, depending on your project’s needs. It is recommended to use the local installation for project-specific use to avoid version conflicts.
Global Installation
To install Aspose.Font Convert globally on your machine, use the following command:
1dotnet tool install --global Aspose.Font.Convert
Specify the --version
option if you need a specific version of the tool.
Local Installation
For local installation within a specific project, first, navigate to your project’s root directory. Then, execute the following commands:
Create a tool-manifest if not already present:
1dotnet new tool-manifest
Install Aspose.Font Convert locally:
1dotnet tool install Aspose.Font.Convert --local
Again, you can specify the --version
option for a specific version.
Updating the Font CLI Converter
To update the Aspose.Font Convert tool to the latest version, use the dotnet tool update
command with either --global
or --local
, matching your installation type.
Uninstalling the Font CLI Converter
If you need to uninstall the tool, use the dotnet tool uninstall
command with either --global
or --local
, depending on how the tool was installed.
Usage
Command Line
Convert your fonts using command-line arguments. Here are the available parameters:
-i, --input [Required]
: Path to the input font file.- Example:
--input "path/to/font.ttf"
- Example:
-o, --output [Required]
: Path where the converted font will be saved.- Example:
--output "path/to/output/font.woff2"
- Example:
-f, --format [Optional]
: Desired output font format. Supported formats include TTF, OTF, WOFF, WOFF2, and more, as per Aspose.Font supported font formats.- Example:
--format "woff2"
- Example:
-l, --license [Optional]
: Path to your Aspose.Font .NET license file. This parameter is optional and only necessary if you have a license to apply.- Example:
--license "path_to_license.lic
- Example:
-v, --verbose [Optional]
: Enable verbose output for detailed operation logging.- Example:
--verbose
- Example:
Example command-line usage:
1Aspose.Font.Convert --input input.ttf --output output.woff2 --format woff2
How to integrate Font CLI Converter into C# Projects?
The Aspose.Font Convert application can also be integrated directly into your .NET projects using the command line, enabling programmatic access to font conversion capabilities within your C# code.
Adding the Command Line Converter to Your Project:
To add the Aspose.Font Convert tool to your Visual Studio project, navigate to your project’s root directory, and execute the following command:
1dotnet Aspose.Font.Convert add
This command adds the Aspose.Font Convert functionality directly into your project, allowing you to use the library’s methods and properties through your code. This is particularly useful for developers looking to implement customized font conversion processes directly within their applications.
Use from Code
Here is an example of using the Aspose.Font CLI tools programmatically in your C# code:
1using Aspose.Font.Convert;
2using System.Threading.Tasks;
3
4class Program
5{
6 static async Task Main(string[] args)
7 {
8 // Initialize font convert options
9 var options = new ConvertOptions
10 {
11 // Required: Specify the input font file path
12 InputPath = "input.ttf",
13
14 // Required: Specify the output font file path
15 OutputPath = "output.woff2",
16
17 // Optional: Specify the output font format
18 ToFormat = "woff2"
19 };
20
21 // Conditional: Apply license if you have one
22 if (isLicensed)
23 {
24 options.LicenseFile = "path_to_license.lic";
25 }
26
27 // Execute the font conversion task
28 await ConvertTasks.Create(options).Execute();
29 }
30}
For more information and usage examples, please visit the Aspose.Font for .NET documentation.