Hi I am using Docx4j to convert word template to PDF. But Tamil font is not supported. It looks weird. I used below java code that seems to reduce the weird look, still words are not displaying correctly. I have installed Latha as Tamil font. Pls help
FontTablePart fontTablePart= wordMLPackage.getMainDocumentPart().getFontTablePart();
fontTablePart.processEmbeddings();
Set<String> fontsInUse = wordMLPackage.getMainDocumentPart().fontsInUse();
// Make each embedded font available to the font mapper.
for(String s : fontsInUse) {
System.out.println("Font in use : "+s);
PhysicalFont physicalFont = PhysicalFonts.get(s);
fontMapper.put(s, physicalFont);
}
Sample XML that I am trying to convert:
<w:body><w:p w14:paraId="33C1CF30" w14:textId="77777777" w:rsidR="000612C7" w:rsidRDefault="000612C7" w:rsidP="000612C7"><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>ஆசிரியர்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>வகுப்பறையுள்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>நுழைந்தார்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>.</w:t></w:r></w:p><w:p w14:paraId="2D364612" w14:textId="77777777" w:rsidR="000612C7" w:rsidRDefault="000612C7" w:rsidP="000612C7"><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>அவர்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>உள்ளே</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>நுழைந்தவுடன்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>மாணவர்கள்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>எழுந்தனர்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>.</w:t></w:r></w:p><w:p w14:paraId="162AEE05" w14:textId="77777777" w:rsidR="000612C7" w:rsidRDefault="000612C7" w:rsidP="000612C7"><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>வளவன்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>மட்டும்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>தன்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>அருகில்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>நின்றுகொண்டிருந்த</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>மாணவி</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>கனிமொழியுடன்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>பேசிக்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:proofErr w:type="spellStart"/><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>கொண்டிருந்தான்</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>.</w:t></w:r></w:p><w:p w14:paraId="2CF16F1C" w14:textId="07F9E241" w:rsidR="00E46BC8" w:rsidRPr="000612C7" w:rsidRDefault="000612C7" w:rsidP="000612C7"><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>நான்</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>அவனை</w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r><w:rPr><w:rFonts w:cs="Latha" w:hint="cs"/><w:cs/><w:lang w:bidi="ta-IN"/></w:rPr><w:t>எச்சரித்தேன்</w:t></w:r></w:p><w:sectPr w:rsidR="00E46BC8" w:rsidRPr="000612C7" w:rsidSect="00BB36CE"><w:headerReference w:type="default" r:id="rId11"/><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1702" w:right="4162" w:bottom="576" w:left="1440" w:header="284" w:footer="450" w:gutter="0"/><w:cols w:space="708"/><w:docGrid w:linePitch="360"/></w:sectPr></w:body></w:document>