Antigrav Toolkit Notebook
by Randy Winchester

The Case of the Missing Characters

. . . Now in this limited time offer, buy any of the laser fonts and receive as our gift up to 94 NEW characters absolutely FREE! That's like getting TWO FONTS FOR THE PRICE OF ONE! This exclusive Antigrav Toolkit offer is not available in stores, so read this article. Act now!

The first time I saw a printout of ALL the characters in a PostScript font, I could hardly believe my eyes. Fonts such as Helvetica (LW_Cal) and Times Roman (LW_Roma) each have 54 characters not found in the corresponding GEOS fonts. Symbol (LW_Greek) and ITC Zapf Dingbats (LW_Shattuck) each have 94 characters that have been hidden from GEOS users.

The previously unseen characters in the Symbol font include such useful things as arrows, math and logic operators, copyright and trademark symbols, and a whole set of do-it-yourself brackets and braces. A complete copy of the Symbol font, a.k.a. LW_Greek, is reproduced here for your viewing pleasure. Characters with ASCII values from $21 through $7E (! through ~) are the characters normally available in GEOS. The characters on the bottom half of the chart, ASCII values $A1 through $FE, are not presently available in the LW_Greek font (and it wouldn't do you much good even if they were).

The geoWrite Bottleneck

The new characters use ASCII values $A1 through $FE. If only there were some way of typing these values directly into a geoWrite document, using these characters would be smooth sailing. Unfortunately, the highest ASCII code that can be entered directly from the keyboard is $7F, which corresponds to the DELETE character.

It's reasonably easy to enter these codes into a PostScript program created by geoLaser or geoPubLaser (see Accessing Laser Printers, geoWorld, Volume 2, Issue 3, March 1998; Inside PostScript, geoWorld, Volume 2, Issue 4, Number 13). The only extra software required will be a plain old ASCII text editor which will be used to edit the PostScript program. Briefly, the procedure is to type in a rarely used character into your document whenever one of the new characters is required. Save the document as a PostScript program, then use the text editor to enter the new charager codes. Here are some step-by-step instructions, illustrations, suggestions, etc.

Here's How, Step-By-Step

1. Prepare a geoWrite or geoPublish document in the way you normally would. Decide where in the document you would like the special characters to appear. Be sure to select the correct font, point size, and style, then enter a character that you don't plan on using elsewhere in your document. I usually use the tilda, ~, ASCII $7E, but since I already use that character in this article several times, I'll settle on the percent sign. But honestly, hwo often do you use a ~ in your writing? So, for the examples in this article, I'll continue to use the ~, although any character you don't use elsewhere in the document will work equally well. Complete your geoWrite or geoPublish document as you normally would otherwise.

2. Use the "Antigrav Method" (In Search of Elegance, geoWorld, Issue 17) to send a PostScript program to another computer. You can verify you have a good copy of the PostScript program by laser printing it. Remember that at this point, positions where you want special characters to appear will be marked with a ~.

3. Fire up your favorite ASCII text editor and read in the PostScript program created in step 1. Search for the first occurrance of the ~ character. You'll probably find it in a line similar to this:

0 9 0 (Buy VAPOR Brand) 1 3 121 80 8 PS
 0 9 0 (~) 1 3 298 212 8 PS
 0 9 0 ( Software Products!) 1 0 38 521 8 PS

The numbers on each line are parts of the PostScript program which provide information such as page position, font type, style, and size. PostScript uses parentheses to quote text to be printed. In the exampel above, the ~ character will be replaced with a backslash followed by the ASCII value of the special character in octal, or base 8.

 In this case, we want the Helvetica style registered trademark symbol (®), which is ASCII $E2, or 342 octal in the Symbol font. The entire example above will now read:

0 9 0 (Buy VAPOR Brand) 1 3 121 80 8 PS
  0 9 0 (\342) 1 3 298 212 8 PS
  0 9 0 ( Software Products!) 1 0 38 521 8 PS

which should look like this when printed:

Buy VAPOR Brand® Software Products!

4. Finish up the rest of your document filling in the rest of the character codes as necessary.

Hints & Tips

Keep in mind that any justification done by geoWrite will be based on the character you decide to use as your flag character, usually ~. Generally, such small differences in spacing won't be noticable, but if it's a real problem, you can use a wider or thinner character to mark your place. Actually, you can use any character you like. I only select an unusual character such as ~ to make it easy to scan the file for the places I've marked, and to use the search function on my text editor to make sure I didn't miss any places. In actual use, it is generally not difficult to read through the text portions of a PostScript program, and locate where special characters will be entered, due to the context.

I would like to include your GEOS hints & tips and bug reports in future columns. If you have any brief GEOS tricks, bugs, helpful hints, or whatever, please send them to me.

Randy Winchester
P.O. Box 426074
Cambridge, MA 02142

Easy Octal Math!

If you think you've been hexed by hexadecimal, you'll be relieved to know that octal has very little to do with gasoline or mollusks. The octal numbering system, also known as base 8, isn't in too frequent use anymore. I'm not really sure why it was chosen to represent non-ASCII characters in PostScript. Fortunately, octal isn't much of a curse, and isn't too terrible to learn.

In octal, only the digits 0 - 7 are used. Because of this, octal numbers look exactly like ordinary everyday numbers except that you'll never see the digits 8 or 9. Often, to distinguish an octal number from an ordinary decimal number, it will be preceded by an ampersand, such as &257 or followed by a subscripted 8 as in 3118. Counting in octal is almost the same as the way we've always counted, except that when 7 is reached the next step is 108 which is equal to 8.

In order to access the extra characters in a PostScript laser font, you'll have to know their values in octal or at least how to convert numbers to octal from decimal or hex. The conversion is based on simple division. It's made even simpler if you realize the highest number you'll encounter in this work is 255, $FF hex, or 377 octal, the highest number which can be represented by one byte.

Enough of this math lesson. Here's the assignment. We'll find the octal value for a common ASCII character, the lower case k. Lower case k is ASCII character 107. We first divide the number by 64 and write it down, then divide the remainder by 8 and write that down. then write down the remainder, and you've converted the number to octal.

Divide by 64 (107 ÷ 64 = 1) remainder = 43; 1 goes in hundreds place
Divide 43 by 8 (43 ÷ 8 = 5) remainder = 3; 5 goes in 10's place
Remainder of 3 goes in one's place

107 is equal to 153 octal.

I'll leave converting from hex to octal as an exercise for those inclined. Just to clue you in though, if you already know hex, it's a lot easier than you might think.

Return to AntiGrav GEOS Page