I am running the code with Java7 on both Windows 7 and Linux SUSE server 10.
Here is my code which just modifies HellJava.java into AntiAliasTest.java (ps a
quick look had it looking good on Windows 7 but not on the Linux side.:
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.util.TimerTask;
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.Frame;
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Window;
public class AntiAliasTest implements Application {
private Window window = null;
private Frame frame = null;
@Override
public void startup(Display display, Map<String, String> properties) {
window = new Window();
// frame = new Frame();
//frame.setTitle("Waveform Viewer");
window.setTitle("Pivot");
Font theFont = new Font("Times New Roman", Font.PLAIN, 40 );
AffineTransform fontAT = new AffineTransform();
// Derive a new font using a rotation transform
fontAT.rotate(90 * java.lang.Math.PI/180);
Font theDerivedFont = theFont.deriveFont(fontAT);
Label label = new Label();
label.setText("test String");
// label.getStyles().put("font", new Font("Arial", Font.BOLD,
24));
label.getStyles().put("font", theDerivedFont);
label.getStyles().put("color", Color.RED);
label.getStyles().put("horizontalAlignment",
HorizontalAlignment.CENTER);
label.getStyles().put("verticalAlignment",
VerticalAlignment.CENTER);
// window.add(frame);
window.setContent(label);
// window.setTitle("Hello World!");
window.setMaximized(true);
window.open(display);
}
@Override
public boolean shutdown(boolean optional) {
if (window != null) {
window.close();
}
return false;
}
@Override
public void suspend() {
}
@Override
public void resume() {
}
}
From: Sandro Martini [mailto:[email protected]]
Sent: Monday, January 28, 2013 1:24 PM
To: [email protected]
Subject: Re: How do I programmically and easily antialias fonts in Pivot
Hi Cynthia,
could you post here the minimal sample here so we can do the same test quickly
(my primary dev environment in with one of latest Java 6 on Windows XP, and
another with Windows 7 at 64 bit) ?
Thank you very much ...
Could you tell us even the Platform and the Java version where you are running
the sample ?
In the meantime I'll do some check in our code.
Let's update tomorrow ...
Later we can do the same test in other platforms and even with recent versions
of Java 7.
Bye,
Sandro
Il giorno 28/gen/2013 19:07, "Schwartz, Cynthia L"
<[email protected]<mailto:[email protected]>> ha scritto:
I am wondering how to programmatically antialias fonts in Pivot. I included a
screenshot of a version of HelloJava.java with a rotated label string. The
left is run with _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on" and the right
is run with _JAVA_OPTIONS not set.
It is clear that by default, the fonts are not antialiased. You can zoom in
and see more jagged edges on the right one. My question is how to turn
antialiasing on programmatically? Do I have to modify each component's skin's
paint method? Or is there a simpler way? I would like it to be the default for
my application not a compile flag.
Thanks for your help,
Cynthia