I’m testing the new version of Aspose.Words 26.1 and have found an issue with thai text.
I’m opening a docx file then define the font folder source for Aspose and save the document as pdf.
The result document shows boxes instead of the actual text.
When using the same code with version 25.2 the pdf document looks fine.
Can you please help me to solve the issue?
Here is the document and the font I load in Aspose for the thai text. Thai Test.docx (13.9 KB)
You reported an issue with Thai text rendering in Aspose.Words 26.1, where Thai characters appear as boxes in the generated PDF, while the same code worked correctly in version 25.2 . This could be due to changes in font handling or text rendering logic between these versions .
This type of issue has been previously observed with Thai text in Word to PDF conversions using Aspose.Words , suggesting it might relate to how the library handles Thai language fonts or character mapping in newer versions .
To help resolve this issue, we recommend:
Ensure that all required Thai fonts are properly loaded into Aspose.Words using FontSettings and FontSourceBase .
Try setting the font explicitly for Thai text content in your document before conversion.
If possible, test with a minimal reproducible example to isolate whether the issue is with specific fonts or general Thai text handling.
A support engineer will follow up in this thread if more information is needed.
Thank you for your code example
With your code example it works.
I used the function SetFontsSources to set the font folder instead of SetFontsFolder.
The thai font is not shown when I use that function with your code example.
Here is my code to set the folder:
@cternek As I can see in the attached PDF document there is only Arial font, but Angsana New is not used. Please make sure the Angsana New font is available in the specified font sources.
@alexey.noskov
The font folder contains the Angsana New font file.
I’ve sent the font file in my initial post.
The problem seems to be the function SetFontsSources.
It seems that the function SetFontsSources doesn’t load or find the Angsana New font file.
Please note that I use .Net Framework 4.6.2.
It doesn’t work when using this code line:
Aspose.Words.Fonts.FontSettings.DefaultInstance.SetFontsSources(new Aspose.Words.Fonts.FontSourceBase[] { new Aspose.Words.Fonts.SystemFontSource(), new Aspose.Words.Fonts.FolderFontSource("C:\\Temp\\Fonts", true) });
@cternek Please try using the following method to check what fonts Aspose.Words sees in the specified font sources:
/// <summary>
/// Prints the fonts available in the specified font settings.
/// </summary>
public static void PrintAvaialbleFonts(FontSettings fs)
{
foreach (FontSourceBase fsb in fs.GetFontsSources())
{
Console.WriteLine(fsb.Type);
foreach (PhysicalFontInfo pfi in fsb.GetAvailableFonts())
{
Console.WriteLine(pfi.FullFontName);
}
Console.WriteLine("================================================");
}
}
Aspose.Words.Fonts.FontSettings.DefaultInstance.SetFontsSources(new Aspose.Words.Fonts.FontSourceBase[] { new Aspose.Words.Fonts.SystemFontSource(), new Aspose.Words.Fonts.FolderFontSource("C:\\Temp\\Fonts", true) });
PrintAvaialbleFonts(Aspose.Words.Fonts.FontSettings.DefaultInstance);
@cternek Most likely when you use FallbackSettings.BuildAutomatic() Aspose.Words pics some other font from the System font source. Please try saving FallbackSettings to XML: