Anencumbrance. This Project became inactive shortly after the featurewas delivered intoJDK 7 and wassubsequentlydissolved Oct 2023. Discussion about font rasterization may befound onclient-libs-dev.
At this time, the project is essentially complete, asfreetype has been implemented as a replacement. Soon we will removethis project and transfer bugs and improvements into the scope ofthe 2D group.
Java 2D incorporates technology that converts scalable outlinefonts to a specified size and fits this outline to a pixel grid toproduce a raster for subsequent blitting. Hence the terms fontscaling and rasterization.
The goal of thisproject is to create anopen source JDK text rasterization subsystem. The existingimplementation was licensed by Sun from a 3rd party and can not bereleased as open source.
This project is of a temporary nature and will be open until allmajor objectives are accomplished.
The rasterizer module has tight connections with several othermodules. In particular:
Note, that input data is not necessarily valid or well-formedand problems can be hard to detect beforehand. Given that therasterizer is largely native code, unexpected problems often leadsto a crash. Robustness is one of the important requirements, andthe current implementation is addresing it on several differentlevels:
Overall, we are trying to refactor the logic of working withproprietary code in the way which simplifies plugging anotherimplementation of the font rasterizer instead. But we want tominimize changes to other subsystems to avoid risk of introducingincompatibilities.
Technically, the native part of rasterizer-related code is splitbetween fontmanager and rasterizer specific library (t2k forproprietary rasterizer). As part of refactoring we separated JNIcalls to the rasterizer-specific and shared parts. Most of therasterizer-specific calls will are performed through implementationof the newly added FontScaler interface.
Note that there are some caveats. In particular, the native textlayout engine needs to obtain pointers to certain truetype tables.(There is no need to process these tables. The contract is toreturn the pointer to the table in the truetype format.)
The current implementation is based on two notions - FontScalerand FontStrike. FontScaler is specific to particular physical fontfile (or data stream). FontStrike is specific to not just the fontfile but also to a particular size, style and rasterization mode.There could be more than one strike per same scaler.
This additional context is available (as native object) on everycall to the rasterizer library and it is used to set parametersbefore processing particular request.
We expect that any scaler implementation will handle errorsinternally. It should throw an exception if the font (i.e. scaler)becomes unusable and make sure native resources are released.
The solution is to use freetype as a separate binary library(and probably use freetype library installed on the platform (ifavailable)). So, hopefully there will be only a fewfreetype-specific files in the OpenJDK workspace (native glue codeand java wrapper (implementation of FontScaler)).
At this time, the project is essentially complete, asfreetype has been implemented as a replacement. Soon we will removethis project and transfer bugs and improvements into the scope ofthe 2D group.
You can help by:
Note that this project usesOpenJDKcontribution rules. Please see them for further details.