home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 55
/
Amiga_Dream_55.iso
/
RISCOS
/
APPS
/
FONT
/
PSFONT.ZIP
/
!PSfont
/
!Help
< prev
next >
Wrap
Text File
|
1991-08-21
|
10KB
|
192 lines
!PSfont - RISC OS to PostScript Font Converter
Copyright ⌐ 1991 C.R. Smale
This program has been released into the public domain for personal use.
If you want to use !PSfont or its output in any commercial way whatsoever,
you must have my explicit permission. Also you are warned that holders
of the copyright in fonts for use with RISC OS *might* take issue with you.
If they do, I don't want to know. I *would* like to know about any problems,
suggestions or success stories however!
Author: Colin Smale
Spechtenkamp 87
3607 KE MAARSSENBROEK
The Netherlands
Tel: +31 3465 69038
E-mail: colin@integow.uucp
With thanks to Andrew Brooks (arb@comp.lancs.ac.uk) for many improvements!
!PSfont - Usage Notes
=====================
Version 1.3, 20th August 1991
!PSfont takes a RISC OS font and produces a PostScript font program which
can be downloaded to a PostScript compatible printer. This allows use
of any font available under RISC OS with the PostScript Printer Driver
!PrinterPS, which has a drawback in that it provides no mechanism for
using fonts which are not resident in the printer.
The information in <font>.Outlines and <font>.IntMetrics is used as a basis.
Additionally, the user has to provide a file <font>.Encoding, which contains
information for mapping the characters in the font to their corresponding
PostScript character names. This information is required in order to
produce a correct encoding vector in the output which is compatible with
the PostScript standard. The Printer Driver also remaps the character
codes from PostScript standard back to RISC OS encoding; this is not always
100% successful as there are various character sets and encoding vectors
in use with RISC OS fonts.
Before converting a font you should put together the <font>.Encoding file.
The syntax of the file is described later. However, a default encoding
for ISO Latin1 (<PSFont$Dir>.Encoding.Latin1) is used if the file
<font>.Encoding is not present. If the font is a dingbats-type symbol
font, selecting "PostScript Symbol" encoding for the output causes the
file <PSFont$Dir>.Encoding.Symbol to be used instead. By selecting the
'Acorn Latin1 Extensions' icon, the default for text fonts is called
'Latin1Ext' instead of 'Latin1'. This encoding file contains an extended
definition of the Latin1 Alphabet commonly used in RISC OS fonts.
Also, ensure that the Font$Path system variable is set up correctly.
The output of !PSfont is always placed in <font>.PostScript.
Upon starting, !PSfont displays a dialog box with various fields to be
filled in. The most important is the name of the RISC OS font to be
converted. Enter the name in the traditional way, e.g.
Garamond.Light.Italic. The font name is automatically capitalised and
located by means of <Font$Path>. You may also select a font by dragging
either the "Outlines" file, or the directory containing it, onto the window.
This name is used to initialise the other fields, such as the name under
which the font will be defined to PostScript.
There is an option to make the font cacheable in the printer. With this
option ON, the character definitions will be cached in the printer, taking
up space in the font cache but saving time if the characters are
subsequently used again. If this option is OFF, the bitmaps will not be
stored in the font cache but will be regenerated from the relevant procedure
each time the character is used.
A choice of encoding vectors is provided. The program will either generate
an encoding vector compatible with the PostScript encoding (text or symbol),
or compatible with the font's own encoding vector as determined from the
<font>.Encoding file. The former should be used for most purposes. The
latter should only be used if you know what you're doing! Not that an
incorrect encoding vector will cause horrendous problems; undefined
characters simply do not appear on the paper.
Type 1 versus Type 3 Fonts
==========================
There are two methods of defining a font in PostScript, called Type 1 and
Type 3. Type 1 fonts are encrypted so you can't recreate the character
definitions from the jumble of hex bytes. Also, Type 1 fonts are 'cleverer'
in that the operators to draw a character can be influenced in such a way as
to improve the appearance of the font, particularly at smaller point sizes;
this is called 'hinting'. A further advantage of Type 1 is that the fonts
take up much less valuable memory in the printer, thus allowing more fonts
to be used in one document.
Type 3 fonts on the other hand are in clear PostScript with no encryption.
The character definitions can use any of the normal PS graphics operators.
No hinting mechanism is intrinsically provided by PostScript interpreters.
Such fonts are much easier to produce with machine conversions such as !PSfont,
which is why the earlier versions only worked with Type 3.
Version 1.3 of !PSfont does not produce any hinting information in Type 1
fonts. RISC OS fonts, the better ones anyway, contain a wealth of so-called
scaffold lines which appear to be a suitable basis for creating hints. I will
be investigating this in the future...
Use with !PrinterPS
===================
A modified version of PSprolog (for use with !PrinterPS V2.4X) is also
included, which works correctly with Type 3 fonts. The standard version
only works with Type 1 fonts, such as the ones built into most PostScript
printers.
!PrinterPS does not download any fonts; you will have to do this by inserting
the fonts into the output of the printer driver at suitable places such as
at the start of the file.
Encoding Vectors For RISC OS Fonts
==================================
Most RISC OS text fonts (as opposed to symbol fonts) that I have seen comply
more or less with the ISO Latin 1 alphabet on page 1824 of the PRM. There
are a few areas in which problems can arise; notably in the range &80-&9F
(blank in the PRM diagram) and at &D7 (multiply) and &F7 (divide). The latter
two characters are often replaced with 'OE' and 'oe' respectively. There
are however a number of ways used to fill the range &80-&9F.
The most convenient way to get an overview of the characters in a font is by
using Acorn's Outline Font Editor !FontEd.
Syntax Of The Encoding File
===========================
Create this file using !Edit.
The file contains a list of up to 256 character names, which should correspond
to the PostScript naming conventions (although this is not enforced at the
moment). Each line can contain multiple names, separated by white space.
The character '#' introduces a comment until the end of the line.
The character '=' followed by a number indicates that the character codes of
the following names start at that number. This is useful for skipping
ranges of undefined characters. E.g. =128 means 'goto 128'. The number is
fed through EVAL so hexadecimal numbers preceded by & can also be used.
The character '@' followed by a filename means 'call' that file in a nested
manner, i.e. return to the original file when done. The character code
pointer is set to zero at the start of every file. This can be used to 'call'
a file containing the default character mappings which can then be selectively
modified by the original Encoding file. Example: @<PSfont$Dir>.Encoding.Latin1
The name '*' is special. It means 'undefine' this character. This is useful
if the basic mapping from a 'call' file defines a character which is not
present in the font in question.
The name '.' means skip this character in the encoding file, leaving its
current definition as it is. This is useful for skipping one or two characters
at a time without using the '=' syntax described above.
After processing the Encoding file, the character name for a given character
code is the last name encountered for that code.
A minimal file, using the ISO Latin 1 alphabet, would be as follows:
# encoding vector
@<PSfont$Dir>.Encoding.Latin1
Three basic files are provided with the program in directory
<PSfont$Dir>.Encoding: Latin1, Latin1Ext and Symbol. The latter is
compatible with the RISC OS "Symbol" font and happens to contain the
definition of the standard PostScript symbol encoding. These three files
contain defaults which are used if there is no Encoding file in the font
directory.
NOTE: Defining a character in the Encoding file which is not actually
present in the font does no harm at all. The resulting output file contains
all characters defined in the font under names as specified in the Encoding
file. The PostScript Encoding vector contains only characters which are
defined in the font.
Check the input encoding for single quotes! Some fonts have three sorts,
i.e. quotesingle, quoteleft, quoteright. Others have only one. The PostScript
standard encoding puts quotesingle at &89 and quoteright at &27, where you
would expect quotesingle to be. The Latin1Enc in PSprolog calls for
quotesingle at the 'normal' place. So if you take a font with only one type
of single quote, the Latin1 input decoding will call it quotesingle. The
output from !PSfont using a PS standard text encoding vector will not find
quoteright and put a .notdef at this location so you won't get any single
quotes in your output! One way round this, although not 100% kosher, is
to change the Latin1Enc in PSprolog to encode quotesingle at the place
where quoteright is currently called for. I have yet to see a practical
difference between these two characters anyway. Encoding the same character
at two different places gives no problems at all.