为什么我得到JRRuntimeException:无法加载以下字体,Helvetica?

时间:2016-04-07 09:45:47

标签: fonts jasper-reports export-to-pdf

我正在使用iReport 5.6和JDK 6.当我通过我的Java应用程序调用我的报告时,会出现此异常。 我使用了特殊的字体类型,并且已添加到iReport Libraries。

例外是:

**JRRuntimeException: couldn't load the following font:
pdfFontName: Helvetica
pdfEncoding: Identity-H
isPdfEmbedded: false**

不使用这种类型的字体,字体使用是特殊的,我给它起了一个名字" Arial"我已将其导入iReport的字体库。 我应该将这个ttf文件添加到java中,在哪里?为什么有关我不能使用的字体有例外。

2 个答案:

答案 0 :(得分:0)

如果您使用$("a").each(function() { // Here, 'this' is the current a element in the loop var currentClass = $(this).attr("class"); // Search for a figcaption element with the same class var correspondingFigcaption = $('figcaption.' + currentClass); if(correspondingFigcaption.length > 0){ // Here, 'this' is your a element // and correspondingFigcaption.get(0) is the first corresponding figcaption } }); 尝试将字体依赖项添加到Maven

pom.xml

否则,您需要在类路径中添加所需的字体。

答案 1 :(得分:0)

这是导出到pdf时itext库使用的默认字体

要避免此问题,您需要在jrxml中定义要使用的默认字体默认样式

<style name="default" isDefault="true" fontName="DejaVu Sans"/>

fontName对应于字体扩展名中包含的字体。