Android Studio not correctly rendering font on Ubuntu - android-studio

Below is the picture of Android Studio when I first installed it:
I'm using Ubuntu 12.04 with Oracle Java 7. But the fonts are looking very ugly. They are not looking like they look when I see them on eclipse.
Earlier when I installed NetBeans, I had same problem too.

There actually is a solution. You need to install JDK font fix as follows:
sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get install openjdk-7-jdk
Then, open studio.vmoptions and optionally studio64.vmoptions in your android-studio/bin directory, and add following lines to both of them (the first one might be already there):
-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
After you reboot, the font rendering is just fine. To get the most Eclipse-like experience, go to File, Settings, Editor, Colors & Fonts, Font. Save the current scheme as a new one, and change the font to "Monospaced" with size of 14.

I've tried several suggested tweaks, tried using FontFix Patched JDK, FontForge, and editing studio.vmoptions; though some of these could show some improvement, it does not come close to the font rendering quality of the non-swing apps like eclipse.
I've found this to be the easiest and cleanest solution:
rm -r ~/.AndroidStudioBeta
If you have installed openjdk-fontfix, or made changes to studio.vmoptions, it is better you revert back those changes to their defaults.
sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get install ppa-purge
sudo ppa-purge ppa:no1wantdthisname/openjdk-fontfix
Remove all custom-added JAVA environment variables ($JAVA_HOME, $PATH:$HOME/bin:$JAVA_HOME/bin). Check in files, /etc/profile, ~/.profile, ~/.pam_environment
Install the latest Oracle Java via launchpad ppa
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
This ppa installer will usually do more than what a manual JDK configuration will do.
[]
Monospaced fonts like 'Inconsolata' and 'Source Code Pro' works best for me.

You do not need to install OpenJDK or the above-mentioned fix .deb for correct font rendering. Simply launch the Studio with:
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=lcd -Dsun.java2d.xrender=true' path/to/studio.sh
.. and fonts should render right under Ubuntu with Oracle's JDK 7. Looks even better when you change theme to GTK+ under File -> Settings -> Appearance.

In studio.sh, find this line at the bottom of the file:
eval "$JDK/bin/java" $ALL_JVM_ARGS -Dawt.useSystemAAFontSettings=lcd -Djb.restart.code=88 $MAIN_CLASS_NAME "$#"
and change it to
eval "$JDK/bin/java" $ALL_JVM_ARGS -Dawt.useSystemAAFontSettings=on -Djb.restart.code=88 $MAIN_CLASS_NAME "$#"
This means changing the parameter
-Dawt.useSystemAAFontSettings=lcd (if present)
to
-Dawt.useSystemAAFontSettings=on
Or simply add this param if you don't have it.

What you should do is configure the fonts in the settings as follows:
File > Settings > Editor > Colors & Fonts > Font
In that screen then you save a new scheme clicking in Save as, and putting a name on it, lets say "Custom".
Then below you'll find all the settings you need, you can tweak the font family and the size as well.

Android Studio 1.2 Preview 1 has been released a few hours ago (Mar 9th 2015):
http://tools.android.com/recent/androidstudio12preview1
It also includes several really important fixes that have been requested by Android Studio users, such as high density (retina) support for Windows and Linux.
It is based on IntelliJ IDEA 14.1, and according to the IntelliJ release notes, includes "The HiDPI support for Windows/Linux (scaled icons/font-size, no blur)".
However, I tried this on my machine (Ubuntu 14.10), and could not see any improvements. Maybe someone else has information on how to make it work?

Related

Intellij IDEA 2017.2 can't add openjk 9 on Linux Mint 18

I am using Intellij IDEA 2017.2.5 on Linux Mint 18.2 and trying to add new openjdk-9 SDK but IDEA does not accept openjdk 9 as valid JDK:
I have installed all of my SDKs using apt-get from ppa standard repositories.
This is my update-alternatives --config java/javac output:
Although Intellij declared it would support JDK 9 here, but it seems it is not yet fully compatible with at least opensdk-9.
Maybe refactoring SDK directory and removing 'jre' folder misleads the IDEA to find the SDK 9 home folder.
Any idea why Intellij IDEA claims 'The selected directory is not a valid home for JDK' ?
“ Ubuntu PPA for OpenJDK” currently has very old build of openjdk-9(9~b115-1ubuntu1).
So the IDEA does not recognize it as a valid SDK.
I removed current installed version:
sudo apt-get remove '^openjdk-9.*'
Then I have downloaded newer .deb build(9~b181) files including jre,jre-headless,... from launchpad build archive.
sudo dpkg -i openjdk-9-jre-headless_9_b181-4_amd64.deb
openjdk-9-jre_9_b181-4_amd64.deb
openjdk-9-jdk-headless_9_b181-4_amd64.deb
openjdk-9-jdk_9_b181-4_amd64.deb
Just Execute the above command at a single line, line breaks are for better readability.
Ignore any error complaining about:
"Package libpng16-16 is not installed."
Next execute the following:
sudo apt-get install -f
Now after installing this build of openjdk-9 the IDEA is happy with SDK home.
Thanks #y.bedrov for his useful comment.
Update:
However this solution enables you to declare openjdk-9 in the mentioned IDEA version(2017-2) but you are not able to compile any class within the IDEA itself.
You can only compile your application with elder jdk and run it with openjdk-9. There is an other issue which indicates this here.
In the newer IDEA versions(I have tested 2017.3) this build of openjdk is not allowed to be used as new SDK any more, see this issue.
The short reason is an issue in Debian package which contains incorrectly compiled lib/jrt-fs.jar file.
See this Answer for more information

How to install Source Code Pro Font on Arch Linux

I am currently follwoing this guide to install spacemacs and it has suggested that I use the adobe font source code pro.
Now the problem is that I have installed Adobe Font Development Kit for OpenType using yaourt -S adobe-source-code-pro-fonts, but can't seem to get the command makeotf -h to work. I simply get a zsh: command not found: makeotf. Not sure why this is the case.
It seems that makeotf is only used to build the font files from source.
That should not be necessary since you installed them through yaourt. So you already have the fonts. Now you need to config Spacemacs to use them.

Issue with Netbeans on Linux Mint

I just installed Netbeans using the script on Oracle's website and I'm having some trouble getting it to work. After opening Netbeans I went to open up a simple .java file just to test it out and got this error:
"The JDK is missing and is required to run some Neatbeans modules. Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information."
I have OpenJDK, and I'm not sure what's meant by using the --jdkhome command line option. I also visited the wiki and it's about doing a full installation of JDK, which I don't think I should need to do. Any help is appreciated.
I think it's better to use Oracle Java JDK rather than Open JDK if you want to use Netbeans for java development
You can use this link to set Oracle Java JDK in Linux Mint
So, it's better to follow theses instructions (JDK install) prior to Netbeans install and all things will go well.
Steps:
1-Remove OpenJDK installation
sudo apt-get update && apt-get remove openjdk*
2- Download Oracle JDK you want to install (for example JDK 8)
Download the *.tar.gz one.
example for current version: jdk-8u65-linux-x64.tar.gz
3- Extract the file and create a folder where to move it
tar -zxvf jdk-8u65-linux-x64.tar.gz
sudo mkdir -p /opt/java
sudo mv jdk1.8.0_65 /opt/java
4- Make JDK system default
sudo update-alternatives --install "/usr/bin/java" "java"
"/opt/java/jdk1.8.0_65/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk1.8.0_65/bin/java
At this stage, you can start the installation of Netbeans IDE and it will automatically detect your Oracle JDK setting
I tested a short HelloWorld Java example, and I don't have any issue.
Here is the setting JDK view in Netbeans:
If you want to add the JAVA Home dir to your system
Proceed like this
You have to be in root mode and then edit this file: /etc/bash.bashrc
and add:
#JAVA HOME
JAVA_HOME=/opt/java/jdk1.8.0_65
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
Reboot your Mint system
Now you'll have javac working in command line...

Unable to run Gala window manager

I'm Elementary OS Luna (Ubuntu-based) user, and trying to do some tweaks I installed Gnome Tweaks Tool. After installing and running it, my computer got several problems.
All the windows were without borders and titlebars. Couldn't close, minimize, resize etc. I could solve it by running Compix and putting it as startup. But some good features of Elementary OS does not work with Compix, but just with Gala. And when I try to run Gala, this happens:
jefs#JefsPC:~$ gala --replace
(some css warnings, okey)
(gala:6103): GLib-GIO-ERROR **: Settings schema 'org.gnome.mutter' does not contain a key named 'center-new-windows'
Trace/breakpoint trap
jefrey#JefsPC:~$ _
I tried reinstalling elementary-desktop, removing gnome-tweaks-tool, reinstalling gala, installing and removing mutter and even going to /usr/share/glib-2.0/schemas/org.gnome.mutter.gschema.xml and putting that "center-new-windows" key manually, then restarting my computer. It made that key to show up on dconf editor, but Gala still not detecting it...
Is there something I can do to get Gala back?
Solved with apt-get upgrade && apt-get dist-upgrade

Installing eclipse IDE for Java EE developers on Linux Mint

I'm new to the Linux method of program installation. I have found instructions on how to install several different Eclipse versions such as JDK and CDK from the terminal but can't seem to find the package name for the Java EE version.
ex. 'sudo apt-get install eclipse-cdt' installs the C++ version
I need the the option for Java EE, so what do I fill in the "option" below with?
'sudo apt-get install eclipse-option'
You will need to get a few packages to get it working.
eclipse
eclipse-jdt
eclipse-pde
eclipse-platform
eclipse-rcp
To install them:
sudo apt-get install eclipse eclipse-jdt eclipse-pde eclipse-platform eclipse-rcp
You can also find all packages that start with the name eclipse by using
apt-cache search eclipse | grep ^eclipse
Linux Mint 17,Qiana, with MATE Desktop manager:
bring cursor to 'Menu'.
Left click on "Menu" in the panel.
Slide cursor half way down left side of menu,
Find and click on "Program Manager"
It will ask for your password.
Then, in the search box, you type "java ee eclipse" and it will display 8 different packages, which yo0u can again click on to read the descriptions below, and/or, check mark, to install.
Some have tools, some are servers, sure to please...
The correct package for Java EE is
eclipse-wtp
Whereas "wtp" stands for web tool platform: http://projects.eclipse.org/projects/webtools
Imho you should not use apt to install eclipse, but download it directly from the eclipse website for the following reasons:
At the time of writing the apt eclipse installation is last years release (Luna), though this years release (Mars) has already been around for half a year
Eclipse has its own update tool
There are no dependencies to be fulfilled in the apt package

Resources