Skip to main content

Pivot has graduated!

Posted by gkbrown on January 19, 2010 at 7:22 AM PST

Pivot has graduated to a top-level Apache Project! The official press release went out this morning:

The Apache Software Foundation Announces Apache Pivot as Top-Level Project

To coincide with the graduation, Pivot 1.4 was released a couple of weeks ago, and this morning we launched the new project site at http://pivot.apache.org!

We are very proud to be joining one of the most well-respected open source communities in the world and are looking forward to many successful future releases as part of the ASF!

Greg

Comments

UI Comments

Congratulations on graduating! A couple of comments about the UI:

1) Fonts are using standard (non-LCD) anti-aliasing, while my desktop setting is to use ClearType. So the font rendering is looking pretty poor compared to other apps on my desktop (including Swing ones).

2) Most components are looking a bit Windows-2000-ish with the square corners. Would be nice to modernize them with some slightly rounded corners.

While the above items may be customizable by the developer, I think Swing has taught us (with its dreadful Metal L&F) that the default out-of-the-box L&F is very important to how your toolkit is perceived. People are still saying things like "Swing is ugly", even though this can be addressed by plugging in a modern L&F with just a couple lines of code.

Fonts and square corners

Hi,

Re (1): Pivot uses the platform default for anti-aliasing. However, font rendering is performed by Java2D, which (AFAIK) does not use native font rendering under the hood on Windows. So your desktop fonts may look slightly different than Pivot fonts.

Re (2): Some people like the square corners. :-) However, I tend to agree - rounded corners would make it look a bit more modern. An updated L&F is planned for Pivot 2.0.

Greg

Fonts

Since Java 6u10, Swing has been using native font rendering on Windows, including appropriately detecting the desktop anti-aliasing setting (none, standard, or ClearType). So fonts in most Swing apps look great these days. Pivot looks a bit outdated by contrast, as the fonts are all blurry.

Should be pretty easy to fix this in Pivot by using the "awt.font.desktophints" property when drawing text. See: http://java.sun.com/javase/6/docs/api/java/awt/doc-files/DesktopProperti...

Fonts

That's exactly what we do, in fact. See the getTextAntialiasingHint() method in the Platform class:

http://svn.apache.org/repos/asf/pivot/tags/v1.4/wtk/src/org/apache/pivot/wtk/Platform.java

However, it is possible that we are not calling that method everywhere we should be. Are you seeing inconsistent rendering in any particular component?

Greg

Fonts

Took a closer look at a Pivot app under a debugger - the rendering hints are set correctly for LCD AA, but it draws the text with grayscale AA instead of LCD AA. So not sure what's going on here... maybe your Graphics2D is configured slightly differently from the one given to Swing components, and that somehow disables LCD AA text drawing?

OS/browser/JRE version

Just wondering, what OS/browser/JRE version are you using? I had seen some anti-aliasing issues in Windows prior to J6u14, but font rendering really seemed to improve in update 14.

More Info

The font issue occurs on any Windows system with ClearType enabled - most recently I've tested with WinXP / Java 6u15, WinXP / Java 6u17, and Win7 / Java 6u18. I've noticed this issue in various tests with Pivot over the last year though, on various Windows systems. It happens in all browsers or in desktop apps. I fiddled with the source a bit more and found the following:

1) LCD AA *is* used for Seperator. I believe this is the only component that is drawn with LCD AA. However, the glyphs in the Seperator text are corrupted on my WinXP system (they are fine on Win7). Moving/resizing the window sometimes fixes the text or just corrupts it differently. I've not seen this before in Java2D, so not sure what's going on. Almost seems like a graphics card/driver bug, but text is not corrupted like this in Swing apps.

2) LCD AA is not used for Border. However, if I modify BorderSkin and set KEY_ANTIALIASING to VALUE_ANTIALIAS_OFF just before the graphics.drawString() call, then LCD AA is used. Border text then suffers from the same glyph corruption problem mentioned in (1) on my WinXP system. It's pretty strange that turning off regular AA somehow makes text AA work... not sure what's going on here.

3) Finally, for classes like LabelSkin that use drawGlyphVector(), the problem is that drawGlyphVector() ignores the text AA settings in the Graphics2D, and instead uses the text AA settings in the FontRenderContext. So the fix for this to change the FontRenderContext declaration at the top of LabelSkin to something like this:

private static final FontRenderContext FONT_RENDER_CONTEXT = new FontRenderContext(null, Platform.getTextAntialiasingHint(), RenderingHints.VALUE_FRACTIONALMETRICS_ON);

Now, labels use LCD AA, but are corrupted on my WinXP system like in (1). I wonder if you're perhaps enabling any non-standard AWT properties like DirectDraw acceleration or something that could be causing the glyph corruption?

Added to JIRA

FYI, I added this issue to our bug tracking system:

https://issues.apache.org/jira/browse/PIVOT-393

Thanks, I'll test this again

Thanks, I'll test this again once it's been fixed.

Submit a patch?

Given that this *is* an open source project, you might consider submitting a fix yourself (you obviously have relevant expertise)... ;-)

LCD AA

That is possible. We render everything to a volatile image before painting it to the screen. Maybe we need to set some property on the image (or the graphics we get from it)?

Fonts

Hmm, that code looks OK to me, but Pivot is consistently rendering fonts with the wrong anti-aliasing. I'm trying the Kitchen Sink demo and can't find even a single component that uses the correct font anti-aliasing.

P.S. One minor issue with getTextAntialiasingHint() is that the AWT property may contain multiple hints (e.g. on my desktop it also defines KEY_TEXT_LCD_CONTRAST) and Pivot is only looking at KEY_TEXT_ANTIALIASING.

You lost me at XML

The second I saw that Pivot uses XML for UI design I completely lost interest. As a rule of thumb I tend to avoid any projects that force users to interact with XML files directly. I've seen this go wrong one too many times.

XML not required

You are not required to build your UI using XML. It is simply a convenience for those (such as myself) that prefer to do so. You can still construct your UI programmatically if you prefer, just as you would in Swing.

Good news Greg !!!

Thanks for the great job Greg, java desktop would be dead if pivot woudn't exist (javaFx hmmmm...) ! I will download and begin to work experiment with 1.4 release today !! Wow !!!!. The only thing I miss is a GUI Builder, but maybe that is coz I'm a Desktop guy Netbeans swing programmer ! Anyway really great job ! Aleix.

Could you please tell me your

Could you please tell me your opinions about JavaFX (esp. where JavaFX is wrong)? I know that I have to learn JavaFX scripting language, but is there no new language I need to learn in Apache Pivot?

Java vs. JavaFX Script

Pivot allows you to write your application in Java. You are not required to learn a new language in order to use it (though you can if you want to, since Pivot allows you to write your application in any supported JVM scripting language).