We are looking at building a WYSIWYG version of the font menu that appears in our application and we would like to follow a similar style to Indesign (i.e.: draw some sample text using each font rather than drawing the font name using each font).
At the moment the only technical hurdle we have is determining which sample text translation to use. To do this we need to determine the main / dominant language of that font. For example, Baghdad would be Arabic, Hiragino Sans GB would be Simplified Chinese and Hiragino Kaku would be Japanese.
I assume Indesign is using some an algorithm to determine the language rather than a long list of known fonts / languages but the question is how does it do it?
We already have an algorithm in our application that can determine all of the scripts used in a font by checking for glyphs in different Unicode ranges but this can't tell us what the main language is. I have also looked at the code page information for various fonts but even when the data is correct it normally lists multiple code pages so that doesn't help either.
Does anybody have any ideas on this?