Noto Fonts Thai Second Level Characters Comes in First Level

Hi,

We are trying to generate our document where in the document is generated in thai language with the noto fonts theme. The issue is the second level characters are coming in the first level. But this is not the case when using Arial Font. Failing one is Noto and Correct one is Arial. Also tested with latest version of java aspose words also i.e 23.2

@kavita09 Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.

The problem might occur because font open type features are used. A separate Aspose.Words.Shaping.Harfbuzz package provides support for OpenType features in Aspose.Words using the HarfBuzz text shaping engine. You should enabling open type features . To achieve this you should add reference to Aspose.Words Shaping Harfbuzz plugin:

<dependency>
	<groupId>com.aspose</groupId>
	<artifactId>aspose-words</artifactId>
	<version>23.1</version>
	<classifier>shaping-harfbuzz-plugin</classifier>
</dependency>

and use the following code for conversion:

Document doc = new Document("C:\\Temp\\in.docx");

// Set fonts sources if required.
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{new FolderFontSource("C:\\Temp\\fonts", true)});

// Enable open type features
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());

doc.save("C:\\Temp\\out.pdf");


The above fix did not work. But still attaching the template and the xmlOIS199PF Customer Invoice - NOTO.docx (96.1 KB)

@kavita09 Thank you for additional information. As I can see the problematic text is formatted with Leelawadee UI font. If this font is used the document is rendered properly. I have simplified the original document and converted it to PDF using MS Word and Aspose.Words and as I can see it looks correct:
in_simplified.docx (57.8 KB)
ms.pdf (17.3 KB)
out.pdf (12.5 KB)

You have mentioned that the problem occurs when Noto fonts are used. So I suppose the font originally used in the source document is not available in the environment where the document is converted to PDF and is substituted with Noto font. Could you please attach this font here for testing? Have you tried converting your document to PDF using MS Word when this Noto font is used in the document?

We are expecting the fifth character to come on second level rather than first level (please see the attached image which is correct for arial unicode)leelawad.zip (55.3 KB)
. Please find the attached images and font.ThaiCharacters_ArialUnicode.png (22.8 KB)

@kavita09 Could you please attach PDF that shows the correct rendering of the simplified document I have attached. I have tried rendering the document using Aspose.Words and Arial Unicode font and still the 5th character is rendered on the first level: out.pdf (20.7 KB)

Also, as you can see MS Word also shows the 5th character on the first level when Leelawadee UI font is used. So this might be a font peculiarity.

GeneratedPreviewDocument_2023_03_07-03_12_39_273.pdf (100.2 KB)

@kavita09 Thank you for additional information. Yes, I see both MS Word and Aspose.Words render the 5th character on the second level when Arial Unicode MS font is used. But on other hand both MS Word and Aspose.Words render the 5th character on the first level when Leelawadee UI used. Since the rendering results are the same with the same fonts, I do not think there is a defect in Aspose.Words. It looks like this is a peculiarity of Leelawadee UI font.

Ok. Thank you for your support.

1 Like

Can you’ll please convert this ticket to public as i am unable to do so?

@kavita09 Sure, I have made the topic public.

1 Like