JasperReports默认字体 [英] JasperReports Default Font

查看:583
本文介绍了JasperReports默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有样式文本字段(RTF)的JasperReport模板(在服务器上生成)。此字段的内容是用户生成的,因此它可以包含客户端PC上安装的所有字体(称为字体X)。如果我现在在服务器上生成报告,则没有字体X,所以我想将所有未知字体替换为字体Y.

I have a JasperReport template (generated on the Server) with a Styled Textfield (RTF). The Content of this field is User generated, and so it can contain all Fonts installed at the Clients PC (call it Font X). If I generate now a Report on the Server, there is no Font X, so I want to replace all unknown Fonts to Font Y.

但我得到的只是一个错误,找不到该字体。该功能( net.sf.jasperreports.awt.ignore.missing.font )通常不需要关闭字体检查,因为我想检查jrxml的字体。

But all I get is an error, that the font is not found. The feature (net.sf.jasperreports.awt.ignore.missing.font) to turn off Font Checks in general isn't desired, because I want the Fonts of the jrxml checked.

有没有办法设置默认字体(不修改Jasper Source)? (我已在JRStyledText或JRTextUtil中找到了一些要点。)

Is there a way to set a default font (without the modification of the Jasper Source)? (I have found some points already at JRStyledText or JRTextUtil.)

推荐答案

您可以尝试使用 net.sf.jasperreports.default.font.name property。

You can try to use net.sf.jasperreports.default.font.name property.

或者您可以使用 默认样式

Or you can use the default style.

<style name="Base" isDefault="true" ...>

有关详细信息,请阅读文章 默认字体和继承 部分。

For more details you can read this article, the Default Fonts and Inheritance section.

更新:

UPDATED:

报价来自 JasperReports终极指南

The quote from JasperReports Ultimate Guide:


我们强烈建议人们在报告中使用只有字体扩展中提供
的字体。这是确保当报表在运行时执行
时,应用程序可以使用
字体的唯一方法。使用系统字体总是会带来
的风险,当部署在
没有安装这些字体的机器上时,报告无法正常工作。

We strongly encourage people to use in their reports only fonts that are provided in font extensions. This is the only way to be sure that the fonts will be available to the application when the reports are executed at runtime. Using system fonts always brings the risk that the reports do not work properly when deployed on a machine that does not have those fonts installed.

这篇关于JasperReports默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆