waybillmak Posted December 14, 2009 Share Posted December 14, 2009 Hi,I have a report, Transcript, created using iReport in Linux environment, showing course title in English and Chinese in the same field. The field reads fields(stored with unicode) from mySQL with font described asFont name MSung-LightPdf Embedded truePdf Encoding UniCNS-UCS2-H (Chinese traditional)---Linux FC8jasperreport 3.1.0ireport 2.0mysql-connector-java-3.1.14.bin.jaritext-2.0.4.jaritextAsian.jarIn preview using JViewer, the apostrophe showed in the preview BTCT301 APOLOGETICS IN THE CHURCH'S MINISTRY è·æ•™å¸èˆ‡æ•™æœƒäº‹å·¥A. Then, I write a jsp program to call jaspereport to run the same report in window XP. When I view the pdf using Acrobat Reader 8.0, the apostrophe is missing BTCT301 APOLOGETICS IN THE CHURCH S MINISTRY è·æ•™å¸èˆ‡æ•™æœƒäº‹å·¥B. However, when I copy the same pdf output back to Linux system, and view using Evince, the apostrophe appears.Can you tell me how to solve the problem?Thanks. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted December 14, 2009 Share Posted December 14, 2009 Hi, You are using a built-in Chinese font in PDF. I'm not sure about the ability of this font to support both English and Chinese, or mixed language anyway.The advantage of using an Acrobat Reader built-in font is that it produces smaller PDF files, because it relies on those fonts being available on the client machine that display the PDF, through the pre-installed Acribat Asian Font Pack.However, using the PDF built-in fonts has some disadvantages that were discovered through testing on different machines, when we investegated a similar problem related to a built-in Korean font.If you have the time and will to do so, you can go through this very long thread to see what were the challenges:http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=63546&page=3 The conlusion was that depending on the machine that views the PDF, Acrobat Reader uses different system TTF fonts, for the same built-in PDF font name in the report. So you are never sure about which TTF file gets resolved to, thus you are not sure about the font metrics of that font and you end up with the same old story in which text does not wrap the same, does not fit, etc.So we advise you to get a TTF file that you know supports all the languages you need, wrap it in a JR font extesion JAR and use it, instead of relying on Acrobat Reader built-in fonts, which you never know what they are. Using a TTF file that you deploy with the reports ensure you always use a font that you know you ship with your reports and there is never a risk of JR using some unexpected fallback font that would cause you all those troubles.If you use an older version of JR, which did not have support for font extensions, you just need to make sure the font you pick is available to the JVM at runtime (install it on the fly with Font.createFont()) and also make it part of the classpath so that you can point to it using the pdfFontName attribute. pdfEncoding would probably be Identity-H, while isPdfEmbeded has to be true.One font we know is good in these situations is the Microsoft Arial Unicode font. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now