The correct way to go is using font-extensions. pdfEncoding="Identity-H"
is deprecated.
First clear this checklist to render font in pdf:
- Is my actual
.tff
supported (OpenType) and can the font actually render the character. Not all fonts render
all characters in UTF-8
Once you have created correctly font extension and its not working this is probably your problem..
- Do I pass correct encoding to iText. In doubts (or in general) use
the encoding Identity-H this is recommend for newer PDF standards
and gives you the ability to mix different encoding.
Identity-H seems ok
- Is my font embedded so that if I share the pdf also computers not
having this font can display the content.
Embed your font (otherwise if you make it work on your computer it may
not work on others), note in your jrxml is isPdfEmbedded=false
, remove tag and in font-extension select true
or set tag to true
.
Now just generate the font-extension correctly and add it to your classpath
,
How to add font extensions
EDIT: After user passed font
The font Krutidev_011.TTF
is not a valid ttf font it maybe because unfortunately the standard according to Apple and the standard according to Microsoft diverged (my guess your font is an apple ttf not an open type ttf).
Caused by: net.sf.jasperreports.engine.JRRuntimeException: java.awt.FontFormatException: java.nio.BufferUnderflowException
at net.sf.jasperreports.engine.fonts.SimpleFontFace.setTtf(SimpleFontFace.java:178)
I tried to download a valid ttf font Lohit Devanagari from the web and add it as font extension, fontName="Lohit Devanagari"
this is my result:

It is rendering the fonts but the result may have Ligaturizer problem, for how to solve these see for example Why is the Gujarati-Indian text not rendered correctly using Arial Unicode MS?
If you like to try this is the font-extension I used font extension jar for Lohit Devanagari, remember to set fontName="Lohit Devanagari"