English characters are not displayed when entering text using Swing's indicator input method

I am working on an application that accepts English text and transliterates using a third-party index language API (one of several supported). The application is designed for Windows XP / 7 and Ubuntu. We use a custom input method that loads the desired font and uses its visualizing text. In addition, the user can correct the transliterated text by typing in English and pressing the space bar (similar to how Google Transliterate works).

The problem is that with certain language fonts, typing in English, empty characters appear in the field (even if the actual characters entered are detected and transliterated accordingly).

I used the ttf-indic-fonts-0.5.0 font set that comes with Ubuntu and was able to replace some of them. For the rest, if I copy the corresponding font from Windows (I develop this in Windows 7), then all problems are solved.

However, we cannot distribute Windows fonts with our application and want an open alternative.

Besides the fact that we are trying to find a replacement font, is there something else that we are doing wrong or need to check to make sure that English characters can be entered into the JTextField when the display font is used?

As an example, from the Ubuntu package mentioned above, for lojit_pa.ttf for Punjabi there is this problem. If I copy the default Windows font for Punjabi (raavi.ttf), then it works fine.

+2
source share
1 answer

I found a solution to the problem. I installed the fonts on Windows (open the font, click "Install") and viewed the contents using the "Symbol Map". These fonts have only glyphs for a given language, not English. I used FontForge to combine 2 fonts. (The author of Fontforge no longer provides binary files, but if you have access to Ubuntu, you can install it from the repository. There is no such luck if you only have Windows). After that, I can print again in English.

0
source

Source: https://habr.com/ru/post/1383727/


All Articles