Errors when work with Font and Unicode!!!

By: Tam Nguyen Anh - tamnguyen
Errors when work with Font and Unicode!!!
2003-02-06 02:20
Hi all,
I have some troubles and raise them here:
1) When I set the pdfFontName="Courier", it's OK. But when I change it to "Arial", the compilation returns error(it's sure that I have Arial font on my machine which runs Win2000 Pro):
dori.jasper.engine.JRException: Could not load font from location : Arial

at dori.jasper.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1006)

at dori.jasper.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:346)

at dori.jasper.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:295)

I think that we must do something to insert font Arial into somewhere. But I don't know how. So, please help me.

2) Suppose that I use font Courier and insert some unicode text to the title of the report, I also get in stuck with it. The error mesage is similar to the above one. I see that if I change pdfEncoding from "Identity-H" to "Cp125x" or "Unixx-yyyy-z", the error is removed but I just receive the character '?' instead of expected unicode character.
How can I resolve this?
Thanks for any help,
Tam Nguyen.


Here's my xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="Report0005"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<parameter name="MyTitle" isForPrompting="true" class="java.lang.String"/>
<title>
<band height="50">
<staticText>
<reportElement
mode="Transparent"
x="16"
y="9"
width="105"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">
<font fontName="" pdfFontName="Courier" size="16" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="Identity-H" isStrikeThrough="false" />
</textElement>
<text><![CDATA[THE TITLE: ]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="144"
y="7"
width="380"
height="24"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">
<font fontName="" pdfFontName="Courier" size="16" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="Identity-H" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{MyTitle}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="50">
</band>
</pageHeader>
<columnHeader>
<band height="30">
</band>
</columnHeader>
<detail>
<band height="50">
</band>
</detail>
<columnFooter>
<band height="30">
</band>
</columnFooter>
<pageFooter>
<band height="50">
</band>
</pageFooter>
<summary>
<band height="50">
</band>
</summary>
</jasperReport>





By: Tam Nguyen Anh - tamnguyen
RE: Errors when work with Font and Unicode!!!
2003-02-06 02:24
I also examine the examples of Teodord about Font and Unicode and I can't run them successfully. The error message is the same to mine.




By: Cesar A. Correia - cesarac
RE: Errors when work with Font and Unicode!!!
2003-02-06 04:02
Try add diretory of TTF fonts to classpath.




By: Cesar A. Correia - cesarac
RE: Errors when work with Font and Unicode!!!
2003-02-06 04:49
Hi,
I don't know it help:
I note that when I have TTF fonts and others fonts in same report this error occur:
ã©s changed to ?
When i use only ttf fonts all is fine.





By: Tam Nguyen Anh - tamnguyen
RE: Errors when work with Font and Unicode!!!
2003-02-06 18:13
Hi Cesar and everyone,
I did as Cesar guided and fixed the problem. But I wonder one thing: When do we need to use Cp125x and when we use Identity-H? What are the differences between them?
Thanks,
Tamnguyen




By: eric teo - duckizz
RE: Errors when work with Font and Unicode!!!
2003-02-11 22:20
sorry do u add to yr system classpath or to the tomcat server classpath ?
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 10 months ago

0 Answers:

No answers yet
Feedback
randomness