Rendering Sinhala unicode fonts in Java
I'm making a unicode Sinhala-English translator. When I print a Sinhala unicode letter with font size < 100, the letter is not correctly rendered. But when I use font size > 100, all letters are rendered smoothly. I can't find why this happening. On the other hand, all Sinhala unicode fonts do the same & it's not a bug of the font开发者_如何学JAVA that I used. An Example is shown here.
Please help me.
I'm not aware that Java uses its own font rendering on Windows 7. So it should be a Windows bug but if that was the case, you'd see the problem in all Windows apps - but you see it only in Java.
You may want to try the Java 2D API. For example render the font with 140px and scale the Graphics2D
by 0.5 to get 70px fonts.
[Old answer]
You're not saying which OS but my guess is that this is on Linux. If that's the case, then it might be because of "font hinting" in FreeType.
Basically, if a font becomes "too small" to render, the true type file can contain "render hints." In your example, you can see that the large font has smooth edges but the small example is more square-edged. You can see the pixels; anti-aliasing should prevent that.
So my guess is that you're a victim of the Font Hinting patent. The patent in question has expired last year. Try to find a newer version of "freetype" for your system.
精彩评论