JasperReports Default Font
Asked Answered
B

1

6

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

By answered 10/11, 2011 at 13:46 Comment(0)
W
8

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.

Winchester answered 10/11, 2011 at 14:17 Comment(6)
jeah I'v already set this property, but i still have to disable ignore.missing.font... Is there a way to ignore missing fonts only on specific fields?By
@By And what is your question? I thought it was: is there a way to set a default font ...Winchester
Yeah, but keep ignore.missing.font enabled... There is only one field where fonts are not always available, so I want turn off font checking only for this fields.By
And what about setting style for this element?Winchester
then I get an JRFontNotFoundException if a User used a unknown Font. But i want use all known fonts.By
Ok. Do you have a font that is 100% installed on all users PC and on the server?Winchester

© 2022 - 2024 — McMap. All rights reserved.