我们正在使用Jasper报告4.x.在jasperreports-fonts-4.5.0上嵌入字体后,它可以正常使用Unicode字符集,如阿拉伯语,Bangla和Jasper Viewer中的SolaimanLipi。但是当我尝试pdf报告时。阿拉伯语&英文字体渲染得很好,但是孟加拉字体并没有充分展现出希望。
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BANGLA" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2f940500-af46-4cbf-97d6-710e159ff606">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[SELECT
t01i001.`F_ID` AS ID,
t01i001.`F_REVISION` AS REVISION,
t01i001.`F_REGISTER_DATE` AS REGISTER_DATE,
t01i001.`F_REGISTER_USER` AS REGISTER_USER,
t01i001.`F_REVISION_DATE` AS REVISION_DATE,
t01i001.`F_REVISION_USER` AS REVISION_USER,
t01i001.`F_NAME_BN` AS NAME_BN,
t01i001.`F_NAME_EN` AS NAME_EN
FROM
`t01i001` t01i001]]>
</queryString>
<field name="ID" class="java.lang.Long"/>
<field name="REVISION" class="java.lang.Long"/>
<field name="REGISTER_DATE" class="java.sql.Timestamp"/>
<field name="REGISTER_USER" class="java.lang.Integer"/>
<field name="REVISION_DATE" class="java.sql.Timestamp"/>
<field name="REVISION_USER" class="java.lang.Integer"/>
<field name="NAME_BN" class="java.lang.String"/>
<field name="NAME_EN" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement uuid="9e2ca429-638e-4bf0-a2f9-a40c5edbecf7" x="0" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[ID]]></text>
</staticText>
<staticText>
<reportElement uuid="e502c14f-a347-4fe5-bd15-fbf85d7ebeee" x="100" y="0" width="214" height="20"/>
<textElement/>
<text><![CDATA[NAME_EN]]></text>
</staticText>
<staticText>
<reportElement uuid="156fd960-8182-437f-8a9b-90a89467b1bc" x="314" y="0" width="241" height="20"/>
<textElement/>
<text><![CDATA[NAME_BN]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="1f6fc0f9-33da-4c1c-b97f-4d9e1c975958" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="1986cb1d-ca64-4edc-b74b-c6a49f2549cc" x="100" y="0" width="214" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{NAME_EN}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="4d439fed-f786-44cb-bf31-128a9e8ee3a2" x="314" y="0" width="241" height="20"/>
<textElement>
<font fontName="SolaimanLipi" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{NAME_BN}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
这里我使用了jasperreports_extension.properties
net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.dejavu=net/sf/jasperreports/fonts/fonts.xml
在以下条目后面的fonts.xml中
<fontFamily name="SolaimanLipi">
<normal>net/sf/jasperreports/fonts/rdp/SOLAIMANLIPI.ttf</normal>
<bold>net/sf/jasperreports/fonts/rdp/SOLAIMANLIPI.ttf</bold>
<italic>net/sf/jasperreports/fonts/rdp/SOLAIMANLIPI.ttf</italic>
<boldItalic>net/sf/jasperreports/fonts/rdp/SOLAIMANLIPI.ttf</boldItalic>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
</fontFamily>
然后我用自己的字体集重建jar文件
例如,如下所示:
我刚刚如上所述进行了虚拟实现。任何解决方案?
答案 0 :(得分:1)
我有解决此问题的方法,首先需要使用Bijoy编码,然后使用任何Bijoy unicode字体(DestinyMJ)。
গোপালগঞ্জbijoy编码->†MvcvjMÄ
{NAME_BN} ='†MvcvjMÄ';
它将正确打印。