<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-font</artifactId>
<version>21.12</version>
</dependency>
copied!
compile(group: 'com.aspose', name: 'aspose-font', version: '21.12')
copied!
<dependency org="com.aspose" name="aspose-font" rev="21.12">
 <artifact name="aspose-font" ext="jar"/>
</dependency>
copied!
libraryDependencies += "com.aspose" % "aspose-font" % "21.12"
copied!

Java API for Various Font Formats

banner

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

Aspose.Font for Java is a font loading and drawing library. It supports multiple front formats such as TrueType (with TrueType collectons), CFF, OpenType, and Type1. The API provides rich functionality to load/save font and provide information about its data structures along with any glyph that is supported by all the font types. It also provides encoding information for all the font types which represents a mapping between character codes and glyph identifiers. Its rendering subsystem helps end-users to render any desired glyph or text. Special glyphs can be rendered by implementing interface using simple graphics functionality (move point, draw line, curve).

Font API Features

  • Load font files from disc as well as stream.
  • Read font information and save updated font files to disc.
  • Support for TrueType and OpenType Fonts.
  • Load TrueType Font types from locally stored files, update parameters and save.
  • Work with Glyphs and Metrics of TrueType Fonts.
  • Render text using TrueType and Type1 font.
  • Detect Latin Symbols in Fonts.
  • Load and extract data from Type1 Font stored at the local disc.
  • Work with Glyphs and Metrics of Type1 Fonts.
  • Render text using custom interfaces.

For a more comprehensive list of features, please visit Feature Overview.

Read & Write Font Formats

TTF

Read Font Formats

TTC, OpenType, CFF, Type1

Supported Environments

  • Microsoft Windows: Windows Desktop & Server (x86, x64), Windows Azure
  • macOS: Mac OS X
  • Linux: Ubuntu, CentOS, and others
  • Java Versions: J2SE 8.0 (1.8) or above.

Get Started

Aspose hosts all Java APIs at the Aspose Repository. You can easily use Aspose.Font for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit Installing Aspose.Font for Java from Maven Repository documentation page.

Detect Latin Symbols Support in the Font using Java

// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-Java
String fileName = Utils.getDataDir() + "Montserrat-Regular.ttf"; //Font file name with full path

      FontDefinition fd = new FontDefinition(FontType.TTF, new FontFileDefinition("ttf", new FileSystemStreamSource(fileName)));
      TtfFont ttfFont = (TtfFont) Font.open(fd);

      boolean latinText = true;


      for (int code = 65; code < 123; code++)
      {
          GlyphId gid = ttfFont.getEncoding().decodeToGid(code);
          if (gid == null || gid == GlyphUInt32Id.getNotDef())
          {
              latinText = false;
          }
      }

      if (latinText)
      {
          System.out.println(MessageFormat.format("Font {0} supports latin symbols.", ttfFont.getFontName()));
      }
      else
      {
      	System.out.println(MessageFormat.format("Latin symbols are not supported by font {0}.", ttfFont.getFontName()));
      }

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

VersionRelease Date
21.12December 9, 2021
21.10October 13, 2021
21.8August 25, 2021
21.4April 20, 2021
20.10October 15, 2020