找回密码
 立即注册

QQ登录

只需一步,快速开始

KearneyKang 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-11-17 17:32  /   查看:2393  /  回复:1
本帖最后由 KearneyKang 于 2020-11-17 17:35 编辑

使用ActiveReportsJS API注册自定义字体

默认情况下,ActiveReportsJS报表设计器使用可用于报表控件(例如TextBox)的预定义字体列表。 此外,ActiveReportsJS API允许注册自定义字体(例如Google字体之一)以在报表中使用。
注册字体的必要类型是 [FontDescriptor](@api/interfaces/core.fontdescriptor.html)。这是描述 [Roboto 字体](https://fonts.google.com/specimen/Roboto)的FontDescriptor实例的示例
js
  1. const robotoFont = {
  2.   name: "Roboto",
  3.   source:
  4.     "https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxIIzI.woff2",
  5. };
复制代码
`FontStore`对象的`registerFont`方法接受字体描述对象并注册指定的字体,例如:
js
  1. import { Core } from "@grapecity/activereports";

  2. await Core.FontStore.registerFonts(robotoFont);
复制代码
应用程序应在初始化设计器实例之前调用此代码。
该应用程序使用相同的API为ActiveReportJS Viewer实例注册自定义字体。 检查 [注册ActiveReportsJS Viewer的字体](../ActiveReportsJSViewer/Fonts)页面以获取更多信息。
操作ActiveReportsJS设计器中可用的字体列表
ActiveReportsJS设计器实例的 [fontSet 属性](@api/classes/reportdesigner.designer.html#fontset) 允许处理可用于设计报告的字体列表。 此属性的接受值为:

- 默认值:默认字体,取决于区域性可用
- 已注册:“ Arial”和自定义注册字体均可用
- 全部:默认字体和注册字体均可用

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部