[comp.sys.acorn] RISC OS to Postscript font conversion

joe@tharr.UUCP (Joe Abley) (06/30/91)

I seem to remember someone asking about using RISC OS fonts in postscript...
Well, I have a copy of a p.d. program called "!PSfont" (a beta-test version
anyway) which claims to do this. I haven't managed to try it out, not
having access to a laserwriter any more.

Anyway, here's the !Help file - hope it's useful :-) If anybody's
interested I can post this... Or mail the author (address below).

Joe


--------

!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: csmale@encore.nl (for the moment at least)

!PSfont - Usage Notes
=====================

!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.  Also, ensure that the Font$Path
system variable is set up correctly.

The output of !PSfont is 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>.
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.

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

Two basic files are provided with the program in directory <PSfont$Dir>.Encoding:
Latin1 and Symbol.  The latter is compatible with the RISC OS "Symbol" font and
happens to contain the definition of the standard PostScript symbol encoding.

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.



-- 
/---------------------------------+             * Tharr *
| joe@tharr.uucp                  | Free Public Access UNIX in the UK
\---------------------------------+        call +44 234 841503