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

前端 未结 4 1441
迷失自我
迷失自我 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:30

    Using Swing, I'm able to get the right text anti-aliasing hint like this:

    JLabel label = new JLabel();
    FontMetrics fm  = label.getFontMetrics( label.getFont() );
    Object aaHintValue = fm.getFontRenderContext().getAntiAliasingHint();
    

    On my system this returns RenderingHits.VALUE_TEXT_ANTIALIAS_LCD_HRGB.

提交回复
热议问题