[Ldsoss] AntiAlias Java

Ben Galbraith junk at galbraiths.org
Fri Aug 25 15:41:22 EDT 2006


On Aug 25, 2006, at 1:19 PM, Slide wrote:

>> From what I understand SWT is much better as it is a wrapper of the

If you're not already aware, making a statement like this is an  
excellent way to start a flame war in Java circles. ;-)

There are two legitimate ways to pursue writing cross-platform  
applications:

1. Use a cross-platform GUI that tries as hard as possible to be  
completely pixel-consistent across all operating systems. This is the  
Swing approach. While the waters are muddied as Swing also includes  
look-and-feels that try to emulate the native platform, Swing's  
ability to provide a consistent, cross-platform look is its key  
strength. The advantages are that you don't need to worry about  
designing forms that look good with different font rasterizers,  
widget dimensions, and so forth. Layout managers are the best  
solution we have for this problem, but they are not a perfect  
solution. Disadvantages include that apps look different than native  
apps, that they may be slower as the cross-platform toolkit may be  
doing the drawing, and so forth.

2. Use the windowing toolkit of the native platform. This is the AWT/ 
SWT approach. Key advantage is that apps look native and can  
potentially take advantage of unique features of the native toolkit.  
Disadvantage is that the app looks rather different on each platform  
and you have to take this into account while layout the the UI, etc.  
Further disadvantage is that creating new widgets can be a real  
problem as you have to take a tremendous amount of care in making  
them appear native on each OS, else the advantage of this approach is  
significantly diluted.

This is a summary of the issues; there's a deeper and much richer set  
of nuances and issues to be taken up should this debate be seriously  
considered.

> native windowing toolkit for the platform (WinAPI on Windows, GTK on
> Linux, etc). This would seem to me to make the fonts, etc look as good
> as native applications.

Sun didn't weigh the decision to implement their own TrueType and  
Adobe Type 1 rasterizers lightly; that's some expensive and complex  
engineering. The decision was one of many trade-offs and in the end,  
their customers pushed them towards a solution that guaranteed cross- 
platform fidelity.

Interestingly, Apple's Swing implementation has the underlying OS  
render its fonts (in most cases).

As far as font quality goes, Swing missed the boat on sub-pixel anti- 
aliasing, which is one reason why OS X and Windows (and now I  
understand some/all Linux distros) look so gorgeous with font  
rendering. That's fixed in Java 6. There are yet more font rendering  
features that OS X and Vista support that it will take Java some time  
to acquire, however.

In any event, SWT vs. Swing is a more complicated debate than "mine  
is better than yours." :-)

Ben

> _______________________________________________
> Ldsoss mailing list
> Ldsoss at lists.ldsoss.org
> http://lists.ldsoss.org/mailman/listinfo/ldsoss



More information about the Ldsoss mailing list