I implemented the solutions proposed and was able to get the glyphs and the glyph order as intended.
However, in this version, an additional space is being added after each glyph (not always, sometimes there is a space, sometimes there is not) rendered into the pdf. This is something which was not happening in the previous implementation where the glyphs and character order was incorrect, but there was no space issue.
The current version was created by using the following steps -
1. An input string (the one in the attached pdf, and mentioned initially in the thread) was input to the harbuzz function which returned the values of the codepoints for the glyphs. The font I used was 'Noto Sans', which was downloaded from google fonts.
2. The codepoints were then combined as a single array of only the codepoints, and was input to the 'FPDFText_SetCharcodes' function.
Here is what the text should look like - '
मैं घोषणा, पुष्टि और सहमत हूँ कि'. The attached file 'example.pdf' contains the old version created without harfbuzz, and the file 'example new.pdf' contains the file containing the text created using the above mentioned two points.
How can I improve the 'example new.pdf' file? Since, as it stands the new version is very close to the intended output.