Check Latin Symbols Support for TrueType or Type1 Fonts in C#

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 check Latin symbols’ support for TrueType or Type1 fonts in C#.

The following topics shall be covered in this article:

  1. C# API to Detect Latin Symbols Support in Fonts
  2. Detect Latin Symbols in TrueType Fonts using C#
  3. 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:

  1. Firstly, load the font file using the FontFileDefinition class.
  2. Next, initialize the FontDefinition class object with FontType (TTF) and FontFileDefinition object as arguments.
  3. Then, call the Font.Open() method with the FontDefinition object as an argument and initialize the TtfFont class object.
  4. After that, loop through the different codes and decode them into Glyph IDs.
  5. 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:

  1. Firstly, load the font file using the FontFileDefinition class.
  2. Next, initialize the FontDefinition class object with FontType (Type1) and FontFileDefinition object as arguments.
  3. Then, call the Font.Open() method with the FontDefinition object as an argument and initialize the Type1Font class object.
  4. After that, loop through the different codes and decode them into Glyph IDs.
  5. 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.

See Also