Unicode Sinhala font rendering in Java

I am making a translator from Sinhala English Unicode. When I print a Sinhala unicode letter with a font size <100, the letter does not display correctly. But when I use font size> 100, all letters are displayed smoothly. I can not find why this is happening. On the other hand, all Sinhala unicode fonts do the same, and this is not a font error that I used. An example is shown here .

Please help me.

+6
source share
1 answer

I don’t know that Java uses native font rendering in Windows 7. Therefore, this should be a Windows error, but if so, you will see the problem in all Windows applications, but you only see it in Java.

You can try the Java 2D API . For example, make a font with 140px and scale Graphics2D by 0.5 to get 70px fonts.

[Old answer]

You do not say which OS, but I assume that it is on Linux. If so, it could be due to a “hint of font” in FreeType .

Basically, if the font becomes “too small” for rendering, a true file type may contain “visualization hints”. In your example, you can see that the large font has smooth edges, but the small example is more square. You can see the pixels; smoothing should prevent this.

Therefore, I assume that you have fallen victim to the Font Hinting patent. The patent in question expired last year. Try to find a newer version of "freetype" for your system.

0
source

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


All Articles