AnsweredAssumed Answered

Implementation of custom fonts in Jaspersoft

Question asked by UweKerntopf Employee on Feb 26, 2016
Latest reply on Feb 26, 2016 by am1

Hello,

has anyone successfully implemented a custom font in Jaspersoft and may share a step for step instruction?

Sharing a custom font in Studio is described here:

Custom Font with the Font Extension | Jaspersoft Community

but how does it look like for the runtime? I have added

net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory

net.sf.jasperreports.extension.fonts.spring.beans.resource=fonts.xml

to C:\apache-tomcat-7.0.55\webapps\reportservice\WEB-INF\classes\jasperreports_extension.properties,

put file fonts.xml in this folder with following content:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans

       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="myFontFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">

   <property name="name" value="Ericsson Capital TT"/>

   <property name="normal" value="fonts/EricssonCapitalTT.ttf"/>

   <property name="pdfEncoding" value="Identity-H"/>

   <property name="pdfEmbedded" value="true"/>

</bean>

</beans>

and created a subfolder fonts where I put the TTF and restarted Jaspersoft.

 

The result is, that I do not see the font in Advanced Reporting, but I see it, when I export the report to PDF or PPTX.

Outcomes