of
this International Standard 10180 are incorporated by reference.
SPDL Indexed Font Representation
The SPDL Indexed Font Encoding consists of three sections in
sequence: Header, PerFont Attributes, and Glyph Shape Information.
Each of these sections is described below.
Header
The encoding of an SPDL Indexed Font must begin with the following:
%!FONTSTANDARD-STANDARDVERSION: TYPEFACE DATAVERSION
where FONTSTANDARD is ISO-9541-3 for public
interchange, and may be any octet string for private
interchange. STANDARDVERSION, TYPEFACE, and
DATAVERSION are as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
Following this first required encoding element should be the lines:
%%/CreationDate: TIMESTAMP
%%PROPDATA
where TIMESTAMP is an ISO 8824 Universal Time String for public
interchange, and may be any octet string for private interchange;
PROPDATA is as defined in ISO/IEC 9541.
The final encoding element in the header is one or more lines of
the form:
% DATACOPYRIGHT
and/or
% DSNCOPYRIGHT
where DATACOPYRIGHT and DSNCOPYRIGHT are as defined in ISO/IEC 9541.
PerFont Attributes
The Header of the Indexed Font encoding is immediately followed by
the PerFont Attributes. These attributes consist of several top-
level attributes and a subset of FontInfo attributes. The top-
level attributes and the FontInfo attribute subset in this clause
may appear in any order within the PerFont Attributes section of
the encoding. The end of the Header and consequent beginning of
the PerFont Attributes section is delimited by the line:
FONTDICTSIZE dict begin
where FONTDICTSIZE is a Cardinal whose value is one more than the
number of PerFont Attributes actually present in the Indexed Font.
For the purpose of computing FONTDICTSIZE, the FontInfo attribute
subset is considered to be a single attribute.
The end of the PerFont Attributes section is delimited by the line:
currentdict end
All of the PerFont Attributes (including the FontInfo attribute
subset), if present in the encoding, must appear between these two
delimiter lines. The following subclauses detail the encoding of
each top-level attribute, the FontInfo attribute subset, and each
attribute within the FontInfo attribute subset.
FontInfo (OPTIONAL)
The FontInfo attribute subset contains several attributes, all of
which are optional, and which may appear in any order between the
FontInfo begin delimiter line:
/FontInfo NUMFIATTRIBUTES dict dup begin
where NUMFIATTRIBUTES is the number of attributes actually present
in the FontInfo attribute subset, and the FontInfo end delimiter
line:
end rdef
The attributes which may be present in the FontInfo attribute
subset are encoded as follows:
Version (OPTIONAL)
/version (DATAVERSION) rdef
where DATAVERSION is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
Fullname (OPTIONAL)
/FullName (TYPEFACENAME) rdef
where TYPEFACENAME is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
FamilyName (OPTIONAL)
/FamilyName (FONTFAMILY) rdef
where FONTFAMILY is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
Weight (OPTIONAL)
/Weight (WEIGHT) rdef
where WEIGHT is as defined in ISO/IEC 9541 for public interchange,
and may be any octet string for private interchange.
ItalicAngle (OPTIONAL)
/ItalicAngle POSTUREANGLE rdef
where POSTUREANGLE is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
isFixedPitch (OPTIONAL)
/isFixedPitch ESCCLASS rdef
where ESCCLASS is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
UnderlinePosition (OPTIONAL)
/UnderlinePosition SCOREOFFSETX
rdef
where SCOREOFFSETX is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
UnderlineThickness (OPTIONAL)
/UnderlineThickness SCORETHICK rdef
where SCORETHICK is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
FontName (OPTIONAL)
/FontName /FONTNAME rdef
where FONTNAME is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
PaintType
/PaintType STRUCTURE rdef
where STRUCTURE is as defined in ISO/IEC 9541 for public
interchange, and may be any octet string for private interchange.
FontType
/FontType FONTTYPE rdef
where FONTTYPE is of type Cardinal. If the value of the
GlyphShapeTechnology property (see ISO/IEC CD 9541-3) is
ISO/STANDARD/9541-3/TYPE1, the value of FONTTYPE
is 1. For private interchange, FONTTYPE may be any
value of type Cardinal between 101 and 998 inclusive.
FontMatrix
/FontMatrix [a b c d e f] rdef
or
/FontMatrix {a b c d e f} rdef
A coordinate (X,Y) in the Glyph Coordinate System (as defined in
ISO/IEC 9541) is transformed to a coordinate (x,y) in the SPDL User
Coordinate System according to the following linear equations:
x = aX + cY + e
y = bX + dY + f
Typically the values of b, c, e, and f are 0, and the values of a
and d are both 1/RELUNITS, where RELUNITS is as defined in ISO/IEC
9541 and as discussed in ISO/IEC CD 9541-3.
Encoding
The Encoding attribute may take two forms. The first of these
forms is:
/Encoding PRIVATEENCODING rdef
where PRIVATEENCODING may be any octet string. This form of the
Encoding attribute may only be used in private interchange.
The second allowed encoding of the Encoding attribute is a sequence
of index-to-glyph-name mappings whose begin is delimited by:
/Encoding 256 array
0 1 255 {1 index exch /DEFAULTGNAME put}
for
where DEFAULTGNAME is the name to which indices not explicitly
mapped in this Encoding attribute are to be mapped.
Following the above delimiter is a sequence of 0 to 256 elements of
the form:
dup INDEX /GNAME put
where INDEX is a Cardinal (value between 0 and 255 inclusive)
representing the index being mapped to the glyph name; GNAME is a
glyph identifier as defined in ISO/IEC 9541 for public interchange,
and may be any octet string for private interchange.
The sequence of mapping elements is terminated by:
rdef
FontBBox
/FontBBox {MINX MINY MAXX
MAXY} rdef
or
/FontBBox [MINX MINY MAXX
MAXY] rdef
where MINX, MINY, MAXX, and MAXY are as defined under the
MAXFONTEXT property in ISO/IEC 9541.
UniqueID (OPTIONAL)
/UniqueID UNIQUEID rdef
where UNIQUEID is of type Integer. If present, its value should be
the same as the value of the UniqueID Private Attribute in the
Glyph Shape Information section.
Glyph Shape Information
Following the PerFont Attributes section is the Glyph Shape
Information section. The entire Glyph Shape Information section is
usually encrypted using the eexec encryption algorithm
(see 3.3.3 of this Annex).
If and only if this section is encrypted using the
eexec algorithm, the encrypted data should be preceded by the
delimiter:
currentfile eexec
The actual shape information (and the eexec-encrypted portion of
the encoding if eexec encryption is used) itself consists of two
sections: Private Attributes and CharStrings. The encoding for
these two sections before any eexec encryption is applied is
described in 3.3.1 and 3.3.2; the optional eexec encryption
algorithm is described in 3.3.3.
Private Attributes
The Private Attributes section consists of several required and
optional attributes. The semantics of these attributes are
described in ISO/IEC CD 9541-3. These attributes may appear in any
order within the Private Attributes section, with the following two
exceptions:
- The RD, ND, and NP attributes, or any subset thereof, may
appear in any order either before or within the Private
Attributes section. The placement of any of these attributes
before the Private Attributes section, while allowed, is not
recommended.
- The Subrs attribute must be the last attribute.
The beginning of the Private Attributes section is delimited by the
following:
dup /Private PRIVATESIZE dict dup begin
where PRIVATESIZE is a Cardinal indicating the number of attributes
present in the Private Attributes section, including any RD, ND, or
NP attributes which may appear before the Private Attributes
section. The end of the Private Attributes section is delimited by
the line:
ND
where ND is the octet string defined as part of the ND attribute
(see 3.3.1.2).
All of the Private Attributes, if present in the encoding, must
appear between these two delimiter lines (except RD, ND, and NP as
noted above). The following subclauses detail the encoding of each
attribute.
RD
/RD {string currentfile exch readstring
pop} rdef
where RD is any octet string not equivalent to the octet string
defined as part of the ND attribute, not equivalent to the octet
string defined as part of the NP attribute, and not equivalent to
the name of any other Private Attribute.
ND
/ND {ndef} rdef
where ND is any octet string not equivalent to the octet string
defined as part of the RD attribute, not equivalent to the octet
string defined as part of the NP attribute, and not equivalent to
the name of any other Private Attribute.
NP
/NP {nput} rdef
where NP is any octet string not equivalent to the octet string
defined as part of the RD attribute, not equivalent to the octet
string defined as part of the ND attribute, and not equivalent to
the name of any other Private Attribute.
BlueValues
/BlueValues [BLUEVALUEPAIRS] ndef
where BLUEVALUEPAIRS is a sequence of 0 to 7 pairs of Integers.
The semantics of these integer pairs are defined in ISO/IEC CD 9541-
3.
OtherBlues (OPTIONAL)
/OtherBlues [OTHERBLUESPAIRS]
ndef
where OTHERBLUESPAIRS is a sequence of 0 to 5 pairs of Integers.
The semantics of these integer pairs are defined in ISO/IEC CD 9541-
3.
FamilyBlues (OPTIONAL)
/FamilyBlues [FAMILYBLUESPAIRS] ndef
where FAMILYBLUESPAIRS is a sequence of 0 to 7 pairs of Integers.
The semantics of these integer pairs are defined in ISO/IEC CD 9541-
3.
FamilyOtherBlues (OPTIONAL)
/FamilyOtherBlues [FAMILYOTHERBLUESPAIRS] ndef
where FAMILYOTHERBLUESPAIRS is a sequence of 0 to 5 pairs of
Integers. The semantics of these integer pairs are defined in
ISO/IEC CD 9541-3.
BlueScale (OPTIONAL)
/BlueScale BLUESCALE ndef
where BLUESCALE is of type Number. The semantics of BLUESCALE are
defined in ISO/IEC CD 9541-3.
BlueShift (OPTIONAL)
/BlueShift BLUESHIFT ndef
where BLUESHIFT is of type Integer. The semantics of BLUESHIFT are
defined in ISO/IEC CD 9541-3.
BlueFuzz (OPTIONAL)
/BlueFuzz BLUEFUZZ ndef
where BLUEFUZZ is of type Integer. The semantics of BLUEFUZZ are
defined in ISO/IEC CD 9541-3.
StdHW (OPTIONAL)
/StdHW [STDHW] ndef
where STDHW is of type Number. The semantics of STDHW are defined
in ISO/IEC CD 9541-3.
StdVW (OPTIONAL)
/StdVW [STDVW] ndef
where STDVW is of type Number. The semantics of STDVW are defined
in ISO/IEC CD 9541-3.
StemSnapH (OPTIONAL)
/StemSnapH [STEMSNAPHVALUES] ndef
where STEMSNAPHVALUES is a sequence of 0 to 12 Numbers. The
semantics of STEMSNAPHVALUES are defined in ISO/IEC CD 9541-3.
StemSnapV (OPTIONAL)
/StemSnapV [STEMSNAPVVALUES] ndef
where STEMSNAPVVALUES is a sequence of 0 to 12 Numbers. The
semantics of STEMSNAPVVALUES are defined in ISO/IEC CD 9541-3.
ForceBold (OPTIONAL)
/ForceBold FORCEBOLD ndef
where FORCEBOLD is of type Boolean; the value of FORCEBOLD
must be either true or false. The semantics of
FORCEBOLD are defined in ISO/IEC CD 9541-3.
LanguageGroup (OPTIONAL)
/LanguageGroup LANGUAGEGROUP ndef
where LANGUAGEGROUP is of type Cardinal. The semantics of
LANGUAGEGROUP are defined in ISO/IEC CD 9541-3.
lenIV (OPTIONAL)
/lenIV LENIV ndef
where LENIV is of type Cardinal. The semantics of LENIV are
defined in ISO/IEC CD 9541-3.
MinFeature
/MinFeature {16 16} def
password
/password 5839 def
UniqueID (OPTIONAL)
/UniqueID UNIQUEID rdefn
where UNIQUEID is of type Integer. If present, its value should be
the same as the value of the UniqueID PerFont Attribute.
Subrs
The Subrs attribute consists of a sequence of delimited charstring-
encrypted Subrs. The definition of, semantics of, and encryption
of Subrs are defined in ISO/IEC CD 9541-3. The beginning of the
Subrs attribute is delimited by:
/Subrs SUBRSSIZE array
where SUBRSSIZE is a Cardinal indicating the number of Subrs in the
Subrs attribute.
Following the above delimiter is a sequence of exactly SUBRSSIZE
elements of the form:
dup INDEX SUBRLENGTH RD ENCRYPTEDSUBR NP
where:
- INDEX is a unique index of type Cardinal, value between 0 and
(SUBRSSIZE - 1) inclusive
- SUBRLENGTH is the length in octets of the charstring-
encrypted Subr
- RD is the octet string defined as part of the RD
attribute
- there is exactly one space character in the encoding between
the value of RD and the first octet of
ENCRYPTEDSUBR
- ENCRYPTEDSUBR is a charstring-encrypted Subr of length
SUBRLENGTH octets
- NP is the octet string defined as part of the NP
attribute
The sequence of Subr elements that make up the Subrs attribute is
implicitly terminated by the ND denoting the end of Private
Attributes subsection of the Glyph Shape Information section.
CharStrings
The CharStrings subsection of the Glyph Shape Information section
consists of a sequence of glyph-name/charstring-encrypted-
CharString pairs. The definition of, semantics of, and charstring-
encryption of CharStrings are defined in ISO/IEC CD 9541-3. The
beginning of the CharStrings attribute is delimited by:
2 index /CharStrings CHARSTRINGSSIZE dict dup
begin
where CHARSTRINGSSIZE is a Cardinal indicating the number of
mappings in the CharStrings attribute.
Following the above delimiter is a sequence of exactly
CHARSTRINGSSIZE elements of the form:
/GNAME CHARSTRINGLENGTH RD ENCRYPTEDCHARSTRING ND
where:
- GNAME is a glyph identifier as defined in ISO/IEC 9541 for
public interchange, and may be any octet string for private
interchange
- CHARSTRINGLENGTH is the length in octets of the charstring-
encrypted CharString
- RD is the octet string defined as part of the RD
attribute
- there is exactly one space character in the encoding between
the value of RD and the first octet of
ENCRYPTEDCHARSTRING
- ENCRYPTEDCHARSTRING is a charstring-encrypted CharString of
length CHARSTRINGLENGTH octets
- ND is the octet string defined as part of the ND
attribute
The end of the sequence of CharString elements (and the CharStrings
subsection of the Glyph Shape Information section) is delimited by:
end
end
nput
nput
dup FontName get exch definefont pop
If the Glyph Shape Information section is not to be encrypted using
the eexec algorithm, the above also denotes the end of the Glyph
Shape Information section and the end of the entire encoding.
If and only if the Glyph Shape Information section is to be
encrypted using the eexec algorithm, the following should appear as
the final octet string inside the eexec-encrypted Glyph Shape
Information section:
mark currentfile closefile
and the following should appear as cleartext (non-eexec-encrypted)
after the eexec-encrypted Glyph Shape Information section to
delimit the end of the entire encoding:
cleartomark
eexec Encryption Algorithm
The eexec encrypition algortihm is used to encrypt the Private
Attributes and CharStrings and a nearly identical algorithm is used
to decrypt these sections of the SPDL Indexed Font representation.
Encryption
To encrypt a sequence of plaintext octets using the
eexec encryption algorithm:
- Generate 4 random numbers between 0 and 255 inclusive and
form an octet string of length 4 from these numbers. Place
this octet string immediately before the octet string which
is the plain text.
- Initialize an unsigned 16 bit integer variable R to
55,665.
- For each octet, Q, in the octet string formed in step 1.
execute the following steps, replacing Q with its encrypted
form E:
- Assign the high order 8 bits of R to a temporary
variable, T.
- Exclusive-or Q with T, producing a encrypted octet, E.
- Compute the next value of R using the formula
- R = ((E + R) 4 52845 + 22719) modulo 65,536
Decryption
To decrypt a sequence of eexec encrypted octets using the
eexec decryption algorithm:
- Initialize an unsigned 16 bit integer variable R to
55,665.
- For each octet, E, in the encrypted octet string, execute
the following steps, replacing E with its decrypted form Q:
- Assign the high order 8 bits of R to a temporary
variable, T.
- Exclusive-or E with T, producing a decrypted octet, Q.
- Compute the next value of R using the formula
- R = ((E + R) 4 52845 + 22719) modulo 65,536
- Discard the first 4 octets of the resulting decrpyted octet
string. The remaining octets are the decrypted text.