I want to write this text (व्यक्तियों) into my pdf, which is a Hindi language text. So, at first I pasted the text in MS-word to find out that the font it was using was Arial Unicode MS.
I downloaded the file Arial Unicode MS.ttf and added it into my jsPDF() object;
let doc = new jsPDF();
doc.addFileToVFS('arial-unicode-ms-normal.ttf', "base64encoded font");
doc.addFont('arial-unicode-ms-normal.ttf', 'arial-unicode-ms', 'normal');
Now, I tried writing the text into my pdf:
doc.setFont('arial-unicode-ms', 'normal');
doc.setFontSize(12);
doc.text(10,12,"व्यक्तियों");
doc.save("file.pdf");
The word gets printed as वयकत ियो which as you can see is completely incorrect. The characters व and य which when interjected becomes व्य and also क and त which when interjected becomes क्ति (please ignore the umbrella shaped character in the left), get broken down into single characters in the pdf. Why is that? I am using the same font that's being used in MS word to display the text. How do I fix this issue? Please help me.
I am using this version of jsPDF:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"></script>