home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
developmen
/
driver
/
WDRKIT.TXT
< prev
next >
Wrap
Text File
|
1992-04-21
|
15KB
|
295 lines
NOTES ON PRODUCING .WDR FILES FROM .WD SOURCE FILES
===================================================
Read as much or as little of this document as you wish.
The .wdr system is very powerful and therefore takes some time to learn
in all its details. But individual users may be able to achieve their
desired effects without understanding more than a fraction of what follows.
Try it and see.
A gentle introduction to WDTRAN
-------------------------------
The accompanying file General.wd is essentially the source for the
built-in "General" printer driver.
Make a copy of this, as Learn.wd.
Edit the NAME line in the "TYPEFACE courier" section, changing "Mono"
to "FontName".
Edit the NAME line in the "MODEL" section, changing "General" to
"ModelName".
Then type "WDTRAN learn". This should produce a file Learn.wdr.
Copy this file into a \wdr\ top-level directory on LOC:: on your
Series3.
You'll find that "ModelName" appears in the "Select printer" choice
list inside any Print Setup dialog you invoke. And if you select this
model, you'll find that "FontName" is the single allowed entry in any
"Font" choice list (except of course for "Inherited" in some WP dialogs).
You have just created your own .wdr file. Its functionality is
identical to that of the built-in "General" printer model.
NB 1) The maximum allowed length for a font name is 20 characters.
2) The maximum allowed length for a model name is 24 characters.
Exceed these limits and you'll get a compilation error.
Easier compiling
----------------
If you are using Brief, set the environment variable BCWD as follows
set bcwd=!"wdtran.exe %s"
so that you can compile using Alt-F10 and have Brief position you
automatically to any syntax error.
Comments
--------
When WDTRAN encounters an "!" on a line (except within a quoted
string), it disregards this and everything else on the line as a comment.
Blank lines are also ignored.
The block indentation scheme in .wd files is for convenience only.
Font heights
------------
In the above example, the height of the font was displayed in the
dialogs as "12", meaning 12 points, where one point is 1/72 of an inch.
In .wd files, font height is specified in so-called "twips", which are
TWentIeths of Points, so that 1 inch = 1440 twips.
The height you give for a font should of course match the height of the
font as it is printed.
Font widths
-----------
Fonts come in two sorts - monospaced (in which all characters have
the same width), and proportional. See below for more on proportional
fonts. In the above example, the font is monospaced, with a constant width
per character of "1". The units here are as specified by the "MIN_X"
field of the "MODEL" definition.
"MIN_X" is the minimum movement the printer head can make in the
x-direction. In the above case, this is presumed to be 1/10 inch (144
twips), ie the width of a standard character in a 10 cpi ("Characters
Per Inch") font.
Font command sequences
----------------------
The above printer model only has one font.
In contrast, there are a large variety of fonts in the accompanying
file Epson.wd.
For example, under "TYPEFACE pica_rx", there are two different fonts,
one that is 12 point and 10 cpi, and one that is 16 point and 5 cpi. Each
of these has its own "COMMAND" sequence, which is what the software sends
to the printer whenever it needs to select this font.
Inside command strings, numbers in angled brackets evidently translate
into binary values. Ie "<27>w" is the Escape character (ascii value 27)
followed by a lower-case "w".
Fonts and typefaces
-------------------
Many different fonts differ from each other only in that they are
essentially different sized versions of each other. Such fonts can be
grouped together into "typefaces". Thus the two Epson fonts just mentioned
are both in the "TYPEFACE pica_rx" section, whereas there are other
fonts in eg the "TYPEFACE elite" and "TYPEFACE times" sections.
The user sees all the different fonts in any one typeface as being
different "Heights" of the same "Font". The common name of these fonts is
given by the "NAME" field in the "TYPEFACE" section. Thus in the above
example, the user would see a "Size 12" and a "Size 16" font, under the
title "Pica".
The other restriction for placing fonts together in a typeface is that
they must have the same set of "TRANSLATE"s and the same "TYPE" (see
below for more details of these).
Translates
----------
The set of translates (if any) used by a font is as specified by the
"TRANSLATE" field in the enclosing "TYPEFACE" definition.
The value of "TRANSLATE" must be a lower-case name which exactly
matches the lower-case name of a "TRANSLATES" block within the same .wd
file.
There can be more than one "TRANSLATES" block in any one .wd file.
Each "TRANSLATES" block in turn consists of one or more translations,
such as
5:35
to turn any characters with ascii value 5 into characters with ascii value
35 (note that the Series3 font gives the telephone symbol as used in the
Database the value of 5, so that you had better translate this to something
your printer is more likely to be able to handle), or
156:"<27>R<3><35><27>R<0>"
to intercept any † symbols (ascii value 156) in output sent to the printer
and replace them with the specified escape sequence.
Another type of use might be to convert the character "O with a slash
through it" (Series3 ascii value 157) into the sequence 'O' followed by
backspace followed by '/'.
Other commands
--------------
As well as the command strings to select various fonts, a .wd file
contains commands to have the printer perform other functions. These are
defined in the "COMMANDS" block at the start of the .wd file.
These commands are by and large clearly named, eg "ITALIC_ON" and
"ITALIC_OFF", "BOLD_ON" and "BOLD_OFF", and "SUPERSCRIPT_ON" and
"SUPERSCRIPT_OFF".
If a printer cannot support a given feature, you can leave the
corresponding command string null (""). One possible exception is
italic which, if not supported, could be implemented as an underline.
Note incidentally that it is possible for a printer which supports
italic in one font not to support it in another font, and so on. Again, a
printer may support both italic and superscript, but not both at the same
time.
You may find it particularly fruitful to experiment with these command
strings - especially if your printer is one than is somehow an "enhanced"
model of one that is "officially" supported by Psion.
The preamble commands
---------------------
The string of commands sent to the printer when printing starts are
among the most important, as regards influencing the printed outcome.
The very first command the software sends the printer is the "RESET"
command. Then it sends a "FORM_LENGTH" command, and then the "PREAMBLE"
command, before starting to print the document proper (together with
headers and footers, etc). At the very end, a "POSTAMBLE" command is sent.
The "POSTAMBLE" command may be needed to flush the printer buffer, and
to restore the printer to its default settings.
The "PREAMBLE" command may have such drastic consequences as choosing
the basic configuration of the printer (possibly overriding defaults set
via dip switches). "Consult your printer documentation for full details."
The units for the "FORM_LENGTH" command are ALWAYS 1/6 of an inch.
Special characters in command strings
-------------------------------------
The commands "MOVE_RIGHT", "MOVE_DOWN", and "FORM_LENGTH" are each used
in conjunction with a value passed by the printer subsystem software. For
example, the commands are to set the form length TO A GIVEN VALUE, or to
move the printer position right BY A GIVEN AMOUNT. This value may either
end up in the command string by a process of substitution, or it may result
in the command being repeated as required: