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