📜 ⬆️ ⬇️

Cyrillic in .NET applications under Mono

.Net applications that use WinForms may well work under Mono, but in some Linux distributions, instead of Russian fonts, users see slender rows of squares and a dispersed interface.


Studying the problem showed that in different Linux distributions on the same version of mono (in particular, 2.4.2.3), the program had both a normal interface and squares. The search for a solution on the Internet led to the description of the problem with the driver for Intel video cards in Ubuntu xserver-xorg-video-intel. Dozens of different topics on the English-language forums that describe this solution using the latest driver. For example, here and here . However, in practice, updating the drivers did not solve the problem.
The second most popular tip is that installing the msttcorefonts font package didn't help either. However, digging a little to the side, we found that if the program explicitly used simple fonts, like Arial, the problem of squares disappears. It turned out that the Ms Sans Serif font, which is used by default for all forms on WinForms, is to blame. Apparently, the font that replaces it in Ubuntu 9.04 contains Cyrillic, but since 9.10 this font is already without Cyrillic.

If the program is yours, then it is quite possible to change the font in it to Arial, or another one available in your distribution, although under Windows the application will look different from others. If there is no source code or desire to change the application, installation of additional fonts will help. With Windows itself, it will be much easier to take the micross.ttf file from C: \ Windows \ Fonts and put it in any subdirectory of / usr / share / fonts / truetype / (I called my winfonts and collected all windows fonts in it). You can also use the FontViewer application, which is associated with .ttf files and install the font using it.


After installing the fonts, you just need to restart our application and everything falls into place

')
We hope that this simple solution will help you too,% username%. We have not experimented with other solutions for a long time, but we will be happy to find out how else this problem can be solved with the source code of the application. Maybe in mono there is an opportunity to set the used fonts in the configuration?
Looking forward to hear comments and suggestions. The ideal solution is without the need for user participation and global font changing in all forms and controls.

Upd1: There is another way.
- opened DejaVu Sans using FontForge
- Changed in the ttf info section the font name on Microsoft Sans Serif
- Clicked Generate ttf
- The result was copied to the font directory.
This method solves the problem of having a license for Windows.

PS We are xeon and my colleague fo2rist, who so far does not have an invite to Habrahabr. If you have a free invite and desire to help, write me a private message. Thank.

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


All Articles