After releasing JogAmp 2.4.0 (see feature/buglist), it was time to tackle an outstanding issue once again: Type Rendering. Motivation was born again by finding the most interesting feature to use Java with JOGL on Desktop, Mobile and Embedded Devices. At least for my taste, I identified this to be Graph UI, an immersive UI within the 3D scene including text and UI objects and user interaction.
Graph UI shall allow an application to utilize one viewport or window, exposing the scene including the UI w/o the need for any external toolkit. Think of an integrated QT or OpenJFX in your 2D/3D application working on desktop and embedded devices even w/o any windowing system on top of a plain console DRM/GBM as support by JOGL(EGL) and NEWT.
Early examples from 2012 are available in these videos around the 2:45 minute mark and here at the 16s mark.
Edit: This blog entry demonstrates this use-case in more detail (now being part of this series).
***
Graph UI utilizes Resolution Independent NURBS Curves Rendering using Programmable Graphics Pipeline, i.e. rendering curves directly on the GPU, resolution independent as found by Rami Santina (see [ paper, slides ] ). Back in 2011 Rami and I implemented this method, used for fonts (types) and UI elements. The first draft of Graph UI was born.
Well, nothing is perfect nor bug free, hence certain aspects were simply not well implemented and others not yet working bug free within Curve Rendering.
Hence I tackle Type Rendering first, as it is the most important part of any UI and it also exposes weaknesses in our Curve Rendering implementation. The following steps have been achieved so far
- Update David Schweinsberg’s Typecast library within our JOGL codebase
- Created our jogl_patches branch to better track changes in the future
- Finally producing resolution independent outline shapes used by the Curve Renderer in font-units (I might change this to fractional font em-size. Scaling to target size via scaling to font-pixel-size is performed simply by applying it to the PMV matrix when rendering the GLRegion.
- Added kerning for inter-word horizontal advance layout.
- Improved unit test TestTextRendererNEWT01 to produce validation snapshots against LibreOffice‘s print-preview snapshots. The latter was used as a reference, as it properly renders fonts and layout with correct monitor DPI – same as our Graph rendering.
***
Graph rendering device metrics using Ubuntu-Light 12pt for below examples are: vertical dpi 159.03 6.26 px/mm, font 12pt 26.50px 4.23mm. Internal 4x vbaa sampling was used.
Below results demonstrate pixel accurate layout including kerning. Also the font rendering artifacts itself are almost matching the LibreOffice reference. I verified the layout using overlay with transparency at 2x magnitude.
You can click on each screenshot below to see them in full size …
Reference LibreOffice Ubuntu-Light 12pt Text-1Graph Type Rendering Ubuntu-Light 12pt Text-1, sampling vbaa-4
Reference LibreOffice Ubuntu-Light 12pt Text-2 (kerning)Graph Type Rendering Ubuntu-Light 12pt Text-2 (kerning), sampling vbaa-4
… more to come in the next update.