Ugly font rendering in Netbeans 8.1 under Arch Linux

I had ugly font rendering in Netbeans 8.1 under ArchLinux. I waited a lot, because I was thinking about a trouble due to something wrong in the release. But It was not.

Ugly font rendering in Netbeans under ArchLinux
NetBeans logo

Well, I had not alternatives but fix the bug: Netbeans is necessary, beacuse I’m working on a Netbeans Java project (I will write about Java building system in a future post); ArchLinux is more than necessary…which other operating system sould I use??? :D:D:D

Anyway, to fix this small issue, you should just run NetBeans enabling these options

netbeans -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on

-J enables the options to pass to the JVM. swing.aatext and art.useSystemAAFontSettings are the two options which enable the antialiasing of the text.

A very lazy solution might be to create an alias in .bash_aliases. However, you should call NetBeans from command line, in order to apply the JVM options.

An easier way to fix the issue, might be the implementation of the previous options as default JVM options from within the executable script. Just modify /usr/bin/netbeans as follow

if grep -v -- "-J-Xmx" >/dev/null <<EOF ; then                                                                                                                            
${netbeans_default_options}                                                                                                                                               
EOF                                                                                                                                                                       
        heap_size                                                                                                                                                         
        netbeans_default_options="-J-Xmx${max_heap_size}m ${netbeans_default_options}"                                                                                    
fi                                                                                                                                                                        
                                                                                                                                                                          
if grep -v -- "-J-XX:MaxPermSize" >/dev/null <<EOF ; then                                                                                                                 
${netbeans_default_options}                                                                                                                                               
EOF                                                                                                                                                                       
        netbeans_default_options="-L-XX:MaxPermSize=384m ${netbeans_default_options}"                                                                                     
fi                                                                                                                                                                        
                                                                                                                                                                          
if grep -v -- "-J-XX:PermSize" >/dev/null <<EOF ; then                                                                                                                    
${netbeans_default_options}                                                                                                                                               
EOF                                                                                                                                                                       
        netbeans_default_options="-L-XX:PermSize=32m ${netbeans_default_options}"                                                                                         
fi                                                                                                                                                                        
                                                                                                                                                                          
if grep -v -- "-J-Dswing.aatext" >/dev/null <<EOF ; then                                                                                                                  
${netbeans_default_options}                                                                                                                                               
EOF                                                                                                                                                                       
        netbeans_default_options="-J-Dswing.aatext=true ${netbeans_default_options}"                                                                                      
fi                                                                                                                                                                        
                                                                                                                                                                          
if grep -v -- "-J-Dawt.useSystemAAFontSettings" >/dev/null <<EOF ; then                                                                                                   
${netbeans_default_options}                                                                                                                                               
EOF                                                                                                                                                                       
        netbeans_default_options="-J-Dawt.useSystemAAFontSettings=on ${netbeans_default_options}"                                                                         
fi

#gwh

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

About Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at https://pgp.mit.edu

Leave a Reply

Your email address will not be published.

*