J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | Font2DTest |
| 2 | ----------- |
| 3 | |
| 4 | To run Font2DTest: |
| 5 | |
| 6 | % java -jar Font2DTest.jar |
| 7 | or |
| 8 | % appletviewer Font2DTest.html |
| 9 | |
| 10 | These instructions assume that the 1.5 versions of the java |
| 11 | and appletviewer commands are in your path. If they aren't, |
| 12 | then you should either specify the complete path to the commands |
| 13 | or update your PATH environment variable as described in the |
| 14 | installation instructions for the Java(TM) SE Development Kit. |
| 15 | |
| 16 | To view Font2DTest within a web browser with Java Plugin, |
| 17 | load Font2DTest.html. |
| 18 | |
| 19 | If you wish to modify any of the source code, you may want to extract |
| 20 | the contents of the Font2DTest.jar file by executing this command: |
| 21 | |
| 22 | % jar -xvf Font2DTest.jar |
| 23 | |
| 24 | NOTE: |
| 25 | |
| 26 | When Font2DTest is ran as an applet, the browser plugin/viewer needs |
| 27 | following permissions given in order to run properly: |
| 28 | |
| 29 | AWTPermission "showWindowWithoutWarningBanner" |
| 30 | RuntimePermission "queuePrintJob" |
| 31 | |
| 32 | The program will run without these properties set, |
| 33 | but some of its features will be limited. |
| 34 | To enable all features, please add these permissions with policytool. |
| 35 | |
| 36 | ----------------------------------------------------------------------- |
| 37 | Introduction |
| 38 | ----------------------------------------------------------------------- |
| 39 | |
| 40 | Font2DTest is an encompassing application for testing various fonts |
| 41 | found on the user's system. A number of controls are available to |
| 42 | change many attributes of the current font including style, size, and |
| 43 | rendering hints. The user can select from multiple display modes, |
| 44 | such as one Unicode range at a time, all glyphs of a particular font, |
| 45 | user-edited text, or text loaded from a file. |
| 46 | In addition, the user can control which method will |
| 47 | be used to render the text to the screen (or to be printed out). |
| 48 | |
| 49 | ----------------------------------------------------------------------- |
| 50 | Tips on usage |
| 51 | ----------------------------------------------------------------------- |
| 52 | |
| 53 | - The "Font" combobox will show a tick mark if some of the characters in |
| 54 | selected unicode range can be displayed by this font. No tick is shown, |
| 55 | if none of the characters can be displayed. A tooltip is shown with this |
| 56 | information. This indication is available only if "Unicode Range" is |
| 57 | selected in "Text to use" combobox. |
| 58 | |
| 59 | This feature is enabled by default. For disabling this feature, use |
| 60 | command line flag -disablecandisplaycheck or -dcdc. |
| 61 | |
| 62 | java -jar Font2DTest.jar -dcdc |
| 63 | |
| 64 | - For the "Font Size" field to have an effect, it is necessary to press |
| 65 | ENTER when finished inputting data in those fields. |
| 66 | |
| 67 | - When "Unicode Range" or "All Glyphs" is selected for Text to Use, |
| 68 | the status bar will show the range of the characters that is |
| 69 | currently being displayed. If mouse cursor is pointed to one of |
| 70 | the character drawn, the message will be changed to indicate |
| 71 | what character the cursor is pointing to. |
| 72 | By clicking on a character displayed, one can also "Zoom" a character. |
| 73 | Options can be set to show grids around each character, |
| 74 | or force the number of characters displayed across the screen to be 16. |
| 75 | These features are not available in "User Text" or "File Text" mode. |
| 76 | |
| 77 | - The default number of columns in a Unicode Range or All Glyphs drawing |
| 78 | is "fit as many as possible". If this is too hard to read, then you |
| 79 | can force number of columns to be 16. However, this will not resize the |
| 80 | window to fit all 16 columns, so if the font size is too big, this will |
| 81 | overflow the canvas. (Unfortunately, I could not add horizontal space |
| 82 | bar due to design restrictions) |
| 83 | |
| 84 | - If font size is too large to fit a character, then a message will |
| 85 | inform that smaller font size or larger canvas size is needed. |
| 86 | |
| 87 | - Custom Unicode Range can be displayed by selecting "Custom..." |
| 88 | at the bottom of the Unicode Range menu. This will bring up |
| 89 | a dialog box to specify the starting and ending index |
| 90 | of the unicode characters to be drawn. |
| 91 | |
| 92 | - To enter a customized text, select "User Text" from Text to Use menu. |
| 93 | A dialog box with a text area will come up. Enter any text here, |
| 94 | and then press update; the text on screen will then be redrawn to |
| 95 | draw the text just entered. To hide the user text dialog box, |
| 96 | switch to different selection in Text to Use menu. |
| 97 | (Closing the dialog box will not work...) |
| 98 | If a escape sequence of form \uXXXX is entered, it is will be |
| 99 | converted into the character that it maps to. |
| 100 | |
| 101 | - drawBytes will only work for characters in Unicode range 0x00-0xFF |
| 102 | by its method definition. This program will warn when such text is |
| 103 | being drawn in "Range Text" mode. But since there is no way to detect |
| 104 | this from User Text, the warning will not be given even though |
| 105 | wrong text seems to be drawn on screen when it contains any character |
| 106 | beyond 0xFF. |
| 107 | |
| 108 | - In the "All Glyphs" mode which displays all available glyphs for the |
| 109 | current font, only drawGlyphVector is available as the draw method. |
| 110 | Similary, when "Text File" mode is used, the file will always be wrapped |
| 111 | to canvas width using LineBreakMeasurer, so TextLayout.draw is used. |
| 112 | |
| 113 | - With "User Text" mode, no text wrapping operation is done. |
| 114 | When displaying or printing text that does not fit in a given canvas, |
| 115 | the text will overflow to the right side of the page. |
| 116 | |
| 117 | - It is also possible to display a text loaded from a file. |
| 118 | Font2DTest will handle is UTF-16 and the platform default encoding. |
| 119 | The text will then be reformatted to fit in the screen with |
| 120 | LineBreakMeasurer, and drawn with TextLayout.draw. |
| 121 | Most major word processor softwares support this format. |
| 122 | |
| 123 | - When printing, the program will ask to select 1 of 3 options. |
| 124 | First "Print one full page..." will print as much |
| 125 | characters/lines of text as it can fit in one page, starting from |
| 126 | the character/line that is currently drawn at the top of the page. |
| 127 | Second option, "Print all characters..." will print all characters |
| 128 | that are within the selected range. Third option, "Print all text..." |
| 129 | is similar, and it will print all lines of text that user has put in. |
| 130 | |
| 131 | ==================================================================== |
| 132 | |
| 133 | Known Problems: |
| 134 | |
| 135 | - When a PostScript font is used, the characters may extend beyond the |
| 136 | enclosing grid or zoom rectangle. This is due to the problem with |
| 137 | FontMetrics.getMaxAscent() and getMaxDescent() functions; the functions |
| 138 | do not always return the right values for PostScript fonts. |
| 139 | |
| 140 | - There are still some bugs around the error handling. |
| 141 | Most of these problems will usually get fixed when some parameters |
| 142 | are changed, or the screen is refreshed. |
| 143 | |
| 144 | - Many fonts on Solaris fails to retrieve outlines properly, |
| 145 | and as the result, they do not align within the grid properly. |
| 146 | These are mainly F3 and fonts that was returned by X server. |
| 147 | |
| 148 | - When showWindowWithoutWarningBanner AWTPermission is not given, |
| 149 | the "zoom" window will look really bad because of the |
| 150 | Applet warning label tacked at the bottom of the zoom window. |
| 151 | To remove this, follow the "NOTE:" instruction at the top. |