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 >
Text File  |  1992-11-22  |  21KB  |  471 lines

  1.                       UEP.table, Proportionality Table
  2.  
  3. The UEP.table file is a proportionality table used by both UEP and the F
  4. filter program.  It has 256 1-byte entries, one for each ASCII character 0-
  5. 255.  The largest table entry value is 24, which is used for the widest
  6. letters, such as "M" and "W".  Narrower letters and symbols have smaller
  7. table entries; for instance, the letter "i" (ASCII 105) uses a value of 16
  8. and the "|" symbol (ASCII 124) uses a value of only 8.
  9.  
  10. The current UEP.table contents are shown at the end of this doc file.
  11.  
  12. Foreign letters:  The UEP.table provided does not contain valid values in the
  13. upper (ASCII 128-255) range for foreign letters.  But the table can easily be
  14. edited.  (See next sections about building and editing UEP.table.)
  15.  
  16. SPACE (ASCII 32):  Note that the entry value for the SPACE (ASCII 32) in
  17. UEP.table is 24.  This means that the table assumes that a space is as wide
  18. as the widest characters such as the letter "M".
  19.  
  20. When Uedit's printed manual was done, a table value of only 12 was used for
  21. the SPACE.  This allowed line-wrapping to include more words per line of
  22. text, because the spacing between words was assumed to be smaller.  In the
  23. resulting printed manual the spaces looked about right, because, since F
  24. stretches the spacing between words as needed to right-justify lines of text,
  25. the actual spacing usually ends up larger than the table value of 12 would
  26. indicate.
  27.  
  28. Both UEP and the F filter program look up the table entry for the SPACE
  29. (ASCII 32) character in order to know how wide a space is.  Both programs
  30. then use this space width value in figuring out the length of lines of text.
  31. UEP uses it in order to decide when to wrap lines.  F uses it to compute how
  32. much stretching of the space between words is needed in order to right
  33. justify each line.
  34.  
  35. "Dots":  For the purposes of this doc and UEP and the F filter program, the
  36. widest characters in your proportional font (such as "M" and "W") are taken
  37. to be 24 dots wide.  It just works out that if you use 24 for the widest
  38. characters in the font then all narrower characters turn out to be a smaller
  39. INTEGRAL number of dots.  That is, no character is 8.3 dots but some are 8 or
  40. 10 or 12 or 16 dots.
  41.  
  42.  
  43.                        Building UEP.table From Scratch
  44.  
  45. You can build a valid UEP.table for your printer's proportional font using
  46. the following method:
  47.  
  48. Compile this command and run it, with your printer set to use its
  49. proportional font:
  50.  
  51. <normal-esc:        .. print a row of each ASCII character in range 32-255
  52.     do (n54,32,255) {
  53.         freeBuf(buf54)
  54.         do (n53,1,72) insertChar(buf54,n54) .. will print 72 of that character
  55.         insertChar(buf54," ")
  56.         toWord(buf54,n54)    .. print the ascii value
  57.         insertChar(buf54,13) .. and a carriage return
  58.         insertChar(buf54,10) .. and a linefeed
  59.         print(buf54,all)
  60.         putMsg(buf54)
  61.     }
  62.     .. done:  now print a formfeed
  63.     freeBuf(buf54)
  64.     insertChar(buf54,12) .. a formfeed
  65.     print(buf54,all)
  66.     >
  67.  
  68. The above command prints a row of 72 of each character in the range ASCII 32-
  69. 255.  (The control characters (ASCII 0-31) can be ignored because they don't
  70. print out as "black" characters.)
  71.  
  72. The widest characters must be given a value of 24 in UEP.table.  For the
  73. narrow characters such as "i" and "l" and ".", count how many of them fit
  74. into the same length as 24 of the widest characters such as "M" and "W".
  75. Using this information you can easily compute the correct table values.
  76.  
  77. For example, if 72 of character "|" (ASCII 124) fit into the same length as
  78. 24 of the widest (such as "M"), then "|" must have a table value of 8, which
  79. is 1/3 of 24.
  80.  
  81. Now that you've established what values to use in UEP.table, follow the
  82. instructions in the next section.
  83.  
  84.  
  85.                               Editing UEP.table
  86.  
  87. You can edit UEP.table in Uedit quite easily.  Two commands are provided at
  88. the end of this section to assist you.  Here is how to do it:
  89.  
  90. Compile the two commands at the end of this section.
  91.  
  92. Now load the UEP.table file into Uedit.  (Be sure Map Illegals is turned ON
  93. before you load it in.)  UEP.table is a binary file, full of control
  94. characters which are displayed mainly as box characters with an occasional
  95. linefeed (ASCII 10) or formfeed (ASCII 12).
  96.  
  97. Press ESC while looking at UEP.table in Uedit.  This builds a number table
  98. from it that you can read and edit.
  99.  
  100. Edit the number table as needed, noting the following:  1) All table numbers
  101. must be in the range 1 to 24.  2) Don't add or delete any numbers, just
  102. change existing ones; there must be 256 table numbers when you are done.
  103.  
  104. When done editing, if the old UEP.table file is still in Uedit, it would be a
  105. good idea to close out that buffer.  Now press SHIFT-ESC while looking at the
  106. number table and a fresh UEP.table will be built in a new file buffer.
  107. (Again make sure Map Illegals is turned ON before you do this.)
  108.  
  109. Save the new UEP.table if no errors were reported.
  110.  
  111.  
  112. Here are two commands to assist you in editing UEP.table:
  113.  
  114. Read UEP.table in curFile & build a number table you can edit.
  115. <normal-esc:
  116.     moveCursor(curFile,sFile)
  117.     equateNum(n54,curFile)
  118.     if (!newFile) return
  119.     equateNum(n51,0)
  120.     insertChar(curFile," ")
  121. label(1)
  122.     if (gtNum(100,n51)) insertChar(curFile," ")
  123.     toWord(curFile,n51)
  124.     insertRgn(curFile,atCursor,": ",all)
  125.     do (n53,0,9) {
  126.         if (!copyChar(buf[n54],n52)) goto label(0) .. end of table
  127.         if (geNum(n52,128)) sub(n52,n52,128)
  128.         if (geNum(n52,25) | eqNum(n52,0)) putMsg("Invalid number!  Must be 1 to 24.")
  129.         moveCursor(buf[n54],eChar)
  130.         if (gtNum(10,n52)) insertChar(curFile," ")
  131.         toWord(curFile,n52)
  132.         insertChar(curFile," ")
  133.     }
  134.     insertChar(curFile,eLine)
  135.     updateDisplay
  136.     add(n51,n51,10)
  137.     if (gtNum(260,n51)) goto label(1) .. next row
  138. label(0)    .. finished
  139.     insertChar(curFile,eLine)
  140.     moveCursor(curFile,sFile)
  141.     updateDisplay
  142.     alertUser("Table is ready to edit.  When done, use SHIFT-ESC to rebuild UEP.table")
  143.     >
  144.  
  145. Read number table in curFile & build a new UEP.table in a file buffer.
  146. <shft-esc:
  147.     equateNum(n54,curFile)              .. store buf# of number array
  148.     if (!newFile) return                .. open new file buf for UEP.table
  149.     setFileName(curFile,"UEP.table")
  150.     moveCursor(buf[n54],sFile)
  151. label(0)
  152.     moveCursor(buf[n54],eWord)           .. goto end of next word-num
  153.     if (is(buf[n54],eFile)) goto label(1)
  154.     if (is(buf[n54],":")) moveCursor(buf[n54],eWord)
  155.     moveCursor(buf[n54],sWord)           .. goto start of this word-num
  156.     toNumber(n52,buf[n54])               .. cvt word-num to integer
  157.     if (gtNum(n52,24) | eqNum(n52,0)) {
  158.         putMsg(n52)
  159.         alertUser("Table value out of range!  (See msg line.)  Must be 1 to 24.")
  160.         returnFalse
  161.     }
  162.     moveCursor(buf[n54],eWord)           .. jump over this word-num
  163.     insertChar(curFile,n52)              .. insert integer into UEP.table
  164.     if (eqNum(n52,10) | eqNum(n52,12)) updateDisplay
  165.     goto label(0)
  166. label(1)    .. finished
  167.     moveCursor(curFile,sFile)
  168.     updateDisplay
  169.     fileSize(curFile,n50)
  170.     if (!eqNum(n50,256)) {
  171.         putMsg(n50)
  172.         alertUser("Table is wrong size")
  173.         returnFalse
  174.     } else putMsg("New UEP.table is ready.  Save it to disk.")
  175. >
  176.  
  177.  
  178.                                      UEP
  179.  
  180. UEP is identical to UEX, the spell-checking Uedit, except for one difference:
  181. UEX wraps lines based on the character count (lineLength) that you are using.
  182. But UEP wraps lines based on the dot-length of the line, which is found using
  183. the lineLength and the entries in the proportionality table UEP.table.
  184.  
  185. To do this, it works as follows:  It computes the maximum line dot-length by
  186. multiplying lineLength by 24.  It then computes each line's dot-length, as
  187. you type the text, by adding up the values for the typed characters in
  188. UEP.table.  When the line's dot-length equals or exceeds the maximum line
  189. dot-length, UEP wraps the line at the last word-break.
  190.  
  191. UEP looks for the UEP.table file first in your current directory and then, if
  192. not there, in the S: directory.  (If it cannot find UEP.table or if the table
  193. is not 256 bytes in length, UEP gives the message
  194.         "UEP.table not found or corrupt.  Aborting."
  195. and aborts.)
  196.  
  197. Font:  Do NOT use a proportional font in UEP.  Use a non-proportional font
  198. such as Topaz 8 or Topaz 11; otherwise mouse cursor-positioning would be
  199. screwy; mouse cursor-positioning assumes all characters are of the same width
  200. - i.e., it assumes that you are using a non-proportional font.
  201.  
  202. Note that when text is typed into UEP which has many wide letters such as "M"
  203. and "W", the wrapped lines contain fewer characters because the average
  204. character is wide.  But if the text has lots of skinny letters such as "i"
  205. and "l", the wrapped lines contain more characters because the average
  206. character is narrow.
  207.  
  208. In UEP wrapped or reformatted lines appear to be of very irregular length,
  209. because you are using a non-proportional font and all characters are
  210. displayed with the same width.
  211.  
  212. But when you print the text on your printer with a proportional font, the
  213. line lengths are almost (but probably not perfectly) equal.  However, if you
  214. process the text using the F filter program, which right-justifies each line
  215. by stretching the spacing between words, the resulting printed line lengths
  216. are perfectly equal.
  217.  
  218. Notice that, as the line dot-length = lineLength X 24, and as the average
  219. character is typically narrower than the maximum of 24 dots, lines will
  220. contain on average more than lineLength characters.
  221.  
  222. For instance, if you want there to be around 80 characters per line, you
  223. should specify a lineLength of about 60 or so.  UEP will then wrap lines when
  224. they reach 60 X 24 dots in length, which will contain around 80 or so
  225. characters per line, depending on the average width of the characters.
  226.  
  227. Tabs:  It may be a good idea to turn OFF "Use Tabs" in the menu, because tabs
  228. present a problem.  (When Use Tabs is OFF, UEP types in spaces instead of a
  229. tab character when you press the TAB key.)  The F filter program doesn't know
  230. how to process tab characters correctly - that is, using the same identical
  231. tab columns as were in use in UEP when you created the document - and besides
  232. what is the meaning of a tab column when you are using a proportional font?
  233. And if tabs are sent to the printer you will be relying on what your printer
  234. believes the tab columns to be.  So it is better to turn off Use Tabs so that
  235. spaces are used instead of true tabs.
  236.  
  237. To summarize, internally and in terms of behavior, UEP is identical to UEX,
  238. the spell-checking Uedit, except in how it calculates when to wrap lines
  239. during typing and reformatting.
  240.  
  241.  
  242.                     Printer Control Codes (ESC-Sequences)
  243.  
  244. If printer control codes (ESC-sequences) are to be embedded in your text when
  245. using UEP, observe the following:
  246.  
  247. 1)  Don't type in the control sequences until AFTER you have typed in or
  248. reformatted the text in UEP.  Otherwise wordwrapping and reformatting will
  249. erroneously include the control sequences in the calculation of the line's
  250. length.  (Note that you could invent more special characters and let them
  251. represent printer control codes which F would recognize and use.  You could
  252. put them on their own separate line and F would know what to do with them.)
  253.  
  254. 2) All printer control sequences must begin with ESC (ASCII 27) or ASCII 28,
  255. if F is to be used, and must end with a trailing ESC, which F will remove and
  256. throw away.  F needs to see the trailing ESC to know where the sequence ends
  257. so it can figure line length correctly.
  258.  
  259.  
  260.                              Special Characters
  261.  
  262. The following special characters are recognized by the F filter program and
  263. acted upon.  Note that UEP does not recognize these as special and if you use
  264. them you must expect UEP not to give them any special treatment:
  265.  
  266. "@" (ASCII 64):  Put "@" followed by a normal space character " " (ASCII 32)
  267.     at the beginning of any line that you want F to shift all the way to the
  268.     right.  (See the example of a righthand page footer.)
  269.  
  270. " " (ASCII 32):  Use " " (ASCII 32) for the space character whenever F is to
  271.     be allowed to stretch the space as needed in order to right-justify the
  272.     line.
  273.  
  274. "" (ASCII 127):  Use "" (ASCII 127) for the space character whenever F is
  275.     supposed to use a normal, fixed length space - i.e., F is NOT to stretch
  276.     the space in right-justifying the line.
  277.  
  278. "`" (ASCII 96):  Put a "`" (ASCII 96) at the end of any line that you don't
  279.     want F to stretch and right-justify.  Note that if the line has no " "
  280.     (ASCII 32) space characters in it which F can stretch out, it won't
  281.     right-justify the line in any case.
  282.  
  283. ESC (ASCII 27) and ASCII 28:  All printer control sequences must begin with
  284.     ESC or with ASCII 28, and they must end with ESC.  F throws out the
  285.     trailing ESC and sends the sequence verbatim to the output file or
  286.     printer.
  287.  
  288.  
  289. Right Justification:  F will NOT right-justify a line if 1) it has NO " "
  290. (ASCII 32) spaces in it, or 2) the line ends with a "`" (ASCII 96).
  291.  
  292. F WILL right-justify a line if 1) there is at least ONE " " (ASCII 32) space
  293. in the line, and 2) the line does NOT end with a "`" (ASCII 96).
  294.  
  295.  
  296. NOTE:  See UEP-CMDS, which has some commands that you might find useful in
  297. preparing documents with UEP and the F program.
  298.  
  299.  
  300.                       Fixed & Adjustable Word Spacings
  301.  
  302. As stated elsewhere, there are two kinds of "spaces" to consider when using
  303. UEP, if you are going to use the F filter program later on to process the
  304. text for the printer.
  305.  
  306. If text lines are to be stretched out to achieve perfect right-justification
  307. by the F program, this is accomplished by stretching the spacings between
  308. words.  In this case, you must use " " (ASCII 32) as the space character when
  309. typing in the document.  F knows it is supposed to stretch " " spaces as
  310. needed for right-justification, unless the line ends with a "`" (ASCII 96).
  311.  
  312. If a spacing is NOT to be stretched by the F program, use the "" (ASCII 127)
  313. character instead of the ASCII 32 space character.  (Normally it is easier to
  314. go ahead and type the text using the spacebar and then to convert the spaces
  315. to ASCII 127 with a command provided in the UEP-CMDS file.  Also note that if
  316. the line ends with "`" (ASCII 96), F won't right-justify the line.)
  317.  
  318. There is another matter concerning spaces:  In UEP.table the value stored for
  319. the ASCII 32 spaces is 24, which is as wide as the widest characters.  Since
  320. F may have to stretch the spacing between words to right-justify the lines, a
  321. 24-dot space could get stretched and might appear too large.  So you may want
  322. to use 12 as the dot-width for the ASCII 32 space in UEP.table instead of 24;
  323. then when the spacings get stretched a bit to right-justify the lines, the
  324. spacings will look about right.
  325.  
  326. Finally, the last line in paragraphs should end with a "`" (ASCII 96).  This
  327. tells F not to stretch out and right-justify the last line.
  328.  
  329.  
  330.                 Columnar (Tabular or Vertically Aligned) Text
  331.  
  332. Whenever you want text to line up in vertical columns (which is typically a
  333. table or columnar region), do the following:
  334.  
  335. 1) just before the columnar region embed a printer control sequence to switch
  336. your printer to 10 cpi or 12 cpi (a non-proportional font), and
  337.  
  338. 2) use the "" (ASCII 127) space character in the columnar region, not the
  339. " " (ASCII 32) space, so that F will not try to stretch and right-justify the
  340. lines.  As an added precaution or alternative, you can end each line with "`"
  341. (ASCII 96), which again tells F not to adjust the spacings between words.
  342.  
  343. Normally it is easier to go ahead and type in the text using the spacebar and
  344. then to go back and use a Uedit command (see the UEP-CMDS file) to convert
  345. the spaces to ASCII 127.
  346.  
  347. At the end of the columnar region, embed a printer control code to turn back
  348. on your printer's proportional font and once again start using " " (ASCII 32)
  349. as the space character.
  350.  
  351.  
  352.                                 Page Footers
  353.  
  354. This discussion assumes that you will be using the F filter program to
  355. process your document.
  356.  
  357. As noted elsewhere, the normal space character (ASCII 32) is used when you
  358. want the F filter program to stretch the spaces between words in order to
  359. right-justify the lines of text.  And the special character "" (ASCII 127)
  360. is used instead of ASCII 32, when the space is to be of fixed, normal length.
  361.  
  362. Here is how a righthand page footer is handled - it uses a new special
  363. character "@" which tells F that the text that follows is be slid to the
  364. right:
  365.  
  366. @ SectionTitle999
  367.  
  368.         1. @ must be at beginning of the line
  369.         2. it is followed by a space (ASCII 32) which will be stretched.
  370.         3. there are no other ASCII 32 spaces in the line, ASCII 127 is used
  371.            for any spaces thereafter.
  372.  
  373. Here is how the resulting footer looks when printed:
  374.                                                         Section Title     999
  375.  
  376. Here is how a lefthand page footer is handled:
  377.  
  378. 999SectionTitle`
  379.  
  380. Notice that only ASCII 127 (fixed length) space characters are used, because
  381. the footer is left justified.  And the printed result looks like this:
  382.  
  383. 999     Section Title
  384.  
  385.  
  386.                             The F Filter Program
  387.  
  388. The F filter program does the following:
  389.  
  390. 1) Must be given the arguments:  infile outfile lineLength
  391.  
  392. 2) Reads in UEP.table.  UEP.table must be in the current directory or in the
  393. S: directory.
  394.  
  395. 3) Uses the lineLength argument to compute the line dot-length to use when
  396. right-justifying lines.  dot-length = (lineLength + 1)*24.  lineLength must
  397. be the same as the value you used in UEP when creating the document.
  398.  
  399. 4) Reads in infile, processes it, and outputs the results to outfile.
  400.  
  401. The outfile may be a file which you will print later on or it may be PAR:,
  402. the parallel port.  DO NOT USE PRT:, the Amiga's printer device, because F
  403. does not recognize the Amiga's generic printer control codes and the Amiga
  404. printer device does not recognize your printer's own control sequences.
  405.  
  406.  
  407. Processing the document in F consists of the following steps:
  408.  
  409. 1) spotting printer control sequences embedded in the text and sending them
  410. verbatim to outfile except for the trailing ESC which is discarded.
  411.  
  412. 2) on lines that are to be right-justified (they don't end with "`" (ASCII
  413. 96) and they have got at least one " " (ASCII 32) space in them), computing
  414. the amount to stretch each space in order to right-justify the line, and
  415. sending the necessary spaces or printer control commands to outfile to create
  416. the desired spacings.
  417.  
  418. 3) recognizing the "" (ASCII 127) character and inserting one normal length
  419. space in place of it.
  420.  
  421. 4) recognizing the "`" (ASCII 96) character at the end of lines which F is
  422. not supposed to right-justify.
  423.  
  424. 5) recognizing the "@" symbol followed by a " " space at the beginning of
  425. text which is to be slid rightward.  (These are typically chapter headings
  426. which are up against the right border in tall bold print.)
  427.  
  428.  
  429.                                   UEP.table
  430.  
  431. The UEP.table file must be stored in your current working directory or in the
  432. S: directory.  UEP and the F filter program must find UEP.tablein one of
  433. those two places.
  434.  
  435. UEP.table is 256 bytes big.  It has a table entry for each of the ASCII
  436. characters 0-255.  
  437.  
  438. The table values must be in the range 1-24.  See the sections above about
  439. editing UEP.table, building it from scratch, and putting in values for
  440. foreign alphabets.
  441.  
  442. UCHAR pixeltable[256] = {
  443. 24,24,24,24,24,24,24,24,24,24, /* 0 */
  444. 24,24,24,24,24,24,24,24,24,24, /* 10 */
  445. 24,24,24,24,24,24,24,24,24,24, /* 20 */
  446. 24,24,24,10,16,24,24,24,24,12, /* 30 */
  447. 12,12,24,24,12,24,12,20,24,16, /* 40 */
  448. 24,24,24,24,24,24,24,24,12,12, /* 50 */
  449. 20,24,20,20,24,24,24,24,24,24, /* 60 */
  450. 24,24,24,16,24,24,24,24,24,24, /* 70 */
  451. 24,24,24,24,24,24,24,24,20,24, /* 80 */
  452. 24,16,20,16,24,24,12,24,22,22, /* 90 */
  453. 22,24,24,22,24,16,16,20,16,24, /* 100 */
  454. 24,22,22,22,22,24,20,24,24,24, /* 110 */
  455.                      /* ADJUST the 127-255 entries for FOREIGN letters */
  456. 20,24,20,18,8,18,24,24,24,24,  /* 120 */
  457. 24,24,24,24,24,24,24,24,24,24, /* 130 */
  458. 24,24,24,24,24,24,24,24,24,24, /* 140 */
  459. 24,24,24,24,24,24,24,24,24,24, /* 150 */
  460. 24,24,24,24,24,24,24,24,24,24, /* 160 */
  461. 24,24,24,24,24,24,24,24,24,24, /* 170 */
  462. 24,24,24,24,24,24,24,24,24,24, /* 180 */
  463. 24,24,24,24,24,24,24,24,24,24, /* 190 */
  464. 24,24,24,24,24,24,24,24,24,24, /* 200 */
  465. 24,24,24,24,24,24,24,24,24,24, /* 210 */
  466. 24,24,24,24,24,24,22,24,24,24, /* 220 */
  467. 24,24,24,24,24,24,24,24,20,24, /* 230 */
  468. 24,24,20,24,24,24,24,22,16,12, /* 240 */
  469. 24,24,20,16,16,24               /* 250 */
  470. };
  471.