A Latin character symbol is a character in the form of a mark, sign, or word. Font defines how the characters/symbols shall be displayed digitally or in a printable form using a set of properties. The font file contains the design and other information regarding the font. In certain cases, we may need to check whether any specific font supports Latin symbols or not. In this article, we will learn how to detect Latin symbols support in fonts using C#.
The following topics shall be covered in this article:
- C# API to Detect Latin Symbols Support in Fonts
- Detect Latin Symbols in TrueType Fonts using C#
- Detect Latin Symbols in Type1 Fonts using C#
C# API to Detect Latin Symbols Support in Fonts
For detecting Latin symbols support in fonts, we will be using the Aspose.Font for .NET API. It allows loading, saving, and extracting information from supported font types. Please either download the DLL of the API or install it using NuGet.
PM> Install-Package Aspose.Font
Detect Latin Symbols in TrueType Fonts using C#
We can detect Latin symbols in the TrueType fonts by following the steps given below:
- Firstly, load the font file using the FontFileDefinition class.
- Next, initialize the FontDefinition class object with FontType (TTF) and FontFileDefinition object as arguments.
- Then, call the Font.Open() method with the FontDefinition object as an argument and initialize the TtfFont class object.
- After that, loop through the different codes and decode them into Glyph IDs.
- Finally, check the glyph IDs for the support of Latin symbols.
The following code sample shows how to detect if a particular TrueType font supports Latin symbols or not in C#.
Detect Latin Symbols in Type1 Fonts using C#
We can also detect Latin symbols in the Type1 fonts by following the steps given below:
- Firstly, load the font file using the FontFileDefinition class.
- Next, initialize the FontDefinition class object with FontType (Type1) and FontFileDefinition object as arguments.
- Then, call the Font.Open() method with the FontDefinition object as an argument and initialize the Type1Font class object.
- After that, loop through the different codes and decode them into Glyph IDs.
- Finally, check the glyph IDs for the support of Latin symbols.
The following code sample shows how to detect if a particular Type1 font supports Latin symbols or not in C#.
Get a Free License
You can get a free temporary license to try the library without evaluation limitations.
Conclusion
In this article, we have learned how to determine if any particular TrueType or Type1 font supports Latin symbols or not in C#. Besides, you can learn more about Aspose.Font for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on the forum.