Operating systems for all digital platforms use True Type Fonts (TTF). In order to add a special touch to web pages, Microsoft has introduced EOT fonts. Embedded Open Type fonts (EOT) are OpenType fonts embedded within a document. In certain cases, we may need to convert EOT fonts to TTF programmatically. In this article, we will learn how to convert EOT to TTF in Java.
The following topics shall be covered in this article:
Java EOT to TTF Converter API
The API provides the FontFileDefinition class that represents the Font file definition. The FontDefinition class represents the Font file set definition. It contains fields that are not related to font internal data. These fields describe font placement and other data needed to load the font from some font source(file, memory, etc). We have the Font class which is the base Font class. It provides the open() method to open a font. It also allows saving the font using the save() method.
Please either download the JAR of the API or add the following pom.xml configuration in a Maven-based Java application.
<name>Aspose Java API</name>
Steps to Convert EOT to TTF
We can easily convert EOT font from .eot file to TTF format by following the steps given below:
- Load the font file.
- Create font definition as TTF.
- Open EOT font.
- Save the TTF to the desired location.
The following section describes how to transform these steps into Java and convert EOT to TTF.
Convert EOT to TTF using Java
We can convert EOT to TTF programmatically by following the steps given below:
- Firstly, load the font file using the FileSystemStreamSource class.
- Next, create an instance of the FontFileDefinition class with the source file object as an argument.
- Then, initialize the FontDefinition class object with Font type as TTF and FontFileDefinition object.
- After that, open the font using the Font.open() method with FontDefinition object as an argument.
- Finally, call the save() method to save it. It takes the output file path as an argument.
The following code sample shows how to convert EOT to TTF in Java.
Get a Free License
You can get a free temporary license to try the library without evaluation limitations.
In this article, we have learned how to convert Embedded Open Type fonts (EOT) to True Type fonts (TTF) in Java. Besides, you can learn more about Aspose.Font for Java API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.