home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / driver / WDRKIT.TXT < prev    next >
Text File  |  1992-04-21  |  15KB  |  295 lines

  1. NOTES ON PRODUCING .WDR FILES FROM .WD SOURCE FILES
  2. ===================================================
  3.  
  4.     Read as much or as little of this document as you wish.
  5.     The .wdr system is very powerful and therefore takes some time to learn
  6. in all its details.  But individual users may be able to achieve their
  7. desired effects without understanding more than a fraction of what follows. 
  8. Try it and see.
  9.  
  10. A gentle introduction to WDTRAN
  11. -------------------------------
  12.     The accompanying file General.wd is essentially the source for the
  13. built-in "General" printer driver.
  14.     Make a copy of this, as Learn.wd.
  15.     Edit the NAME line in the "TYPEFACE courier" section, changing "Mono"
  16. to "FontName".
  17.     Edit the NAME line in the "MODEL" section, changing "General" to
  18. "ModelName".
  19.     Then type "WDTRAN learn".  This should produce a file Learn.wdr.
  20.     Copy this file into a \wdr\ top-level directory on LOC:: on your
  21. Series3.
  22.     You'll find that "ModelName" appears in the "Select printer" choice
  23. list inside any Print Setup dialog you invoke.  And if you select this
  24. model, you'll find that "FontName" is the single allowed entry in any
  25. "Font" choice list (except of course for "Inherited" in some WP dialogs).
  26.     You have just created your own .wdr file.  Its functionality is
  27. identical to that of the built-in "General" printer model.
  28.     NB 1) The maximum allowed length for a font name is 20 characters.
  29.        2) The maximum allowed length for a model name is 24 characters.
  30.     Exceed these limits and you'll get a compilation error.
  31.  
  32. Easier compiling
  33. ----------------
  34.     If you are using Brief, set the environment variable BCWD as follows
  35.         set bcwd=!"wdtran.exe %s"
  36. so that you can compile using Alt-F10 and have Brief position you
  37. automatically to any syntax error.
  38.  
  39. Comments
  40. --------
  41.     When WDTRAN encounters an "!" on a line (except within a quoted
  42. string), it disregards this and everything else on the line as a comment.
  43.     Blank lines are also ignored.
  44.     The block indentation scheme in .wd files is for convenience only.
  45.  
  46. Font heights
  47. ------------
  48.     In the above example, the height of the font was displayed in the
  49. dialogs as "12", meaning 12 points, where one point is 1/72 of an inch.
  50.     In .wd files, font height is specified in so-called "twips", which are
  51. TWentIeths of Points, so that 1 inch = 1440 twips.
  52.     The height you give for a font should of course match the height of the
  53. font as it is printed.
  54.  
  55. Font widths
  56. -----------
  57.     Fonts come in two sorts - monospaced (in which all characters have 
  58. the same width), and proportional.  See below for more on proportional
  59. fonts.  In the above example, the font is monospaced, with a constant width
  60. per character of "1".  The units here are as specified by the "MIN_X"
  61. field of the "MODEL" definition.
  62.     "MIN_X" is the minimum movement the printer head can make in the
  63. x-direction.  In the above case, this is presumed to be 1/10 inch (144
  64. twips), ie the width of a standard character in a 10 cpi ("Characters
  65. Per Inch") font.
  66.  
  67. Font command sequences
  68. ----------------------
  69.     The above printer model only has one font.
  70.     In contrast, there are a large variety of fonts in the accompanying
  71. file Epson.wd.
  72.     For example, under "TYPEFACE pica_rx", there are two different fonts,
  73. one that is 12 point and 10 cpi, and one that is 16 point and 5 cpi.  Each
  74. of these has its own "COMMAND" sequence, which is what the software sends
  75. to the printer whenever it needs to select this font.
  76.     Inside command strings, numbers in angled brackets evidently translate
  77. into binary values.  Ie "<27>w" is the Escape character (ascii value 27)
  78. followed by a lower-case "w".
  79.  
  80. Fonts and typefaces
  81. -------------------
  82.     Many different fonts differ from each other only in that they are
  83. essentially different sized versions of each other.  Such fonts can be
  84. grouped together into "typefaces".  Thus the two Epson fonts just mentioned
  85. are both in the "TYPEFACE pica_rx" section, whereas there are other
  86. fonts in eg the "TYPEFACE elite" and "TYPEFACE times" sections.
  87.     The user sees all the different fonts in any one typeface as being
  88. different "Heights" of the same "Font".  The common name of these fonts is
  89. given by the "NAME" field in the "TYPEFACE" section. Thus in the above
  90. example, the user would see a "Size 12" and a "Size 16" font, under the
  91. title "Pica".
  92.    The other restriction for placing fonts together in a typeface is that
  93. they must have the same set of "TRANSLATE"s and the same "TYPE" (see
  94. below for more details of these).
  95.  
  96. Translates
  97. ----------
  98.     The set of translates (if any) used by a font is as specified by the
  99. "TRANSLATE" field in the enclosing "TYPEFACE" definition.
  100.     The value of "TRANSLATE" must be a lower-case name which exactly
  101. matches the lower-case name of a "TRANSLATES" block within the same .wd
  102. file.
  103.     There can be more than one "TRANSLATES" block in any one .wd file.
  104.     Each "TRANSLATES" block in turn consists of one or more translations,
  105. such as
  106.         5:35
  107. to turn any characters with ascii value 5 into characters with ascii value
  108. 35 (note that the Series3 font gives the telephone symbol as used in the
  109. Database the value of 5, so that you had better translate this to something
  110. your printer is more likely to be able to handle), or
  111.         156:"<27>R<3><35><27>R<0>"
  112. to intercept any † symbols (ascii value 156) in output sent to the printer
  113. and replace them with the specified escape sequence.
  114.     Another type of use might be to convert the character "O with a slash
  115. through it" (Series3 ascii value 157) into the sequence 'O' followed by
  116. backspace followed by '/'.
  117.  
  118. Other commands
  119. --------------
  120.     As well as the command strings to select various fonts, a .wd file
  121. contains commands to have the printer perform other functions.  These are
  122. defined in the "COMMANDS" block at the start of the .wd file.
  123.     These commands are by and large clearly named, eg "ITALIC_ON" and
  124. "ITALIC_OFF", "BOLD_ON" and "BOLD_OFF", and "SUPERSCRIPT_ON" and
  125. "SUPERSCRIPT_OFF".
  126.     If a printer cannot support a given feature, you can leave the
  127. corresponding command string null ("").  One possible exception is
  128. italic which, if not supported, could be implemented as an underline.
  129.     Note incidentally that it is possible for a printer which supports
  130. italic in one font not to support it in another font, and so on.  Again, a
  131. printer may support both italic and superscript, but not both at the same
  132. time.
  133.     You may find it particularly fruitful to experiment with these command
  134. strings - especially if your printer is one than is somehow an "enhanced"
  135. model of one that is "officially" supported by Psion.
  136.  
  137. The preamble commands
  138. ---------------------
  139.     The string of commands sent to the printer when printing starts are
  140. among the most important, as regards influencing the printed outcome.
  141.     The very first command the software sends the printer is the "RESET"
  142. command.  Then it sends a "FORM_LENGTH" command, and then the "PREAMBLE"
  143. command, before starting to print the document proper (together with
  144. headers and footers, etc).  At the very end, a "POSTAMBLE" command is sent.
  145.     The "POSTAMBLE" command may be needed to flush the printer buffer, and
  146. to restore the printer to its default settings.
  147.     The "PREAMBLE" command may have such drastic consequences as choosing
  148. the basic configuration of the printer (possibly overriding defaults set
  149. via dip switches).  "Consult your printer documentation for full details."
  150.     The units for the "FORM_LENGTH" command are ALWAYS 1/6 of an inch.
  151.  
  152. Special characters in command strings
  153. -------------------------------------
  154.     The commands "MOVE_RIGHT", "MOVE_DOWN", and "FORM_LENGTH" are each used
  155. in conjunction with a value passed by the printer subsystem software.  For
  156. example, the commands are to set the form length TO A GIVEN VALUE, or to
  157. move the printer position right BY A GIVEN AMOUNT.  This value may either
  158. end up in the command string by a process of substitution, or it may result
  159. in the command being repeated as required:
  160.