Search code examples
javaitextitext7

How to set GPOS in iText 7 for thailand double mark above the letter


I need advice how to set GPOS in iText 7 for Thailand double mark above the letter.

PdfDocument pdf = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true);
PdfFont fontLoad = PdfFontFactory.createFont(font, PdfEncodings.IDENTITY_H);
form.getField("Text1").setValue("ตั้", fontLoad,20);
form.flattenFields();
pdf.close();

Actual Result

Actual Result

Expected result

Expected result


Solution

  • To get that extra positioning/interaction (see: ligatures) information from the font file, you would need pdfCalligraph, an iText 7 Core add-on.

    Without pdfCalligraph, I get:

    enter image description here

    where with pdfCalligraph, I get:

    enter image description here

    Which I believe is what you are looking for.