Ubuntu: Android Studio doesn't render Ubuntu Mono Font well



Question:

It doesn't even recognise it as a Monospaced font. Then it only shows anti-aliasing when the font size is set to 20 or over. But for other fonts it does it at 16.

The result is ugly looking fonts and eye-strain when set to 16, which is still large.

I am using these settings in studio64.vmoptions file

-Dawt.useSystemAAFontSettings=lcd  -Dswing.aatext=true  -Dsun.java2d.xrender=true  

I have tried various settings for Dawt.useSystemAAFontSettings and still the same issue.

Ubuntu Monospace font looks fine in Eclipse and other text editors.Where in Eclipse it's size 12 and it renders fine.

Here are some screenshots Ubuntu Mono 16 :Ubuntu Mono 16

Ubuntu Mono 20 Ubuntu Mono 16

Source Pro 16 (I think comes with Studio) Source Pro 16

Ubuntu Mono 12 in Eclipse (ideal for me) Ubuntu Mono 12 in Eclipse

I have uploaded the images to imgur as this site is compressing the images, and the quality is affected.

Is there another setting that is controlling what size to turn on anti-aliasing on a font. Is there a way to control the dpi setting used in the Android Studio.

Anyone else have other font recommendations. I have tried droid mono, and other default ones that come with Ubuntu.

I am using Android Studio 0.86, Oracle's Java 7 on Ubuntu 12.04 with Nvidia drivers.


Solution:1

The problem is not anti-aliasing - all of your examples show the text is anti-aliased fine.

The difference is in an aspect of font rendering called "hinting" - the top Ubuntu Mono example shows a strong hinting, whereas the bottom Ubuntu Mono example shows a smoother hinting. Hinting deforms the letter shapes to better align to the pixel grid and give a more crisp appearance.

Whether you like one or the other is a matter of personal preference. The top one is certainly very clear to read but at the expense of deforming the letter shapes.

The Java environment will be using its own font renderer rather than your global settings, hence the difference.

There are various fixes for this described in this link at stackoverflow.com:

https://stackoverflow.com/questions/17510099/ugly-fonts-in-java-applications-on-ubuntu

This one looks pretty simple (I have not tested this):

Try adding

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'  

to your ~/.bashrc

But the chosen solution is more complex.


Solution:2

Found very easy and very tricky solution link to video The dude just made a link to a jre from Intellij Idea folder and put it to android studio folder and vuala!


Solution:3

to resolve JAVA Picked up Option:

just follow the simple step:

open a terminal:

sudo -i  [sudo] password for amit: ******* <------ Your system password  gedit /etc/profile  

{now one editor will be open don't delete any thing, in the last part where you set your JAVA PATH after fi just write

unset _JAVA_OPTIONS  

and save it and close

after that type again into your terminal

exit  . /etc/profile  

all get set now check

java -version  java version "1.8.0_112"  Java(TM) SE Runtime Environment (build 1.8.0_112-b15)  Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »