0

I am trying to include Hindi font using the font file mangal.ttf that i have kept on some file location. It was picking up this font earlier, but now all of a sudden, its not displaying any font on the resultant pdf. Dots are appearing instead of the characters. What could be the issue? please guide.

key = key.trim();
                 if(value.trim().equals("blank"))value="";
                 BaseFont unicode = BaseFont.createFont("html/fonts/mangal.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                 form.addSubstitutionFont(unicode);
                 ArrayList<BaseFont> fl = new ArrayList<BaseFont>();
                 fl.add(unicode);
                 form.setSubstitutionFonts(fl);
                 form.setField(key,StringEscapeUtils.unescapeHtml(value));
DevK
  • 38
  • 5
  • What did you change between the moment it was working and the moment it stopped working? Without that info, it's almost impossible to answer your question. Also: iText doesn't support ligatures, so the Hindi characters may not be displayed correctly. – Bruno Lowagie Apr 04 '14 at 14:09
  • Thank you for the reply sir. It was resolved. Actually, in the textfield component i had to set font style as Mangal(Mangal.ttf) (in open office org writer form controls, and then exporting it as pdf)which caused the appearence of hindi fonts as successful. But still i am wondering why didnt this happen earlier. Earlier i didnt have to such settings and it used to come itself irrespective of the font style set for the textbox component. I had implemented the change on the same code itself. There were no changes made to the code. I also tried FontFactory.registerDirectory(), Even that failed – DevK Apr 07 '14 at 08:55
  • If this question is solved you should publish your solution – Simon Jan 03 '17 at 00:27

0 Answers0