home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d768
/
uedit.lha
/
Uedit
/
Documentation
/
UEP-DOC
< prev
next >
Wrap
Text File
|
1992-11-22
|
21KB
|
471 lines
UEP.table, Proportionality Table
The UEP.table file is a proportionality table used by both UEP and the F
filter program. It has 256 1-byte entries, one for each ASCII character 0-
255. The largest table entry value is 24, which is used for the widest
letters, such as "M" and "W". Narrower letters and symbols have smaller
table entries; for instance, the letter "i" (ASCII 105) uses a value of 16
and the "|" symbol (ASCII 124) uses a value of only 8.
The current UEP.table contents are shown at the end of this doc file.
Foreign letters: The UEP.table provided does not contain valid values in the
upper (ASCII 128-255) range for foreign letters. But the table can easily be
edited. (See next sections about building and editing UEP.table.)
SPACE (ASCII 32): Note that the entry value for the SPACE (ASCII 32) in
UEP.table is 24. This means that the table assumes that a space is as wide
as the widest characters such as the letter "M".
When Uedit's printed manual was done, a table value of only 12 was used for
the SPACE. This allowed line-wrapping to include more words per line of
text, because the spacing between words was assumed to be smaller. In the
resulting printed manual the spaces looked about right, because, since F
stretches the spacing between words as needed to right-justify lines of text,
the actual spacing usually ends up larger than the table value of 12 would
indicate.
Both UEP and the F filter program look up the table entry for the SPACE
(ASCII 32) character in order to know how wide a space is. Both programs
then use this space width value in figuring out the length of lines of text.
UEP uses it in order to decide when to wrap lines. F uses it to compute how
much stretching of the space between words is needed in order to right
justify each line.
"Dots": For the purposes of this doc and UEP and the F filter program, the
widest characters in your proportional font (such as "M" and "W") are taken
to be 24 dots wide. It just works out that if you use 24 for the widest
characters in the font then all narrower characters turn out to be a smaller
INTEGRAL number of dots. That is, no character is 8.3 dots but some are 8 or
10 or 12 or 16 dots.
Building UEP.table From Scratch
You can build a valid UEP.table for your printer's proportional font using
the following method:
Compile this command and run it, with your printer set to use its
proportional font:
<normal-esc: .. print a row of each ASCII character in range 32-255
do (n54,32,255) {
freeBuf(buf54)
do (n53,1,72) insertChar(buf54,n54) .. will print 72 of that character
insertChar(buf54," ")
toWord(buf54,n54) .. print the ascii value
insertChar(buf54,13) .. and a carriage return
insertChar(buf54,10) .. and a linefeed
print(buf54,all)
putMsg(buf54)
}
.. done: now print a formfeed
freeBuf(buf54)
insertChar(buf54,12) .. a formfeed
print(buf54,all)
>
The above command prints a row of 72 of each character in the range ASCII 32-
255. (The control characters (ASCII 0-31) can be ignored because they don't
print out as "black" characters.)
The widest characters must be given a value of 24 in UEP.table. For the
narrow characters such as "i" and "l" and ".", count how many of them fit
into the same length as 24 of the widest characters such as "M" and "W".
Using this information you can easily compute the correct table values.
For example, if 72 of character "|" (ASCII 124) fit into the same length as
24 of the widest (such as "M"), then "|" must have a table value of 8, which
is 1/3 of 24.
Now that you've established what values to use in UEP.table, follow the
instructions in the next section.
Editing UEP.table
You can edit UEP.table in Uedit quite easily. Two commands are provided at
the end of this section to assist you. Here is how to do it:
Compile the two commands at the end of this section.
Now load the UEP.table file into Uedit. (Be sure Map Illegals is turned ON
before you load it in.) UEP.table is a binary file, full of control
characters which are displayed mainly as box characters with an occasional
linefeed (ASCII 10) or formfeed (ASCII 12).
Press ESC while looking at UEP.table in Uedit. This builds a number table
from it that you can read and edit.
Edit the number table as needed, noting the following: 1) All table numbers
must be in the range 1 to 24. 2) Don't add or delete any numbers, just
change existing ones; there must be 256 table numbers when you are done.
When done editing, if the old UEP.table file is still in Uedit, it would be a
good idea to close out that buffer. Now press SHIFT-ESC while looking at the
number table and a fresh UEP.table will be built in a new file buffer.
(Again make sure Map Illegals is turned ON before you do this.)
Save the new UEP.table if no errors were reported.
Here are two commands to assist you in editing UEP.table:
Read UEP.table in curFile & build a number table you can edit.
<normal-esc:
moveCursor(curFile,sFile)
equateNum(n54,curFile)
if (!newFile) return
equateNum(n51,0)
insertChar(curFile," ")
label(1)
if (gtNum(100,n51)) insertChar(curFile," ")
toWord(curFile,n51)
insertRgn(curFile,atCursor,": ",all)
do (n53,0,9) {
if (!copyChar(buf[n54],n52)) goto label(0) .. end of table
if (geNum(n52,128)) sub(n52,n52,128)
if (geNum(n52,25) | eqNum(n52,0)) putMsg("Invalid number! Must be 1 to 24.")
moveCursor(buf[n54],eChar)
if (gtNum(10,n52)) insertChar(curFile," ")
toWord(curFile,n52)
insertChar(curFile," ")
}
insertChar(curFile,eLine)
updateDisplay
add(n51,n51,10)
if (gtNum(260,n51)) goto label(1) .. next row
label(0) .. finished
insertChar(curFile,eLine)
moveCursor(curFile,sFile)
updateDisplay
alertUser("Table is ready to edit. When done, use SHIFT-ESC to rebuild UEP.table")
>
Read number table in curFile & build a new UEP.table in a file buffer.
<shft-esc:
equateNum(n54,curFile) .. store buf# of number array
if (!newFile) return .. open new file buf for UEP.table
setFileName(curFile,"UEP.table")
moveCursor(buf[n54],sFile)
label(0)
moveCursor(buf[n54],eWord) .. goto end of next word-num
if (is(buf[n54],eFile)) goto label(1)
if (is(buf[n54],":")) moveCursor(buf[n54],eWord)
moveCursor(buf[n54],sWord) .. goto start of this word-num
toNumber(n52,buf[n54]) .. cvt word-num to integer
if (gtNum(n52,24) | eqNum(n52,0)) {
putMsg(n52)
alertUser("Table value out of range! (See msg line.) Must be 1 to 24.")
returnFalse
}
moveCursor(buf[n54],eWord) .. jump over this word-num
insertChar(curFile,n52) .. insert integer into UEP.table
if (eqNum(n52,10) | eqNum(n52,12)) updateDisplay
goto label(0)
label(1) .. finished
moveCursor(curFile,sFile)
updateDisplay
fileSize(curFile,n50)
if (!eqNum(n50,256)) {
putMsg(n50)
alertUser("Table is wrong size")
returnFalse
} else putMsg("New UEP.table is ready. Save it to disk.")
>
UEP
UEP is identical to UEX, the spell-checking Uedit, except for one difference:
UEX wraps lines based on the character count (lineLength) that you are using.
But UEP wraps lines based on the dot-length of the line, which is found using
the lineLength and the entries in the proportionality table UEP.table.
To do this, it works as follows: It computes the maximum line dot-length by
multiplying lineLength by 24. It then computes each line's dot-length, as
you type the text, by adding up the values for the typed characters in
UEP.table. When the line's dot-length equals or exceeds the maximum line
dot-length, UEP wraps the line at the last word-break.
UEP looks for the UEP.table file first in your current directory and then, if
not there, in the S: directory. (If it cannot find UEP.table or if the table
is not 256 bytes in length, UEP gives the message
"UEP.table not found or corrupt. Aborting."
and aborts.)
Font: Do NOT use a proportional font in UEP. Use a non-proportional font
such as Topaz 8 or Topaz 11; otherwise mouse cursor-positioning would be
screwy; mouse cursor-positioning assumes all characters are of the same width
- i.e., it assumes that you are using a non-proportional font.
Note that when text is typed into UEP which has many wide letters such as "M"
and "W", the wrapped lines contain fewer characters because the average
character is wide. But if the text has lots of skinny letters such as "i"
and "l", the wrapped lines contain more characters because the average
character is narrow.
In UEP wrapped or reformatted lines appear to be of very irregular length,
because you are using a non-proportional font and all characters are
displayed with the same width.
But when you print the text on your printer with a proportional font, the
line lengths are almost (but probably not perfectly) equal. However, if you
process the text using the F filter program, which right-justifies each line
by stretching the spacing between words, the resulting printed line lengths
are perfectly equal.
Notice that, as the line dot-length = lineLength X 24, and as the average
character is typically narrower than the maximum of 24 dots, lines will
contain on average more than lineLength characters.
For instance, if you want there to be around 80 characters per line, you
should specify a lineLength of about 60 or so. UEP will then wrap lines when
they reach 60 X 24 dots in length, which will contain around 80 or so
characters per line, depending on the average width of the characters.
Tabs: It may be a good idea to turn OFF "Use Tabs" in the menu, because tabs
present a problem. (When Use Tabs is OFF, UEP types in spaces instead of a
tab character when you press the TAB key.) The F filter program doesn't know
how to process tab characters correctly - that is, using the same identical
tab columns as were in use in UEP when you created the document - and besides
what is the meaning of a tab column when you are using a proportional font?
And if tabs are sent to the printer you will be relying on what your printer
believes the tab columns to be. So it is better to turn off Use Tabs so that
spaces are used instead of true tabs.
To summarize, internally and in terms of behavior, UEP is identical to UEX,
the spell-checking Uedit, except in how it calculates when to wrap lines
during typing and reformatting.
Printer Control Codes (ESC-Sequences)
If printer control codes (ESC-sequences) are to be embedded in your text when
using UEP, observe the following:
1) Don't type in the control sequences until AFTER you have typed in or
reformatted the text in UEP. Otherwise wordwrapping and reformatting will
erroneously include the control sequences in the calculation of the line's
length. (Note that you could invent more special characters and let them
represent printer control codes which F would recognize and use. You could
put them on their own separate line and F would know what to do with them.)
2) All printer control sequences must begin with ESC (ASCII 27) or ASCII 28,
if F is to be used, and must end with a trailing ESC, which F will remove and
throw away. F needs to see the trailing ESC to know where the sequence ends
so it can figure line length correctly.
Special Characters
The following special characters are recognized by the F filter program and
acted upon. Note that UEP does not recognize these as special and if you use
them you must expect UEP not to give them any special treatment:
"@" (ASCII 64): Put "@" followed by a normal space character " " (ASCII 32)
at the beginning of any line that you want F to shift all the way to the
right. (See the example of a righthand page footer.)
" " (ASCII 32): Use " " (ASCII 32) for the space character whenever F is to
be allowed to stretch the space as needed in order to right-justify the
line.
"" (ASCII 127): Use "" (ASCII 127) for the space character whenever F is
supposed to use a normal, fixed length space - i.e., F is NOT to stretch
the space in right-justifying the line.
"`" (ASCII 96): Put a "`" (ASCII 96) at the end of any line that you don't
want F to stretch and right-justify. Note that if the line has no " "
(ASCII 32) space characters in it which F can stretch out, it won't
right-justify the line in any case.
ESC (ASCII 27) and ASCII 28: All printer control sequences must begin with
ESC or with ASCII 28, and they must end with ESC. F throws out the
trailing ESC and sends the sequence verbatim to the output file or
printer.
Right Justification: F will NOT right-justify a line if 1) it has NO " "
(ASCII 32) spaces in it, or 2) the line ends with a "`" (ASCII 96).
F WILL right-justify a line if 1) there is at least ONE " " (ASCII 32) space
in the line, and 2) the line does NOT end with a "`" (ASCII 96).
NOTE: See UEP-CMDS, which has some commands that you might find useful in
preparing documents with UEP and the F program.
Fixed & Adjustable Word Spacings
As stated elsewhere, there are two kinds of "spaces" to consider when using
UEP, if you are going to use the F filter program later on to process the
text for the printer.
If text lines are to be stretched out to achieve perfect right-justification
by the F program, this is accomplished by stretching the spacings between
words. In this case, you must use " " (ASCII 32) as the space character when
typing in the document. F knows it is supposed to stretch " " spaces as
needed for right-justification, unless the line ends with a "`" (ASCII 96).
If a spacing is NOT to be stretched by the F program, use the "" (ASCII 127)
character instead of the ASCII 32 space character. (Normally it is easier to
go ahead and type the text using the spacebar and then to convert the spaces
to ASCII 127 with a command provided in the UEP-CMDS file. Also note that if
the line ends with "`" (ASCII 96), F won't right-justify the line.)
There is another matter concerning spaces: In UEP.table the value stored for
the ASCII 32 spaces is 24, which is as wide as the widest characters. Since
F may have to stretch the spacing between words to right-justify the lines, a
24-dot space could get stretched and might appear too large. So you may want
to use 12 as the dot-width for the ASCII 32 space in UEP.table instead of 24;
then when the spacings get stretched a bit to right-justify the lines, the
spacings will look about right.
Finally, the last line in paragraphs should end with a "`" (ASCII 96). This
tells F not to stretch out and right-justify the last line.
Columnar (Tabular or Vertically Aligned) Text
Whenever you want text to line up in vertical columns (which is typically a
table or columnar region), do the following:
1) just before the columnar region embed a printer control sequence to switch
your printer to 10 cpi or 12 cpi (a non-proportional font), and
2) use the "" (ASCII 127) space character in the columnar region, not the
" " (ASCII 32) space, so that F will not try to stretch and right-justify the
lines. As an added precaution or alternative, you can end each line with "`"
(ASCII 96), which again tells F not to adjust the spacings between words.
Normally it is easier to go ahead and type in the text using the spacebar and
then to go back and use a Uedit command (see the UEP-CMDS file) to convert
the spaces to ASCII 127.
At the end of the columnar region, embed a printer control code to turn back
on your printer's proportional font and once again start using " " (ASCII 32)
as the space character.
Page Footers
This discussion assumes that you will be using the F filter program to
process your document.
As noted elsewhere, the normal space character (ASCII 32) is used when you
want the F filter program to stretch the spaces between words in order to
right-justify the lines of text. And the special character "" (ASCII 127)
is used instead of ASCII 32, when the space is to be of fixed, normal length.
Here is how a righthand page footer is handled - it uses a new special
character "@" which tells F that the text that follows is be slid to the
right:
@ SectionTitle999
1. @ must be at beginning of the line
2. it is followed by a space (ASCII 32) which will be stretched.
3. there are no other ASCII 32 spaces in the line, ASCII 127 is used
for any spaces thereafter.
Here is how the resulting footer looks when printed:
Section Title 999
Here is how a lefthand page footer is handled:
999SectionTitle`
Notice that only ASCII 127 (fixed length) space characters are used, because
the footer is left justified. And the printed result looks like this:
999 Section Title
The F Filter Program
The F filter program does the following:
1) Must be given the arguments: infile outfile lineLength
2) Reads in UEP.table. UEP.table must be in the current directory or in the
S: directory.
3) Uses the lineLength argument to compute the line dot-length to use when
right-justifying lines. dot-length = (lineLength + 1)*24. lineLength must
be the same as the value you used in UEP when creating the document.
4) Reads in infile, processes it, and outputs the results to outfile.
The outfile may be a file which you will print later on or it may be PAR:,
the parallel port. DO NOT USE PRT:, the Amiga's printer device, because F
does not recognize the Amiga's generic printer control codes and the Amiga
printer device does not recognize your printer's own control sequences.
Processing the document in F consists of the following steps:
1) spotting printer control sequences embedded in the text and sending them
verbatim to outfile except for the trailing ESC which is discarded.
2) on lines that are to be right-justified (they don't end with "`" (ASCII
96) and they have got at least one " " (ASCII 32) space in them), computing
the amount to stretch each space in order to right-justify the line, and
sending the necessary spaces or printer control commands to outfile to create
the desired spacings.
3) recognizing the "" (ASCII 127) character and inserting one normal length
space in place of it.
4) recognizing the "`" (ASCII 96) character at the end of lines which F is
not supposed to right-justify.
5) recognizing the "@" symbol followed by a " " space at the beginning of
text which is to be slid rightward. (These are typically chapter headings
which are up against the right border in tall bold print.)
UEP.table
The UEP.table file must be stored in your current working directory or in the
S: directory. UEP and the F filter program must find UEP.tablein one of
those two places.
UEP.table is 256 bytes big. It has a table entry for each of the ASCII
characters 0-255.
The table values must be in the range 1-24. See the sections above about
editing UEP.table, building it from scratch, and putting in values for
foreign alphabets.
UCHAR pixeltable[256] = {
24,24,24,24,24,24,24,24,24,24, /* 0 */
24,24,24,24,24,24,24,24,24,24, /* 10 */
24,24,24,24,24,24,24,24,24,24, /* 20 */
24,24,24,10,16,24,24,24,24,12, /* 30 */
12,12,24,24,12,24,12,20,24,16, /* 40 */
24,24,24,24,24,24,24,24,12,12, /* 50 */
20,24,20,20,24,24,24,24,24,24, /* 60 */
24,24,24,16,24,24,24,24,24,24, /* 70 */
24,24,24,24,24,24,24,24,20,24, /* 80 */
24,16,20,16,24,24,12,24,22,22, /* 90 */
22,24,24,22,24,16,16,20,16,24, /* 100 */
24,22,22,22,22,24,20,24,24,24, /* 110 */
/* ADJUST the 127-255 entries for FOREIGN letters */
20,24,20,18,8,18,24,24,24,24, /* 120 */
24,24,24,24,24,24,24,24,24,24, /* 130 */
24,24,24,24,24,24,24,24,24,24, /* 140 */
24,24,24,24,24,24,24,24,24,24, /* 150 */
24,24,24,24,24,24,24,24,24,24, /* 160 */
24,24,24,24,24,24,24,24,24,24, /* 170 */
24,24,24,24,24,24,24,24,24,24, /* 180 */
24,24,24,24,24,24,24,24,24,24, /* 190 */
24,24,24,24,24,24,24,24,24,24, /* 200 */
24,24,24,24,24,24,24,24,24,24, /* 210 */
24,24,24,24,24,24,22,24,24,24, /* 220 */
24,24,24,24,24,24,24,24,20,24, /* 230 */
24,24,20,24,24,24,24,22,16,12, /* 240 */
24,24,20,16,16,24 /* 250 */
};