Path: blob/master/src/demo/share/jfc/Font2DTest/README.txt
41152 views
Font2DTest1-----------23To run Font2DTest:45% java -jar Font2DTest.jar6or7% appletviewer Font2DTest.html89These instructions assume that the 1.7 versions of the java10and appletviewer commands are in your path. If they aren't,11then you should either specify the complete path to the commands12or update your PATH environment variable as described in the13installation instructions for the Java(TM) SE Development Kit.1415To view Font2DTest within a web browser with Java Plugin,16load Font2DTest.html.1718If you wish to modify any of the source code, you may want to extract19the contents of the Font2DTest.jar file by executing this command:2021% jar -xvf Font2DTest.jar2223NOTE:2425When Font2DTest is ran as an applet, the browser plugin/viewer needs26following permissions given in order to run properly:2728AWTPermission "showWindowWithoutWarningBanner"29RuntimePermission "queuePrintJob"3031The program will run without these properties set,32but some of its features will be limited.33To enable all features, please add these permissions.3435-----------------------------------------------------------------------36Introduction37-----------------------------------------------------------------------3839Font2DTest is an encompassing application for testing various fonts40found on the user's system. A number of controls are available to41change many attributes of the current font including style, size, and42rendering hints. The user can select from multiple display modes,43such as one Unicode range at a time, all glyphs of a particular font,44user-edited text, or text loaded from a file.45In addition, the user can control which method will46be used to render the text to the screen (or to be printed out).4748-----------------------------------------------------------------------49Tips on usage50-----------------------------------------------------------------------5152- The "Font" combobox will show a tick mark if some of the characters in53selected unicode range can be displayed by this font. No tick is shown,54if none of the characters can be displayed. A tooltip is shown with this55information. This indication is available only if "Unicode Range" is56selected in "Text to use" combobox.5758This feature is enabled by default. For disabling this feature, use59command line flag -disablecandisplaycheck or -dcdc.6061java -jar Font2DTest.jar -dcdc6263- For the "Font Size" field to have an effect, it is necessary to press64ENTER when finished inputting data in those fields.6566- When "Unicode Range" or "All Glyphs" is selected for Text to Use,67the status bar will show the range of the characters that is68currently being displayed. If mouse cursor is pointed to one of69the character drawn, the message will be changed to indicate70what character the cursor is pointing to.71By clicking on a character displayed, one can also "Zoom" a character.72Options can be set to show grids around each character,73or force the number of characters displayed across the screen to be 16.74These features are not available in "User Text" or "File Text" mode.7576- The default number of columns in a Unicode Range or All Glyphs drawing77is "fit as many as possible". If this is too hard to read, then you78can force number of columns to be 16. However, this will not resize the79window to fit all 16 columns, so if the font size is too big, this will80overflow the canvas. (Unfortunately, I could not add horizontal space81bar due to design restrictions)8283- If font size is too large to fit a character, then a message will84inform that smaller font size or larger canvas size is needed.8586- Custom Unicode Range can be displayed by selecting "Custom..."87at the bottom of the Unicode Range menu. This will bring up88a dialog box to specify the starting and ending index89of the unicode characters to be drawn.9091- To enter a customized text, select "User Text" from Text to Use menu.92A dialog box with a text area will come up. Enter any text here,93and then press update; the text on screen will then be redrawn to94draw the text just entered. To hide the user text dialog box,95switch to different selection in Text to Use menu.96(Closing the dialog box will not work...)97If a escape sequence of form \uXXXX is entered, it is will be98converted into the character that it maps to.99100- drawBytes will only work for characters in Unicode range 0x00-0xFF101by its method definition. This program will warn when such text is102being drawn in "Range Text" mode. But since there is no way to detect103this from User Text, the warning will not be given even though104wrong text seems to be drawn on screen when it contains any character105beyond 0xFF.106107- In the "All Glyphs" mode which displays all available glyphs for the108current font, only drawGlyphVector is available as the draw method.109Similary, when "Text File" mode is used, the file will always be wrapped110to canvas width using LineBreakMeasurer, so TextLayout.draw is used.111112- With "User Text" mode, no text wrapping operation is done.113When displaying or printing text that does not fit in a given canvas,114the text will overflow to the right side of the page.115116- It is also possible to display a text loaded from a file.117Font2DTest will handle is UTF-16 and the platform default encoding.118The text will then be reformatted to fit in the screen with119LineBreakMeasurer, and drawn with TextLayout.draw.120Most major word processor softwares support this format.121122- When printing, the program will ask to select 1 of 3 options.123First "Print one full page..." will print as much124characters/lines of text as it can fit in one page, starting from125the character/line that is currently drawn at the top of the page.126Second option, "Print all characters..." will print all characters127that are within the selected range. Third option, "Print all text..."128is similar, and it will print all lines of text that user has put in.129130====================================================================131132Known Problems:133134- When a PostScript font is used, the characters may extend beyond the135enclosing grid or zoom rectangle. This is due to the problem with136FontMetrics.getMaxAscent() and getMaxDescent() functions; the functions137do not always return the right values for PostScript fonts.138139- There are still some bugs around the error handling.140Most of these problems will usually get fixed when some parameters141are changed, or the screen is refreshed.142143- Many fonts on Solaris fails to retrieve outlines properly,144and as the result, they do not align within the grid properly.145These are mainly F3 and fonts that was returned by X server.146147- When showWindowWithoutWarningBanner AWTPermission is not given,148the "zoom" window will look really bad because of the149Applet warning label tacked at the bottom of the zoom window.150To remove this, follow the "NOTE:" instruction at the top.151152153