Skip to content

GudzonskiyYastreb/openjdk-fontfix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project attemps to fix Java font rendering.

PROBLEM:
Both Sun Java and OpenJDK projects can't render swing fonts in the same manner system does it. GTKLookAndFeel widgets are using GTK for rendering, but any custom text rendering in Swing is still performed by JRE internal renderer.
Here is the partial list of font rendering issues in OpenJDK:
- renders fonts in 72 DPI internally, increasing font size to match system DPI settings. That breaks font geometry, which is obvious on Consolas of size 10 to 12.
- ignores hinting and antialiasing settings from system.
- LIGHT freetype hinting is not implemented.


HOW TO USE
1) check build.sh script for existing Sun JDK 6 path
2) run build.sh to compile OpenJDK. Some additional dependencies may be required.
3) when build is done - run run-demo-java.sh to see how text is rendered by OpenJDK.
4) compile demo/qt project and run it to see how Qt text is rendered.
5) explore freetype2 API: demo/freetype/ftlabel.cxx is minimal example of freetype2 API usage, where you can hack experiment with additional logic and optimizations.
6) explore Qt rendering: see demo/qt_building_debugging.txt file for Qt building, then debug into qt-everywhere-opensource-src-4.7.3/src/gui/text/qfontengine_x11.cpp file to see how Qt is using freetype2.
7) try to fix OpenJDK rendering: you may start from openjdk7/jdk/src/share/native/sun/font/freetypeScaler.c where freetype2 is used by OpenJDK, and then hack your way into OpenJDK source code to fix its rendering.


STRUCTURE
- openjdk7              folder contains source code of build 145 of openjdk. It is used as project base. When
                        it's rendering will be fixed - patch will be created with possibility to apply to any
                        other openjdk version.
- demo/freetype         minimal project in Qt that's using freetype2 API directly to perform rendering.
- demo/java             java project to demonstrate Swing text rendering.
- demo/qt               Qt project with proper default font rendering. OpenJDK rendering should give the
                        same result.
- demo/qt_building_debugging.txt
                        guide how to build Qt locally to debug its source code.
- demo/qtdemo-opensuse-x64-bin
                        qt demo project compiled on OpenSUSE 11.4 x86_64 version.
- build.sh              bash script to launch openjdk build. NOTE: do not forget to put proper path to
                        existing JDK6 folder.
- run-demo-java.sh      bash script to launch swinglabel project with locally builded openjdk.
- run-demo-qt.sh        bash script to launch opensuse x86_64 version of Qt demo.

About

Fork of OpenJDK project to fix font rendering and DPI issues

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published