How can I inherit the system's anti-alias setting for painting text to off-screen images like swing does?

前端 未结 4 1426
迷失自我
迷失自我 2021-02-14 00:39

When I run my swing GUI applications under Java 6, they automatically use my configured sub-pixel anti-alias settings for all fonts. The result is much improved over standard A

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-14 01:22

    java.awt.Toolkit.getDesktopProperty("awt.font.desktophints") appears to be null on linux, at least without any special vm command line options, presumably because it's unable to figure out what the platform defaults are.. adding e.g "-Dawt.useSystemAAFontSettings=lcd" seems to cure it and enables subpixel rendering if you set the hints on your Graphics2D instance.

提交回复
热议问题