While rendering plain text using default font I noticed that the
drawn character images appear to be disturbed. This is most
noticeable when drawing white text on black background. For
example, in image of equal sign (=) the upper bar appears as darker
and taller than the lower bar. I can notice the same effect while
writing this mail in Mail application, but here having black text
on white background, the lower bar appears taller and lighter,
consequently the effect is not as disturbing as with white text on
black background. Needless to say, this effect is not observable
when running the same Java application under other operating
systems. What can be wrong?
It sounds like you are just seeing an artifact of text anti-aliasing.
Do you have a code example that demonstrates this problem? Are you
using the default font? Is this on a standard Aqua Swing control or
are you doing your own rendering with drawString()?
It looks much better, clearer and brighter when using -
Dapple.awt.graphics.UseQuartz=true following a tip I received in a
private reply (I'm not sure he wants his name disclosed). It's
acceptable and even appealing now. However there still is some effect,
both bars of = have the same brightness now but the upper bar is still
somewhat thicker. Here is the code:
import java.awt.*;
import javax.swing.*;
public class Test2 extends JComponent {
public static void main (String [] args) {
Test2 t = new Test2 ();
t.setBackground (Color.black);
t.setForeground (Color.white);
JFrame frame = new JFrame ("Test2");
frame.setSize (400,200);
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.add (t);
frame.setVisible (true);
}
public void paint (Graphics g) {
Dimension size = this.getSize ();
Color bk = this.getBackground ();
Color fg = this.getForeground ();
g.setColor (bk);
g.fillRect (0,0,size.width,size.height);
g.setColor (fg);
g.drawString ("===== Text render test =====",100,100);
}
}
Thanks/Mikael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden