OS/2 Codepage and Keyboard Display Tools

Download the tools - 450KB. Unzip this file into a directory. You can use them from that directory.

SHOWCP - Show codepage

The showcp application allows you to display various codepages and unicode. This is written as a PM testcase, and can be used as a sample for doing unicode display processing.

There is a single parameter which is a codepage number. If this is not specified, the current process codepage is used.

A grid of 256 codepoints is displayed. Basic information about the character the mouse is over is shown at the bottom of the screen. For detailed information select the character with the mouse. When this codepoint is the starter for a multiple byte sequence (as shown by a number in red) selecting it will bring up another page of 256 codepoints.

Return to a previous level by selecting outside the character box. On the character info screen, you can select anywhere on the main window to return. If you need to set focus without returning, select the frame of the window. You can use the PageUp and PageDown keys to move to previous or subsequent characters or wards.

You can select from a large set of codepages which are supported by PM. You can change to a predetermined list of fonts. This will give you a system font if you do not have the font installed.

You can print the page which will be sent to your default printer.

Installation

The files showcp.exe, unicode.nam, and unicode.tab should be in the current directory or in the path. This code should run on any version of Warp or Merlin on which any version of Java is installed. For full functionality, it is necessary to have the unicode font (Times New Roman MT 30) which comes with Java 1.1.

To display the full unicode set, it is necessary to replace the IBM949 file in /language/codepage. This changes the definition to the Microsoft 949 definition.

PRINTKB - Print a keyboard

The printkb utility allows you to print a graphic representation of a keyboard layout using PostScript.

makekb takes two fixed parameters, and a set of switches which start with a hyphen (-). The options can be specified at any point in the command. File names may use either slash (/) or backslash (\) as a path separator.

   printkb kblfile  [otufile]  -options

The first parameter is the name of the input keyboard layout file. If a name without extension is given, the file type ".kbl" is added. This can give the path to the file.

The second parameter is optional and specifies the name of the output keyboard layout file. If this is not specified, the output is sent to "lpt1".

There are several options which must begin with a hyphen (-) and may be anywhere in the command line.

-b
Draw box around keyboard
-c
Show cursor pad as well as the normal keyboard. This is not the default since this area rarely changes based on layout except for the decimal point key.
-f
Show function keys
-h
Print hex scancode numbers
-i
Use ISO key icons for function keys
-k
Show keypad and cursor pad as well as the normal keyboard. This is not the default since this area rarely changes based on layout.
-K
Show keypad, cursor pad, and 122 function keys to the left of the normal keys as well as the normal keyboard.
-l:###
Physical layout (84, 85, 89, 101, 102, 106, 122). By default, this information is taken from the layout object.
-m
Publication format (no headers). This is used to create an Encapsulated PostScript file with a bounding box matching the drawn box but without any headers. This is designed to be used when the output is embedded in another document.
-n
Use names for keys. The file printkb.sft is used to select names for a particular keyboard.
-p
Print in portrait mode
-q
Do not show informational messages
-v
Print additional information. This is used while debugging to show the version numbers and country information.
-s:## .
Scale factor (40 - 120). The default scale factor (100) is designed to use most of a landscape page.
-z
Do not shade gray keys. Normally gray keys are shaded to make the keyboard look more like the actual keyboard. This can cause loss of readability at small sizes.

printkb tries to simulate the normal method of engraving keytops. It is possible for a key to have more meanings that printkb will use. printkb will place up to four labels on a key. All labels are placed on the surface of the key. On real keyboards, the alt or altgr actions are often labeled on the front of the key.

The resulting output is valid Encapsulated PostScript (it contains structuring comments including a BoundingBox). It can thus be used as input to any program which takes EPS.

Lower left
This is the base character assigned to this key
Upper left
This is the shift character assigned to this key. If this is the uppercase of the base character then a large upper left character is shown, and the lower case character is not shown.
Lower right
This is the alt graphic character assigned to this key. If the shift-altgr character is the uppercase of this character, only the uppercase version is shown in this location.
Upper right
This is either the NLS or shift-altgr character. Keyboards should not assign both.

It is possible to create a keyboard definition which is too complex for printkb. The keyboard used to input Japanese is a example of this where there are a large number of meanings assigned to each key. To get a usable printout you may desire to construct two keyboards for printing purposes.

Deadkeys are shown with a small gray blob where the character would be.

The files printkb.dlf, printkb.psh, and printkb.sft must be in the current directory or in the PATH in order to run printkb.

PRINTCP - Print a codepage

The printcp utility provides a means of printing a codepage using PostScript. This only works for single byte codepages and the single byte part of double byte codepages. The output file can be sent directly to a printer, or an encapsulated PostScript file can be created.

printcp takes two fixed parameters, and a set of switches which start with a hyphen (-). The options can be specified at any point in the command. File names may use either slash (/) or backslash (\) as a path separator.

    printcp  codepage  [outfile]  -options

The first parameter is the input codepage, and can be a uconv object, an AFP codepage, or an IBM source format codepage. This is the pathname to the input file.

The second parameter is the output file. If not specified, this defaults to "lpt1".

There are a large number of options which are used to customize the desired printout:

-b
Draw box to show the bounding box. This is useful to understand how the output will appear as an encapsulated PostScript object.
-c:####
Codepage number. This can be used to override the codepage number specified within the object.
-i
IBM character names. Annotate each character with the name of the character using IBM CGIDs. This is an 8 character name.
-l
Show baseline. Draw a small line to indicate the position of the baseline. This is helpful in identifying some characters which differ from each other only by position.
-m
Publication format. This form produces the codepage table with no header information. This is designed to make encapsulated PostScript files which can be embedded in another document which has all header information.
-n
Codepoint number. Annotate each character with the decimal number of the codepoint.
-q
Do not show informational messages. This is normally used from within a command file which does its own messages.
-r
Reverse direction. By default characters are presented left to right. Many people like codepages printed with characters moving top to bottom which is done if this option is selected.
-s:##
Scale factor (25 - 200). The default scale factor fills a letter or A4 size page with minimal margins. To allow for full margins a scale factor of about 94 should be used.
-u
Unicode annotation. Annotate each character with the hex unicode number of the characters.
-x:####
DBCS range (4 hex digits -x&colon.819E). This can be used to override the DBCS starter range in the input (or when the input does not contain this information).
-z:####
Partial grid (4 hex digits -z&colon.40FF). This option is used when the full 16x16 grid is not desired.

The following are examples of calls to printcp:

   printcp ibm850 ibm850.eps -u -m
   printcp /language/codepage/ibm850 -i -l

The files unicode.nam, printkb.dlf, and printcp.psh must be in the current directory or in the PATH in order to run printcp.