Monday, August 1, 2016

Subpixel Font Rendering with OpenJDK 8 on macOS

Here is an openJDK 8 build patched to support proper (and fairly fast) subpixel font rendering on OSX, based on the new subpixel rendering code available in openJDK 9. The patches implementing this are available from the webreview for the JDK bugs 8087201 and 8023794. The sources for these patches are available here: here and here.

In addition, I have patched with this minor patch which turns off checking if an AWT surface is translucent or not, since I use this JDK with netbeans. The current code causes rendering artifacts with transparent surfaces, but this is not really a big issue when running netbeans.

I am not experienced with packaging openJDK into an installer, so am only providing a zipped file of the resulting built JDK.

To use with netbeans, download the file, unzip into an appropriate location, and point netbeans to use it by editing


adding or modifying the netbeans_jdkhome property like 


or similar, depending on where you unpacked the zip file to. 

Edit: I've updated the JDK build to include a scroll fix for macOS sierra on retina screens. Download here.

Thursday, July 2, 2015

Subpixel font rendering with Netbeans on OSX

If you've been waiting to get subpixel font rendering with Netbeans on OSX, here a solution for you.

You will need to use current nightly Netbeans development branch (as of June 19th, 2015), and you will need to download, patch and build OpenJDK 9. Now, the latest build b70 support subpixel rendering, but not with translucent surfaces, which netbeans uses a lot of. When you're done, you will be able to get proper weighted fonts as shown above, with smooth scrolling even on a macbook pro with integrated Intel Iris Pro graphics hardware.

Here are the steps you need to take;

1. Download, patch and build OpenJDK 9

You can follow instruction here on how to do it, but I've outlined it below:

2. While compiling, listen to Mozart to prepare for the enlightenment. 

When the build is complete, the jdk home will be in the build/macosx-x86_64-normal-server-release/jdk/ folder. Now edit a file under your netbeans nightly folder, in my case 

vi /Applications/NetBeans/NetBeans\ Dev\ 

Add this line at the end of the file (modified for the exact location where you built openJDK).


Now you can start netbeans normally.

Saturday, May 30, 2015

Using jquery file upload with a single submit request

The jQuery File Upload plugin is very powerful and will allow multi file uploads with drag and drop for your forms with in-the-background ajax uploads with progress indicators and image preview.

But it's also possible to use in a situation where you simply wants multi file submit with drag and drop, but only with a single HTTP submit request containing all your form data and files.

The trick is to turn off auto upload, then collect the files being added in an array, and the intercept the form submit. Whenever there are files to be uploaded, a submit is done (with the complete form and files using multipart encoding) with a single ajax call.

Here's a sample Spring MVC controller to accept the files, along with an optional ModelAttribute to accept the rest of the form data.