Font Management
A very important part of PROforma concerns the manipulation and displaying
of vector fonts. The vector fonts which are
used in PROforma are a direct descendant of the Adobe Type I font format, but
optimised for efficient access, and low memory consumption. Programs exist to
convert Adobe Type 1 fonts for PROforma (pfb2pff).
Fonts have to be loaded upon request of the client, and can also be released
from memory by the client. Fonts only take a little more memory than they
occupy on disk. Fonts are always referenced by their name. Font names are
case dependant ! If a font is loaded by several
gstates, it is only kept in memory once. So
a font is not released from memory if there is at least one gstate which has
that font loaded (or the font is resident -
resident fonts are never released).
A font which is not resident is always removed from memory when there are no
more gstates which have loaded that font.
Resident fonts never have to be loaded by a gstate. They are always
available (so they are always in the fontlist).
- PFFontLoad
-
Load the given font file into memory, to make that font available
to the client. This command will automatically select the just
loaded font (the current fontsize is not affected by this call).
This command needs a fontname. The corresponding filename
is searched in the fontmap. So only
fonts which are in the fontmap can be used. Font files are searched
'as is', and
on the configured path.
- PFFontUnLoad
-
Stop using the given font. After PFFontUnLoad the current font
is no longer defined. If the font is not loaded by any other
gstate (and the font is not
resident), then the memory which this font occupies will be released.
This actually allows PROforma to release the font. The client
can no longer use that font, unless it is loaded again.
- PFFontSelect
-
Select the font with given name as current font. The new font will be
at the current fontsize.
- PFFontScale
-
Scale the current font to the given point size. Scaling a font
is always relative with the CTM.
- PFFontNameGet
-
Get name of current font.
- PFFontFamilyGet
-
Get name of font family of current font.
- PFFontVersionGet
-
Get version of current font.
- PFFontWeightGet
-
Get weight of current font.
- PFFontNoticeGet
-
Get notice of current font. This usually includes details about
creator and/or copyright on the font.
- PFCharAvailable
-
Routine to allow the client to know whether a character (with
given unicode) is available in the current font. Note that the
character is only searched in the current font. It may actually be
displayed when the character is displayed because the character may be
extracted from the builtin font.
- PFWidth, PFStringWidth
-
Get the width of a string.
- PFWidthKern, PFStringWidthKern
-
Get the width of a string, when displayed with
kerning.
- PFFontBbox
-
Get the FontBbox. This allows you to find out the maximum
amount a character can extend to the right and top, and to the left
and bottom.
Information about all the available fonts. This allows the client to know
which fonts are loaded and can be used.
- PFFontCount
-
Get the number of fonts which are loaded (in the
fontlist).
- PFFontNext
-
Select the next font in the list of fonts as the current font.
If the last font in the list was the current, an error will be
returned (and the current font is not changed).
And you can enquire about all the fonts which are in the fontmap.
- PFFontCountAll
-
Get the number of fonts in the fontmap. Also makes sure that
the next enquiry with PFNextFontName will return the first
font in the fontmap.
- PFFontNextName
-
Get the name of the next font in the fontmap.
PROforma always uses UniCode character
codes. These character code are "short" in size (and not char). A char just
didn't allow enough possible characters.
All the routines to display text (or get the width thereof) are available in
two varaints. The first variant uses unicode characters directly (a unicode
string is the same as a c string, \0 is used as end of string marker).
The other variant (the commands which start with "PFString") use
strings in the local character set (ordinary strings).
The requested characters are retrieved from the current font at the current
fontsize. If the character is not available in the current font, the character
will be retrieved from the builtin font. If
the builtin font also doesn't contain the character, then an empty character
(no width, not visible) is displayed.
- PFShow, PFStringShow
-
Show the requested string at the current position. Characters
are placed proportional. The current position will now be the
place where the next character should be placed.
- PFShowKern, PFStringShowKern
-
Show the requested string at the current position with
kerning.
The current position will now be the place where the next
character should be placed.
- PFShowX, PFStringShowX
-
Show the requested string at the current position. The advance
width of the characters is overwritten with the given values.
The vertical advance width is taken as zero.
The current position will now be the place where the next
character should be placed.
- PFShowXY, PFStringShowXY
-
Show the requested string at the current position. The advance
width of the characters is overwritten with the given values.
The current position will now be the place where the next
character should be placed.
- PFShowTrack, PFStringShowTrack
-
Show the requested string at the current position. The current
font size is used, but characters are positioned in such a way
to make sure that the string has the given width (using tracking).
- PFShowJust, PFStringShowJust
-
Same as PFShow (resp. PFStringShow), except that some
whitespace is added or
subtracted at the space characters, to make sure that the text
is displayed with full justification. The requested width of
the line has to be specified.
- PFShowKernJust, PFStringShowKernJust
-
Same as PFShowKern (resp. PFStringShowKern), except
that some whitespace is added or
subtracted at the space characters, to make sure that the text
is displayed with full justification. The requested width of
the line has to be specified.
- PFExtraEOS
-
All strings which are passed to PROforma are '\0' terminated c strings.
However, it may in some cases be useful to have an extra symbol which
can be interpretted as end of string marker. Such an extra marker can
be specified with this command. You can reset the extra marker by
setting it to '\0'
- PFPrintEscape
-
When strings which have to be displayed are passed using the local
character set, not all of the supported character set can be accessed.
Therefore, PROforma allows an escape sequence to specify all the
characters in the supported character set when normal strings are
used. You are then allowed to specify the character by putting the
(case dependent) name or (decimal)
unicode between backslashes.
However, as this behaviour is not always wanted, you can switch it on
or off.
- PFCharNameTable
-
To be able to use the supported
character set, PROforma gives you access to a table which contains
all the supported characters. Both the name and unicode of each
character is given. Please note that the name
of the supported characters is case dependent (for example to allow
both Egrave and egrave as character names).
- PFASCII2UnicodeTable
-
Although PROforma allows you to use the local character set for most of
the font handling commands, it may sometimes be necessary to convert
characters in the local character set to unicode. Therefore, there is
this table which gives the unicode value for each character in the
local character set.
Normally all font display operators try to use the
font cache. However, as
there are some problems with the usage of the font cache, the use of the font
cache can also be switched off. This can be done because all font display
operators work as if there is no clipping path when the cache is switched on !
- PFCacheUse
-
Tell PROforma whether or not the fontcache should be used.
For drawing programs like LINEdesign it is interesting to be able to extract
the outline of a character from a font as this allows the user to make some
individual changes to the characters.
Therefore this feature is supported by PROforma. And consists of a loop like :
select character which should be converted
DO
get the next path operator
process it
UNTIL end of character
Note: the PFCharPathInit and PFCharPathEl commands should
only be used in such a loop, just as all the other iterators in PROforma (no
other font operators shoud be used inside the loop).
- PFCharPathInit
-
Select the character for which the outline will be extracted.
Selects that character from the current font at the current size
of that font.
- PFCharPathEl
-
Get the next path element for that character. This can be a
move, line, curve, width or end of character command (which can be
interpreted as a PFPathDraw). The coordinates which are
returned are absolute coordinates, only the character origin has to be
added.
PROGS, Professional & Graphical Software
last edited February 13, 1996