Jump to content
Changes to the Jaspersoft community edition download ×

Dynamically switch font


sebpra

Recommended Posts

Hi all,



I generate reports where data might be in different languages. Until now I was OK using single Dejavu Sans font, but now I need to support Chinese language as well and Dejavu Sans font fails to represent Chinese glyphs.



Is there a way dynamically switch font to a different one if default one cannot represent text correctly?



I don't think 'locale' feature will help me as data for PDF report to fill comes from same internal system in different languages. P.S. I use XML as data source.



I use jasper reports 5.5.1 and if I am right font subset feature was introduced only in 6.2.2. I would prefer avoiding upgrade if possible. 



To make sure PDF layout looks the same across the platforms I embed font to PDF.



 



I would really appreciate any help or ideas how to solve this. I tried to go through the community but unfortunately couldn't find suitable solution. If I missed any, please excuse me for that.



At the moment I have one possible option in my mind. Which is to check if field content glyph numbers(char converted to int) falls into font supported range and if not switch font. I haven't tested this idea yet but I have a feeling that this will increase generation time and load a lot if it is possible at all.



By the way I tested MS Arial unicode font and this font does the job, unfotunately it is really expensive. Maybe you know good substitute for it?


Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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...