KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been attempting to enhance my GUI system written in Java to use subpixel antialiasing and have been successful, except for two remaining anomalies. This is a follow on to my other question from a few weeks ago . The first problem is that setting rendering hints KEY_ANTIALIASING to VALUE_ANTIALIAS_ON causes KEY_TEXT_ANTIALIASING to be ignored when it is set to an LCD (subpixel) AA value. Can anyone shed some light on this? Currently I am forced to VALUE_ANTIALIAS_OFF before rendering text and turn it back on after rendering text (so that other painting, like circles, etc, is AA'd). This problem is proven by the self-contained test program below. The second problem is that I can find no way to query the underlying O/S setting for AA, so I have to do a rather kludgey workaround, which is to create a Swing JLabel , get it's FontMetrics , get it's FontRenderContext and then get the AA hint from that. Apart from involving Swing in a program that otherwise makes absolutely no use of Swing, it will not work on a device running any J2ME JVM. Can anyone suggest a better way to do this? It's OK if it requires J5 or J6, since the current kludge already requires J6 (but needing only J4 would be best). I have already tried every default setting and using an AWT component instead of JLabel . Test Program This program verifies that for subpixel AA to work, the general AA setting must first be disabled. (PS: I write to a back-buffer because my underlying GUI does, and I wanted to test in an equivalent context). import java.awt.*; import java.awt.event.*; public class AwtTestFrame1b extends Panel { private final Font font=new Font(Font.SANS_SERIF, Font.PLAIN, 16)
Tags (comma-separated)
Save Edits
Cancel