Jump to content
We've recently updated our Privacy Statement, available here ×

How to use MingLiu font in ireport


robinlaw

Recommended Posts

How to use MingLiu font while export to pdf?
I have been install MingLiU font in "Tools" -> "Options" -> "Fonts" -> "Install Font"
I can select MingLiU font and preview are fine. However, export to PDF the text is not in MingLiU font.

Any suggestion? Thanks a lot!!

Following the below error message:

 

Error exporting print... com.lowagie.text.DocumentException: Font 'MingLiU' with 'Identity-H' is not recognized.
 net.sf.jasperreports.engine.JRRuntimeException: com.lowagie.text.DocumentException: Font 'MingLiU' with 'Identity-H' is not recognized. 
    at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:1987) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1725) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1694) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2177) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:778) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:738) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:616) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:385) 
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1156) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 
Caused by: com.lowagie.text.DocumentException: Font 'MingLiU' with 'Identity-H' is not recognized. 
    at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source) 
    at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source) 
    at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source) 
    at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:1975) 
    ... 10 more   

 

Code:
<textField>				<reportElement x="0" y="0" width="65" height="20"/>				<textElement>					<font fontName="MingLiU" size="7" isBold="true" pdfFontName="MingLiU" pdfEncoding="Identity-H" isPdfEmbedded="false"/>				</textElement>				<textFieldExpression class="java.lang.String"><![CDATA["MHQ"]]></textFieldExpression>			</textField>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I'd first like to thank jpauze for some really helpful answers in several other threads.

But next... please don't use the property Pdf Font name in your report. Don't use Pdf Embedded. Don't use Pdf Encoding. This is covered in quite a few other threads like this one.

Also, it's wrong (or at least misleading) to say "make sure the MingLiU font is on the classpath". Rather you need to make sure that the font extension in on the classpath. This is automatic in iReport so there should be no problem there. You'll also need to do that in your application.

robinlaw, it sounds like you started correctly. You need to define the font extension in "Tools" -> "Options" -> "Fonts" -> "Install Font". Perhaps the problem is that you also defined those terrible horrible no good very bad deprecated properties: pdfFontName, pdfEncoding, and isPdfEmbedded. Start by unsetting those. Perhaps it's enough to solve the issue.

If it's still not working, try creating the font extension again with a clearly different name. Call it "My_MingLiU". The font extention maps "My_MingLiU" to "mingliu.ttf" (or whatever the font file is actually called). Make sure you set the font as "My_MingLiU". It ought to work once the font extension is being used.

The thread linked above includes a link to an article I wrote a couple of years ago about using font extensions.

Good luck,
Matt

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...