JasperReports Default Font

2019-01-19 05:46发布

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.

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.

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.)

1条回答
干净又极端
2楼-- · 2019-01-19 06:07

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:

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.

查看更多
登录 后发表回答