




              Customizing PostScript Character Sets
                       For WordStar 6.0


                       Julie Rosenberg
                          71630,511
               Copyright 1991, All Rights Reserved




     Standard PostScript text fonts usually contain a number of useful 
characters which are not included in WordStar's default PS character 
set. Within certain limits, you can modify the character set to include 
some of these characters. The default character set is a partial 
emulation of the PC850 (Code Page 850) character set, including most of 
the European accented alphabetic characters but excluding the line-draw 
characters. Because of a limitation in the range of character codes 
recognized by WordStar's PostScript driver (DRIVERPS.OVR), the only 
reliable way to get different characters, such as true open/close 
quotes, is to substitute them for existing characters in the set. 
Onscreen display (in the WS editor and in Advanced Page Preview) won't 
be correct, but your printed output should reflect the changes.

There are three essential steps for substituting characters:

   1. Decide which characters you want to add, and which characters 
you're willing to give up in order to get them.
   2. Modify the PostScript encoding vector (character map) in the 
WordStar prologue (WSPROL.PS, WSPROL2.PS, and/or any custom prologue you 
may be using).
   3. Modify the proportional spacing tables for fonts in your 
PostScript PDFs.


Step One -- Selecting Characters
================================

     Let's assume you want to add typographer's open and close quotes 
to your WordStar PostScript character set. In order to add these two 
characters, we have to select two characters in the existing character 
set for replacement. This selection is entirely up to you, but be 
forewarned that once you modify your prologue(s) and PDF(s), your 
WordStar documents may not print correctly unless you use those 
customized printer files.

     The available characters are listed in the PostScript encoding 
array in WSPROL.PS. Here are the contents of that encoding array, listed 
sequentially with matching decimal character codes; these are the ECS 
characters and codes available for remapping and substitution. Missing 
numbers represent codes which should be avoided, as results are 
unreliable in WordStar 6.0:

  7	/bullet                     173	/exclamdown  
 20	/paragraph                  174	/guillemotleft  
 21	/section                    175	/guillemotright 
                                       
128	/Ccedilla                   181	/Aacute  
129	/udieresis                  182	/Acircumflex 
130	/eacute                     183	/Agrave  
131	/acircumflex                184	/copyright 
132	/adieresis                 
133	/agrave                     189	/cent  
134	/aring                      190	/yen 
135	/ccedilla                  
136	/ecircumflex                198	/atilde  
137	/edieresis                  199	/Atilde  
138	/egrave                    
139	/idieresis                  207	/currency  
140	/icircumflex               
141	/igrave                     210	/Ecircumflex 
142	/Adieresis                  211	/Edieresis 
143	/Aring                      212	/Egrave  
144	/Eacute                     213	/dotlessi  
145	/ae                         214	/Iacute  
146	/AE                         215	/Icircumflex 
147	/ocircumflex                216	/Idieresis 
148	/odieresis                 
149	/ograve                     222	/Igrave  
150	/ucircumflex               
151	/ugrave                     224	/Oacute  
152	/ydieresis                  225	/germandbls  
153	/Odieresis                  226	/Ocircumflex 
154	/Udieresis                  227	/Ograve  
155	/oslash                     228	/otilde  
156	/sterling                   229	/Otilde  
157	/Oslash                    
                                    233	/Uacute  
                                    234	/Ucircumflex 
159	/florin                     235	/Ugrave  
160	/aacute                    
161	/iacute                     238	/macron  
162	/oacute                     239	/acute 
163	/uacute                    
164	/ntilde                     247	/cedilla 
165	/Ntilde                     248	/ring  
166	/ordfeminine                249	/dieresis  
167	/ordmasculine               250	/dotaccent 
168	/questiondown  
169	/registered 
170	/logicalnot 


For this example, we'll replace the two guillemots (the << and >>) with 
open/close quotes. 



Step Two -- Modifying the Prologue
==================================

     Decide whether you want to modify the default WSPROL.PS (and/or 
WSPROL2.PS) or create a new prologue file under a different name, for 
special purposes.  If you create a new prologue file, you will have to 
modify one or more PDFs to substitute the name of the new prologue file. 
Instructions for editing PDFs are included in a later section. In any 
event, before starting make sure you have a backup copy of WSPROL.PS and 
WSPROL2.PS.

     PostScript prologues are *non* document (ASCII) files, so be sure 
you open WSPROL.PS in *non*document mode (N from the Classic WordStar 
opening menu; FN from the opening pull-down menu). Open the file as a 
non-document, and scroll to the end of the file. From the end of the 
file, scroll up a screen or two (^R, or PgUp) to see the default 
encoding vector WordStar uses. The "encoding vector" is an array 
(indexed list) describing the character set. The WS encoding array in 
WSPROL.PS looks like this:

  [  7	/bullet
    20	/paragraph /section
   128	/Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave
	/aring /ccedilla /ecircumflex /edieresis /egrave /idieresis 
	/icircumflex /igrave /Adieresis /Aring /Eacute /ae /AE 
	/ocircumflex /odieresis /ograve /ucircumflex /ugrave /ydieresis
	/Odieresis /Udieresis /oslash /sterling /Oslash 
   159	/florin /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine
	/ordmasculine /questiondown /registered /logicalnot 
   173	/exclamdown /guillemotleft /guillemotright 
   181	/Aacute /Acircumflex /Agrave /copyright 
   189	/cent /yen
   198	/atilde /Atilde
   207	/currency
   210	/Ecircumflex /Edieresis /Egrave /dotlessi /Iacute /Icircumflex
	/Idieresis
   222	/Igrave
   224	/Oacute /germandbls /Ocircumflex /Ograve /otilde /Otilde
   233	/Uacute /Ucircumflex /Ugrave
   238	/macron /acute
   247	/cedilla /ring /dieresis /dotaccent ]

     In this example, we will replace the two guillemot characters with 
the open quote and close quote characters. Find the line in the encoding 
vector array with the two guillemot characters:

   173	/exclamdown /guillemotleft /guillemotright 

Carefully substitute the open/close quote character names:

   173  /exclamdown /quotedblleft /quotedblright

check spelling very carefully, and be sure to include the slash / before 
each character name. Alternately, you might open WSPROL.PS in a second 
editing window, and block copy the correct line from this file into the 
prologue. If you want a reference for a later edit, to return to 
defaults, you can also "comment out" the original line, using the 
PostScript comment character %

   %173  /exclamdown /guillemotleft /guillemotright 
    173  /exclamdown /quotedblleft /quotedblright

The PS interpreter will ignore the line beginning with the % character.  

     If you are adding other characters, such as endash or emdash, edit 
the prologue file in the same manner. After choosing which character to 
replace, find that character in the encoding array, and replace it with 
the new character. Be sure to use the correct character name (standard 
PostScript character names are listed in the font's AFM file; many 
PostScript reference books also contain a list of standard character 
names). Remember that PostScript is case-sensitive, so be very careful 
about spelling and capitalization. Make a note of the character code for 
each substitution.

     After you have edited the character names, save the prologue file. 
If you want to set up a customized prologue for special purposes, you 
will have to edit the file name in the PDF, as indicated below. If you 
intend to leave this edited prologue as your default, you need not edit 
the file name. By default, all PostScript PDFs are originally installed 
to call WSPROL.PS (if you installed a "2-up" PDF, its prologue is 
WSPROL2.PS by default).


Step Three -- Modifying the Proportional Spacing Tables
=======================================================

     The next step is editing the proportional spacing tables in the 
PDF, to reflect the differences in the width of the new characters. For 
every new character, you *must* check the width value for the original 
character *and* the substitute character in every installed proportional 
text font. It may turn out that for some fonts there is no difference 
between the default and the substitute character, while for other fonts, 
the difference is significant. If you don't check for and adjust these 
spacing differences, you may find spacing anomalies in your printed 
output. Without correct spacing tables, WordStar cannot properly 
calculate spacing and line lengths. If the new characters are the same 
width as the ones they are replacing, you do not have to edit the tables 
for those characters. But you must check the values for each character 
in *every* proportional font

     The widths for all characters in a PostScript font are contained 
in the AFM (Adobe Font Metrics) file for that font. AFMs are ASCII files 
(non-documents) and may be examined in non-document mode, or with any  
ASCII file-viewer or editor. The top portion of an AFM contains general 
font information. Following that portion is a section of character 
metrics, which lists the character code (for standard PostScript 
encoding, or character set), the character width, the character's name, 
and its bounding box values. Here's a typical character metrics line 
from an AFM:

     C 65 ; WX 623 ; N A ; B -25 -3 643 676 ;
       \      \       \     \
        \      \       \     \___ the boundingbox values
         \      \       \ ________the character Name ("A")
          \      \ _______________the character width, 623
           \ _____________________the character code, 65 decimal

     To check a character's width, find the character's name (remember 
that PostScript is case-sensitive; "A" and "a" are two different 
characters) in the table, and its width will be the number following the 
WX label.  Note that in the AFM, the characters are listed in the order 
for "StandardEncoding"; as most PostScript fonts contain many unencoded 
characters (characters which are available, but not part of the default 
PostScript character set), after the section of numbered data lines you 
will find additional character metrics with a value of -1 for "C".  The 
-1 value is of no significance for modifying the WordStar character set, 
so don't worry about it. The WX or width value is what you need to 
check.

     Some sample character width comparisons are included below. These 
values have been extracted from AFMs; if you need values for other 
characters, check the AFMs for the fonts you're going to modify.

     If you have to edit the tables, you will need to know the 
hexadecimal value of the character codes to be modified. The ASCII 
conversion table in the back of the WordStar reference manual includes 
decimal and hexadecimal values for character codes. In our example we 
are modifying the widths of characters 174 and 175, so we need to know 
their hexadecimal code equivalents: AEh and AFh, respectively.

In order to correct the spacing tables, you must run the PDFEDIT utility. 

**ALWAYS MAKE A BACKUP COPY OF A PDF BEFORE USING PDFEDIT TO MODIFY IT**

     This program is in the same directory as your main WordStar 
program files.  If you have not already done so, exit WordStar and log 
the drive and directory containing your program files (usually, \WS). 
From the DOS prompt, load PDFEDIT by entering the program name at the 
prompt:

     C:\WS>PDFEDIT

     After the program loads, press any key to continue past the 
opening screen.  You will be presented with a list of available PDFs for 
editing. Select the PDF you want to work on, and press <enter>. The 
program will load that PDF into memory, and present you with the PDFEDIT 
main menu.

     To edit the proportional spacing tables, choose Typestyle/font 
information from the main menu.

     At the next menu, Type Style Definitions, choose a type style to 
modify from the list presented. Remember: you do not have to modify 
Courier, as it is a monospaced font, and all characters have the same 
width. Do not select non-text fonts such as Symbol, or ZapfDingbats. In 
this example, we will choose Helvetica.

     Select Helvetica, and the next menu will be Edit Type Style Table. 
On this screen, select Edit Font Size Tables. The next screen will ask 
you to choose a font and size to modify; as PostScript fonts are 
scalable in WordStar 6, you need only select the typestyle name. At the 
next menu, select Edit Type Width Table. You will see a listing of the 
different type styles installed for this typeface:

     Normal:      Helvetica ...
     Italic:      Helvetica I ...
     Bold:        Helvetica B ...
     Bold-Italic: Helvetica BI ...

     You will have to choose each of the four typefaces (or more, if 
you have customized the PDF to use different fonts for subscript, 
superscript, etc.) in turn, and modify its proportional spacing table as 
described below.

     Choose a type style, and the next menu will offer you a choice of 
editing a number of different tables. Choose the proportional spacing 
table. The table will be loaded, and you will see the first of eight 
screen "pages" of information. Note the "page" number in the upper right 
corner. The ECS portion of the table begins on page 5, so use PgDn to 
scroll the display to the page you want. For our example, the guillemot 
characters, decimal 174 and 175, are on page 6. Note that the tables use 
hexadecimal notation for the character codes. The guillemots are listed 
at codes AEh and AFh, and since they are normally included in the 
default set of PC8 screen characters, you can see them:

     AE  <<  556
     AF  >>  556
     \    \    \___________character width value
      \    \ ______________character
       \___________________hexadecimal character code


     Move the cursor to the character width value you have to change, 
and enter the new width. (For the Helvetica example, the values for the 
open and close quote character widths are 333 and 333) Do this for each 
character you have changed in the encoding.

     Press <F10> to save the changes and back up one menu. Press <ESC> 
to go back to the typestyle menu, and select the next typeface in the 
group (in this example, it would be Helvetica Italic). Modify the 
proportional spacing table for that font, and for each font in the 
group.

     PDFEDIT is known to be somewhat unstable under certain conditions, 
often with large PDFs in low-memory situations, so for the best, safest 
results, it's a good idea to save often. The most reliable way to save 
your edits is to make them to one font group at a time, save, and back 
out of the editor (saving at each screen that offers you the chance to 
do so), exiting PDFEDIT altogether before reloading it to work on the 
next font group.  This sounds disagreeably tedious (and it is), but it 
is the only way to be sure of keeping all the edits you make to the 
tables. In low memory situations, PDFEDIT will not always save every 
change if you have made a lot of them during one session. For safety's 
sake, edit the tables in separate sessions, and save the PDF in between, 
exiting and reloading PDFEDIT before the next session. It's not a bad 
idea, either, to make a backup copy of the PDF between sessions, just in 
case something goes wrong.

============

     Example character width values for proportionally-spaced Adobe 
text fonts in an Apple LaserWriter appear in the table below. Note that 
the width for the open quote character (quotedlbleft) is not necessarily 
the same as the width of the close quote character (quotedblright), and 
that for some typefaces, the open/close quotes have very different 
widths than the guillemots (wider, or narrower). 

character representation conventions:

	<< guillemotleft
	>> guillemotright
	`` quotedblleft
	'' quotedblright
	-- endash
	--- emdash

Typeface		<<	>>	``	''	--	---

Helvetica		556	556	333     333     556     1000
   Italic		556     556     333     333     556     1000
   Bold			556     556     500     500     556     1000
   Bold-Italic		556     556     500     500     556     1000
            
Times			500     500     444     444     500     1000
   Italic		500     500     556     556     500     1000
   Bold			500     500     500     500     500     1000
   Bold-Italic		500     500     500     500     500     1000
            
Avant Garde Gothic	425     425     502     484     500     1000
   Italic		425     425     502     484     500     1000
   Bold			460     460     480     480     500     1000
   Bold-Italic		460     460     480     480     500     1000
            
Bookman			360     360     400     400     500     1000
   Italic		300     300     440     440     500     1000
   Bold			400     400     540     540     500     1000
   Bold-Italic		380     380     520     520     500     1000


            

        		<<	>>	``	''	--	---

NewCenturySchoolbook	426     426     389     389     556     1000
   Italic		426     426     389     389     500     1000
   Bold			500     500     481     481     500     1000
   Bold-Italic		481     481     481     481     500     1000
            
Helvetica Narrow	456     456     273     273     456     820
   Italic		456     456     273     273     456     820
   Bold			456     456     410     410     456     820
   Bold Italic		456     456     410     410     456     820
            
Palatino		500     500     500     500     500     1000
   Italic		500     500     500     500     500     1000
   Bold			500     500     500     500     500     1000
   Bold-Italic		500     500     500     500     500     1000
            
ZapfChancery		340     380     340     360     500     1000


Using a Customized Prologue
===========================

     For PostScript printers, WordStar requires that a prologue file be 
sent to the printer with each document file. The default prologue is 
WSPROL.PS (for "2-up" PDFs, WSPROL2.PS); when you print to a PostScript 
printer, WordStar looks for the name of the prologue file in the PDF and 
sends that file with the document. If you customize a version of 
WSPROL.PS, and want to use it under a different name, you can change the 
PDF to call the customized file by editing the file name string in 
PDFEDIT.

     From the PDFEDIT main menu, select "Control Strings", and on the 
next screen you will be presented with several settings you can change. 
The prologue file is listed under "Job Initialization String" 
(WSPROL.PS). Move the cursor to that field, and edit the file name for 
the customized prologue for this PDF. Save the PDF and exit.


