Font Selection

This simple demo prints sample text using all fonts available to the Java Virtual Maschine. The fonts are grouped by their font family. This demo is useful when trying to determine a font's unicode or PDF embedding capabilities.

Data Structure

The table model is very simple. The two columns in the model represent the font name and the font family. The fonts itself are aquired using GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); . The contents are sorted by the font familiy to enable grouping.

Report Structure

The report itself consists of a single group for the 'font family' printing the family name in the header and counting the number of fonts in that family in the footer of the group.

The itemband prints the font name and a sample text. The SampleText field's font property gets modified by a function to match the current font.

Functions

The only noteworthy function here is the 'FontChangeFunction'. The function itself does not compute anything. Every registered function is called on every report event and is granted access to the report definition. We use that feature to lookup and modifiy the sample element's font properties.