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

各种字体格式的Java API

main-banner

产品页面 | 文档 | API参考 | 例子 | 博客 | 搜索 | 免费支持 | 临时许可

Aspose.Font for Java是字体加载和绘图库。它支持多种前面格式,例如TrueType(带有TrueType Collectons),CFF,Opentype和Type1。 API提供了丰富的功能来加载/保存字体,并提供有关其数据结构的信息以及所有字体类型支持的任何字形。它还为所有代表字符代码和字形标识符之间的映射的字体类型提供编码信息。它的渲染子系统有助于最终用户渲染任何所需的字形或文字。可以通过使用简单的图形功能(移动点,绘制线,曲线)实现接口来渲染特殊的字形。

字体API功能

-从光盘加载字体文件以及流。

  • 读取字体信息,并将更新的字体文件保存到光盘。

  • 支持 [TrueType and OpenType](https://docs.aspose.com/font/java/working-with-with-truetype-andype-and-popentype-fonts/)字体。

  • 从本地存储的文件中加载trueType字体类型,更新参数并保存。

  • 使用“ TrueType”字体的字形和指标。

  • 使用TrueType and Type1字体渲染文本。

  • 检测字体中的拉丁符号。

  • 从存储在本地光盘上的type1字体中加载并提取数据。

  • 使用type1字体的字形和指标。

  • 使用自定义接口渲染文本。

有关功能的更全面列表,请访问功能概述

读写字体格式

TTF

阅读字体格式

ttc,opentype,cff,type1

支持环境

  • ** Microsoft Windows:** Windows Desktop&Server(X86,X64),Windows Azure
  • ** macOS:** Mac OS X
  • ** linux:** ubuntu,centos等
  • ** Java版本:**``J2SE 8.0(1.8)或更高版本。

开始

Aspose.font Java API托管在Aspose存储库。您可以在Maven项目中轻松地使用Aspose.font将其用于Java API,并具有简单的配置。有关详细说明,请访问Installing Aspose.Font for Java from Maven Repository文档页面。

使用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()));
      }

产品页面 | 文档 | API参考 | 例子 | 博客 | 搜索 | 免费支持 | 临时许可

VersionRelease Date
22.112022年11月21日
22.102022年11月3日
22.92022年9月21日
22.72022年7月28日
22.62022年6月21日
21.122021年12月9日
21.102021年10月13日
21.82021年8月25日
21.42021年4月20日
20.102020年10月15日