We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Find a default font mapping for doc with languages

Given a Doc/Docx containing text with English + any other language (chinese, hebrew etc)
I would like to convert it to PDF correctly .

In many cases our system won’t have the font that the doc/docx uses since there are many possible fonts that could be used.
Ideally we’d want to default to a single font that supports every language, but this is not possible since truetypes (.ttf) can only hold a certain amount of glyphs.

Alternatively we can detect the language for each piece of text in the Document and assign the text to a font that supports the language in that text.
However, it doesn’t seem like there is a way for Aspose to do this.
Aspose offers run.getFont().getLocaleID, run.getFont().getLocalBI, and run.getFont().getLocalFarEastAsia and based on the locale we can get a font that supports the language indicated by that locale, however, given the text which one of these three should we use?

Why does Aspose offer 3 different methods for getting the locale rather than just one method to get the locale?

Ideally I’d want one locale returned and depending on that locale I would map it to a font I have that supports that locale


We are checking this scenario and will get back to you soon.


Please consider the situation where one Run node has three characters (glyphs). One of them is regular formatted character, the second one is Arabic (right-to-left) character, and the third one is Japanese (Asian) character. For this case, it is not possible to return one LocaleID for this Run. That is why we have three different LocaleIDs for all possible types of characters. If there is no specific character in one language (for one locale), you will have to try to find it in other one. Hope, this helps.

“If there is no specific character in one language (for one locale), you will have to try to find it in other one.”
How would you implement this, could you elaborate?


We are investigating this scenario further and will get back to you soon.


Font Table in Aspose.Words DOM (Document Object Model) is represented by FontInfoCollection class. The general font substitution algorithm calculates the distance from FontInfo for all available font sources and selects the one with the lowest distance. We would suggest you please refer to the following article for more details:
True Type Fonts