Showing posts with label Infinality. Show all posts
Showing posts with label Infinality. Show all posts

9/09/2014

Fix Java font smoothing on Ubuntu: re-building OpenJDK from sources with Infinality patches

OpenJDK7

First we need to install some pre-requisities:
sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev gawk g++ libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev mercurial openjdk-6-jdk

export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk-amd64
Getting the sources:
cd ~/tools
mkdir jdk7u60
cd jdk7u60
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u60 forest
cd forest
sh ./get_source.sh
Patching fonts with Infinality:
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk7u60/forest/jdk/
cd ~/tools/jdk7u60/forest/jdk/
patch -p1 < fontfix.patch
The actual build:
cd ~/tools/jdk7u60/forest
. jdk/make/jdk_generic_profile.sh
#make ALLOW_DOWNLOADS=true fastdebug_build
make all
Verifying:
build/linux-amd64-fastdebug/j2sdk-image/bin/java -version

In case you get java.lang.RuntimeException: time is more than 10 years from present: 1104530400000

Try this:

cd ~/tools/jdk7u60/forest/jdk/
wget http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/raw-rev/74a70385c21d
patch -p1 < 74a70385c21d

OpenJDK6

sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev gawk g++ libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev mercurial openjdk-6-jdk libmotif-dev
export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk-amd64
cd ~/tools
mkdir jdk6
cd jdk6
hg clone http://hg.openjdk.java.net/jdk6/jdk6 forest
cd forest
sh ./get_source.sh
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk6/forest/jdk/
rm -rf 2893461
cd ~/tools/jdk6/forest/jdk/
patch -p1 < fontfix.patch
cd ~/tools/jdk6/forest
. jdk/make/jdk_generic_profile.sh
make all

OpenJDK8

cd ~/tools
mkdir jdk8
cd jdk8
hg clone http://hg.openjdk.java.net/jdk8/jdk8 forest
cd forest
sh ./get_source.sh
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk8/forest/jdk/
rm -rf 2893461
cd ~/tools/jdk8/forest/jdk/
patch -p1 < fontfix.patch
cd ~/tools/jdk8/forest
chmod +x configure
./configure
make all

Reference:

http://mail-index.netbsd.org/pkgsrc-users/2014/12/30/msg020846.html

9/08/2014

Fix Java font smoothing on FreeBSD: re-building the port tree's OpenJDK from sources with Infinality patches

The current OpenJDK available in FreeBSD's port tree lacks some eye-candy regarding font-rendering capabilities. Since Freetype2 already includes subpixel-rendering support, we just have to patch the JDK. So first we make an "extract patch" (e.g. no compile, only acquiring sources, applying official FreeBSD patches), then we'll patch with the Infinality patches available in the git repo below.

OpenJDK7

cd /usr/ports/java/openjdk7
sudo make extract patch
cd ~
git clone https://gist.github.com/2893461.git
sudo mv 2893461/fontfix.patch /usr/ports/java/openjdk7/work/openjdk/jdk/
cd /usr/ports/java/openjdk7/work/openjdk/jdk/
sudo patch -p1 < fontfix.patch
cd /usr/ports/java/openjdk7/
sudo make install clean

OpenJDK6

cd /usr/ports/java/openjdk6
sudo make extract patch
cd ~
rm -rf 2893461
git clone https://gist.github.com/2893461.git
sudo mv 2893461/fontfix.patch /usr/ports/java/openjdk6/work/jdk/
cd /usr/ports/java/openjdk6/work/jdk/
sudo patch -p1 < fontfix.patch
cd /usr/ports/java/openjdk6/
sudo make install clean
If you already have openjdk7 installed, you'll need to reinstall instead. In this case replace the last line with
sudo make deinstall reinstall clean