Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JasperReports Default Font

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

like image 266
itshorty Avatar asked Nov 10 '11 13:11

itshorty


People also ask

How do I change font size in Jasper report?

Use the <style/> element instead. fontName The font name, which can be the name of a physical font, a logical one or the name of a font family from the registered JasperReports font extensions. size The size of the font measured in points. It defaults to 10.

What language does Jaspersoft use?

The default expression language is Java, but if you are not a programmer, we recommend that you design your projects with JavaScript or Groovy because those languages hide a lot of the Java complexity.


1 Answers

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.

like image 93
Alex K Avatar answered Sep 20 '22 13:09

Alex K