Version 2.0 19 June 2003
fontgrid is a testcase for Java2 font and converter support and can also be used as a Unicode and codepage reference. fontgrid shows a grid of 256 codepoints from either Unicode or a selected converter, and can also be used to print the grid.
fontgrid display
New since fontgrid 1.4.1
Profiles and command options
Menu options
Character Details
Font Details
The display of characters in the grid is color coded. The background color of each codepoint indicates:
white | Normal graphic character in the font |
gray | Codepoint not defined in Unicode |
cyan | Glyph not in font, taken from backup font |
yellow | Codepoint is control or format control |
Blue characters indicate that the font is a composite font, and that the glyph does not come from the first font in the composite font. The cyan background and blue foreground color can be disabled by setting use.colors=false. The character data shown on the message at the bottom of the windows gives additional information about which font the glyph comes from. The first value of glyph= gives the font number.
To display a codepage, choose view->codepage. This will change from a Unicode range to a codepage view. You can then select the codepage from the list. For double byte codepages, the initial byte is represented by a red number. Click on this number to see the specified range. Click on the outside of the grid to return to the base of the codepage.
You can use the pageup and pagedown keys to move up and down Unicode ranges or between codepages.
Using draw, you can change the drawing method used to draw the characters. This will produce different results for complexlanguages.
The draw label option is supported from the GUI. This option uses AWT to display the character grid. While this option is useful to see how AWT will display characters, it is somewhat unreliable and has performance problems. It should be used with care.
To see a large number of scripts, you will need to have a Unicode font. On Windows you can use the arialuni.ttf font (available as part of Microsoft Office). The WorldType fonts available from IBM will also work.
Backup bitmap fonts are delivered as part of fontgrid. These contain all 97477 glyphs and controls defined in Unicode 4.0. There are versions for both normal and small grid (18 point and 14 point). Glyphs from these fonts are normally displayed with a cyan background to differentiate them from glyphs from the selected font. You cannot use the backup fonts in the character detail display, or to print the grid.
There are two sizes of grid. This is normally selected based on the screen size, but this may be overridden in the profile. For screen sizes below 1024, the small grid is used. You can force the small grid on large screens using the small=true option.
For full functionality, it is necessary to have a unicode character data file. This is normally called UnicodeData.txt, but the name may be specified using the unicode.data property. If this file is missing, much of the color coding does not work, and many of the features of the character details cannot be shown.
Version 2.0 is a major update to fontgrid, and the version number no longer tracks with the Java level. The new items for this release are:
The fontgrid options are settable using a profile, and can also be set directly from the commandline invocation. The syntax of the fontgrid command is:
java fontgrid profile key=value
The profile is a java properties file, and by default the profile "fontgrid" is used. Any of the properties which can be specified in the profile can also be specified on the command line. The profile is first looked at in the user.home directory, and then in the user.dir directory.
These are the possible settings and the default values:
all.fonts=false | Show all fonts (true) or only the font families (false) |
antialias=false | Display text using antialias (true) or not (false) |
backup.small=ucgl_14.zip | Specify the name of the backup font for the small grid |
backup.font=ucgl_18.zip | Specify the name of the backup font for the normal grid |
bitmap.font=false | Use only the backup font (true) or both normal and backup fonts (false) |
codepage=Cp1252 | Specify the initial codepage to display. This will be seen only when unicode=false or view->codepage is selected on the GUI |
details=false | Show font details (true) or not (false). This uses extra space above the font grid if enabled. |
draw=drawString | Method of drawing characters in the grid.
This is most useful as a unit test of Java2D, but how the characters are drawn does
make a difference for complex text.
The options are:
drawChars - Use Graphics2D.drawChars() drawString - Use Graphics2D.drawString() GlyphVector - Use Graphics2D.drawGlyphVector() TextLayout - Use TextLayout.draw() |
draw.details=pixels | Method of drawing the glyph in the character details window.
pixels - show the pixels at the current font size shape - show the outline using Graphics2D.draw(Shape s) GlyphVector - Use Graphics2D.drawGlyphVector() TextLayout - Use TextLayout.draw() |
font=dialog | Select the initial font to display glyphs |
font.size=18 | Select the initial font size. This can be 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, or 24. The default is 18 for normal size grid, and 14 for small grid. This size is not saved with the profile. |
fractional=false | Display text using fractional metrics (true) or not (false) |
sample=latin | Specify the sample text to display. The possible values are:
latin - Show "The quick brown fox" line indic - Show various indic scripts other - Show a variety of European and Asian scripts none - Do not show sample text |
small=1000 | Specify that small grid is to be used (true), or specify the horizontal screen resolution below which small grid is used. |
title=text | Title to show as the window title. This string is concatenated after " fontgrid ". The current window title is not saved with the profile. |
unicode=true | Specifies whether unicode (true) or codepage (false) is to be initially displayed. |
unicode.data=UnicodeData.txt | Specifies the name of the file containing the Unicode data. This can be used to specify an alternate version of the data. |
use.colors=true | Display characters from the backup font with a cyan background (true) or a white background (false). |
verbose=false | Print timing and other information to stdout (true) or not (false) |
vertical=false | Display the grid left to right, top to bottom (false) or top to bottom, left to right (true). The vertical display of the grid matches the Unicode charts. |
The menu options of fontgrid are:
File | |
Print2D | Print the grid using the Java2D |
PrintAWT | Print the grid using AWT |
Exit | Exit the application |
View | |
Unicode | Display unicode ranages |
Codepage | Display using a Java converter |
Unicode plane | Display a plane of unicode |
First Page | Set to Unicode page 0000 in plane 0 of Unicode |
Next Page | Display the next logical range or codepage |
Prev Page | Display the previous logical range or codepage |
Options | |
Vertical | Show the grid top to bottom |
Show all fonts | Show all fonts, not just font families |
Bitmap font only | Use the backup bitmap font only. This option is only available if there is a backup font. When this option is specified, the cyan background color is not painted for backup font glyphs. |
Use colors | Show the use of backup font glyphs with a cyan background, and glyphs which are not in the first font in a composite font in blue. |
Antialias | Draw using the antialias hint. This also affects the detail pixel view. |
Fractional metrics | Draw using the fractional metrics hint |
Verbose | Display timing information to stdout |
Details | Show font details above the grid |
Save options | Save the options to the profile. The options are saved to the "fontgrid.properties" profile in the user.dir directory. |
Draw | |
drawString | Draw the grid using Graphics.drawSting() |
drawChars | Draw the grid using Graphics.drawChars() |
GlyphVector | Draw the grid using Graphics.drawGlyphVector() |
TextLayout | Draw the grid using TextLayout.draw() |
Label | Draw the grid using AWT (deprecated) |
Latin text | Show a sample of mostly latin text |
Indic text | Show a sample with various Indic scripts |
Other scripts | Show a sample of worldwide scripts |
No text | Do not show any sample text |
Details | |
Show font details | Display the current font properties |
Draw pixels | Display character details showing pixels |
Draw outline | Display character details with only an outline |
GlyphVector | Display character details using GlyphVector |
TextLayout | Display character details using TextLayout |
Help | |
General help | Show this help file for fontgrid |
About fontgrid | Show a small panel with fontgrid credits |
The character details are selected by clicking on a grid entry. The glyph and character information for that codepoint are displayed. Much of the information comes from the Unicode character database (UnicodeData.txt) and will not appear if this file is missing.
There are four ways of displaying the glyph. The draw pixels and draw outline use the currently defined size to show the outline and rasterization at the selected font size. GlyphVector and TextLayout show the glyph as it appears at a large size. GlyphVector and TextLayout can differ when displaying complex scripts which require non-simple layout. The pixels and outline are always shown in GlyphVector form.
The glyph is drawn with a blue box showing the increment and the ascender and decender. The red line indicates the baseline.
When using pixel drawing, you can see the affect of the anitialias drawing hint.
Where the character type as known to Java does not match the character type as defined by the Unicode character database, both types are shown. This is normally because Java is based on an older version of Java.
Normally the character details are replaced when you ask for another character details. You can keep a character details display by pressing the detach button. This allows you to compare two characters, or the character in different fonts, resolution, or drawing options.
The backup bitmap font is not used in the Character Details box. You will always see the associated glyph from the selected font. This is often an open rectangle used to indicate an unknown glyph. It is also possible that a glyph will be shown even though the codepoint is undefined to Unicode.
If you have selected a converter, the Character Details will show the codepoint in that converter even when displaying from Unicode. This can be used to find the mapping of a character. You should first select the codepage, then switch back to Unicode display and select the character.
The font details are selected from the details menu. This opens up a window which displays details of the currently supported font, including the subfonts of a composite font. This is normally correct, but Java does not provide a means of finding the font.properties and fontgrid attempts to duplicate the selection offont.properties.
Ken Borgendale kwb@us.ibm.com Ken@Borgendale.com