如何做到字体平滑的AWT / Swing应用程序? [英] How to do Font Smoothing for AWT/Swing Application?

查看:140
本文介绍了如何做到字体平滑的AWT / Swing应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Windows系统中的应用AWT做字体平滑。
做谷歌搜索我才知道,我可以按照在Eclipse VM参数设置。

I need to do font smoothing for a AWT application on Windows System. On doing googling I came to know that I can set following VM argument in Eclipse.

-Dawt.useSystemAAFontSettings=gasp

但是,这没有产生任何积极的结果。
如果有人正在对如何实现字体平滑更好的想法,那么请让我知道。

But this is not yielding any positive results. If anyone is having a better idea on how to achieve Font Smoothing, then kindly let me know.

修改回答后安德鲁

我添加code的片断在paint方法

I added the following snippet of code in paint method

public class BottomSubmitButtons extends Canvas {

@Override
public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D)g;
    RenderingHints rh = new RenderingHints(
            RenderingHints.KEY_TEXT_ANTIALIASING,
            RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    g2.setRenderingHints(rh);
}
}

这似乎在子板之一提高了平滑。
但在其他面板做同样没有产生任何平滑。另外,文本字段箱会在默认情况下不可见的,但有一次我在这方面他们点击变为可见

This seems to have improved the smoothing in one of the sub panel. But doing the same in other panel is not yielding any smoothing. Also the TextField boxes are going invisible by default, though they becomes visible once I click in that area

推荐答案

与<一个值播放href=\"http://download.oracle.com/javase/8/docs/api/java/awt/RenderingHints.html#KEY_TEXT_LCD_CONTRAST\"相对=nofollow> RenderingHints.KEY_TEXT_LCD_CONTRAST 。当你发现一些作品,用其作为命令行值。

Play with the values for RenderingHints.KEY_TEXT_LCD_CONTRAST. When you find something that works, use that as the command line value.

这篇关于如何做到字体平滑的AWT / Swing应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆