Composite Indexed Font Specification Dictionaries

FontType 0 Indexed Font Specification Dictionaries

In addition to the <FontType: Integer> pair, a FontType 0 Indexed Font Specification Dictionary shall have at least the following key/value pairs, the required pairs:

FontMatrix

The mandatory key/value pair <FontMatrix: Transformation> specifies the initial or default value of the Transformation used when the Indexed Font Specification Dictionary is made into a corresponding IndexedFont. This transformation is effectively concatenated with the FontMatrix of each descendant font in the composite font.

Encoding

The mandatory key/value pair <Encoding: VectorReference> references a Vector of Cardinals. Each Cardinal is a font selector. This Vector represents a FONT INDEX MAP in content. This Vector is used to associate font indices with font selectors during Glyph Mapping (see ).

FDepVector

The mandatory key/value pair <FDepVector: VectorReference> references a Vector of IndexedFonts. Font selectors from the FontIndexMap (the Encoding key/value pair; see above) are used to select a IndexedFont from the FDepVector. This is how a Composite Font accesses component fonts during Glyph Mapping (see ). Component fonts may be Base IndexedFonts or Composite IndexedFonts.

FMapType

The mandatory key/value pair <FMapType: Integer> specifies a Glyph Mapping Algorithm. The Integers for the allowed Glyph Mapping Algorithm and the algorithms themselves are specified in . Other values are reserved for future use of this International Standard.

Other Key/Value Pairs

Other key/value pairs are required in a FontType 0 Indexed Font Specification Dictionary, depending on the value of FMapType. These are defined in .

Optional Key/Value Pairs

The optional key/value pairs in a FontType 0 Indexed Font Specification Dictionary, with semantics defined by this International Standard, are:

WMode

The optional key/value pairs <WMode: Cardinal> is used in the same way that it is used in a Base Font. The value of WMode in a Composite Font overrides the value of WMode in all component fonts of the Composite Font. If WMode is not present in the Composite Font, the value defaults to zero.

In addition to the above key/value pairs, an Indexed Font Specification Dictionary may contain any other key/value pairs desired.

Composite Font Glyph Mappings

If the current font is a Composite Font, this clause defines the algorithms for performing Glyph Mapping during character text imaging. The following paragraphs define some terms used in the remainder of this clause.

The hierarchical structure of the Composite Font is viewed as a tree. The root node of the tree is the original Composite Font, which is the current font at the beginning of mapping a GlyphString. This font is referred to as the root font. The leaf nodes of the tree are Base Fonts, which actually contain glyph shape information. The intermediate nodes (if any) are additional Composite Fonts. Moving in the direction from the root to the leafs is called descending the tree, moving in the direction from the leafs to the root is called ascending the tree. The component fonts of a Composite Font, and their components to any level, are called descendant fonts. The font of which a descendant font is a component is called the parent font. There may be an implementation limit to the depth of nesting of composite fonts.

In general, the octets in a GlyphString are used to derive a sequence of glyph specifiers, where each glyph specifier consists of a pair, (Base Font, glyph identifier). Then each glyph identifier is imaged from its Base Font as though the Base Font were the current font for the duration of that imaging activity. Procedures in Base Fonts, e.g., the ConstructGlyph Procedure in a FontType 3 font or a CDevProc Procedure in a FontType 1 font, may use the operators GetSelectedFont and GetRootFont to determine the currently selected Base IndexedFont and the original Composite IndexedFont, respectively.

The association between font indices and FDepVector font selectors in a Composite Font is specified by the Encoding Vector. The Encoding is a reference to a Vector of Cardinals, and is a required key/value pair in all Composite Indexed Font Specification Dictionaries. This Vector, the Font Index Encoding Vector, represents a FONT INDEX MAP. Each font index is used as an index into the Font Index Encoding Vector, thereby selecting a font selector; this font selector is then used as an index into the FDepVector to determine the component font to be used for imaging or further component font selection, as described below.

Composite Font Glyph Mapping Algorithms

There are two categories of Composite Font Glyph Mapping algorithm: modal and non-modal. With non-modal mapping algorithms, the mapping algorithm restarts after each glyph specifier is extracted from the GlyphString. With modal mapping algorithms, the algorithm maintains information about a position in the hierarchical tree structure of component fonts. Composite Fonts with non-modal mapping algorithms may be descendant fonts of Composite Fonts with modal mapping algorithms, but not vice versa.

As the Composite Font Glyph Mapping algorithm descends the Composite font tree, the behavior of the algorithm depends on the value of FMapType in the Composite Font under consideration. Each descent to a Base Font determines a single glyph specifier and constitutes a cycle of the Composite Font Glyph Mapping algorithm. Each cycle may use either or both of the modal and non-modal mapping algorithms. Each cycle will also consume some number of octets from the GlyphString. As each glyph specifier is determined, it is returned for further processing to the imaging operator in that required Glyph Mapping. After each cycle, the next cycle begins at the currently selected font. The currently selected font is the Indexed Font that was last selected by the modal mapping algorithm or the root font if there is no descendant Indexed Font selected by the modal mapping algorithm. At the beginning of mapping a GlyphString, the currently selected font is the root font. This process continues until all octets in the GlyphString have been exhausted.

Non-modal Glyph mapping algorithms

The non-modal mapping algorithm is used to construct a glyph specifier when the value of FMapType of the Composite Font under consideration is one of the non-modal values. The non-modal mapping algorithm is parameterized with sub-algorithms that specify the behavior of the non-modal mapping algorithm: (1) the initial sub-algorithm, used when non-modal mapping is initiated, and (2) the descendent sub-algorithm, used for all subsequent non-modal mapping in Indexed Fonts descendent from the initial non-modal font. These sub-algorithms are defined in the - below. These sub-algorithms control when and how many octets are read from the GlyphString and determine the potential font and glyph indices used in the algorithm.

There are four states in the state machine for the non-modal mapping algorithm:

  • 1. Based on the value of FMapType in the currently selected Composite Font, the appropriate initial sub-algorithm is invoked to establish an initial font index and potential glyph index.
  • 2. The font index is used as an index into the Composite Font's Font Index Encoding Vector, to determine the font selector. The font selector is then used as an index into the FDepVector to select a component Indexed Font of the Composite Font.
  • 3. If the selected descendant IndexedFont is a Base Font, then the potential glyph index is an actual glyph index. It is used to index into the Base Font's Glyph Index Encoding Vector (see ), determining the glyph identifier. A single glyph specifier is now determined and this cycle of the Composite Font mapping algorithm is complete.
  • 4. If the selected descendant IndexedFont is itself a Composite Font, then the new value of FMapType in this new Composite Font is used to determine which of the descendent sub-algorithms is invoked to determine a new font index and a new potential glyph index. This descendent sub-algorithm utilizes the value of the prior potential glyph index, and may extract further information from the GlyphString, as defined in the subclauses below. The non-modal mapping algorithm continues with state 2 above.

    If the non-modal mapping algorithm does not terminate with the above algorithm in state 3, RaiseError shall be invoked with RangeCheck as its operand.

    Modal Composite Font mapping algorithms

    The modal mapping algorithms are used to construct a glyph specifier when the value of FMapType of the Composite Font under consideration is one of the modal values. For modal mapping algorithms, the algorithm for determining glyph specifiers passes through four states:

  • 1. Based on the value of FMapType in the currently selected Composite Font, the appropriate modal trigger and an initial font index is established and an octet is extracted from the GlyphString.

  • 2. If the octet is a modal trigger, then the currently selected font may be changed. This process is described in each particular algorithm. If the octet is not a modal trigger, the octet is used as the potential glyph index for the currently selected font.
  • 3. If the currently selected IndexedFont is a Base Font, then the potential glyph index is an actual glyph index. It is used to index into the Base Font's Glyph Index Encoding Vector (see ), determining the glyph identifier. A single glyph specifier is now determined and this cycle of the Composite Font mapping algorithm is complete.
  • 4. If the currently selected IndexedFont is itself a Composite Font, then the new value of FMapType in this new Composite Font is used to determine which of the Glyph Mapping algorithms is invoked to determine a new font index and a new potential glyph index. If the value of the new FMapType is a non-modal value, the non-modal mapping algorithm is begun in state 4. If the value of the new FMapType is a modal value, several actions occur. The font index is set to zero. The font index is then used as an index into the currently selected Composite Font's Font Index Encoding Vector, to determine the font selector. The font selector is used as an index into the FDepVector to select a component Indexed Font of the Composite Font as the new currently selected font, another octet is extracted from the GlyphString and processing continues at state 2. immediately above.

    If the modal mapping algorithm attempts to extract, an octet from the GlyphString and there is no more octets in the GlyphString, then RaiseError shall be invoked with RangeCheck as its operand.

    The specific algorithms for deriving glyph specifier information from GlyphStrings, depending on the value of FMapType, are defined in the subclauses below.

    8/8 Mapping

    If the value of FMapType is 2, the non-modal Glyph Mapping algorithm is used. The sub-algorithms are as follows:

    Initial sub-algorithm: two octets are extracted from the GlyphString. The first is interpreted as a font index, between 0 and 255, inclusive. The second is interpreted as a potential glyph index, between 0 and 255, inclusive.

    Descendent sub-algorithm, the prior potential glyph index is interpreted as the new font index. One further octet is extracted from the GlyphString; it is interpreted as the new potential glyph index, between 0 and 255, inclusive.

    1/7 Mapping

    If the value of FMapType is 4, the non-modal Glyph Mapping algorithm is used. The sub-algorithms are as follows:

    Initial sub-algorithm: one octet is extracted from the GlyphString. The most significant bit is interpreted as a font index, either 0 or 1. The remaining 7 bits are interpreted as a potential glyph index, between 0 and 127.

    Descendent sub-algorithm: the prior potential glyph index is divided by 128; the result is rounded down to the nearest lesser Cardinal, and interpreted as the new font index. The least significant 7 bits of the prior potential glyph index are interpreted as the new potential glyph index, between 0 and 127.

    9/7 Mapping

    If the value of FMapType is 5, the non-modal Glyph Mapping algorithm is used. The sub-algorithms are as follows:

    Initial sub-algorithm, two octets are extracted from the GlyphString. The first octet is multiplied by two, and added to the most significant bit of the second octet. The resulting number is interpreted as a font index, between 0 and 511. The remaining 7 bits of the second octet are interpreted as a potential glyph index, between 0 and 127.

    Descendent sub-algorithm, one further octet is extracted from the Glyph String. The prior potential glyph index is multiplied by two, and added to the most significant bit of the further octet. The resulting number is interpreted as the new font index. The remaining 7 bits of the further octet are interpreted as the new potential glyph index, between 0 and 127.

    Interval Mapping

    If the value of FMapType is 6, the non-modal Glyph Mapping algorithm is used and there is an additional required key/value pair in the Composite Indexed Font Specification Dictionary: <SubsVector: OctetString>. The first octet of the SubsVector determines the extraction unit size, <sz: Cardinal>. This octet is a Cardinal between 0 and 255 and sz is one greater than the value of the first octet. There may be an implementation limit on the maximum allowed size of the value sz.

    The remainder of the SubsVector OctetString defines a sequence of ranges of consecutive extraction unit values. Each range is defined by sz octets; the octets are interpreted as a Cardinal, most significant octet first. The resulting number gives the size of the range of extraction unit values. The sum of all range sizes shall be less than the number 256 to the power of sz, which is the total number of extraction unit values expressible in sz octets. There is an implicit range at the end of the sequence of explicit ranges, containing the remainder of all possible extraction unit values.

    Given an extraction unit value, the Interval mapping algorithm determines a font index and potential glyph index as follows: The initial potential glyph index is set to the extraction unit value and the initial font index is set to zero. For each range in the SubsVector OctetString, if the value of the potential glyph index is within that range, the Interval mapping sub-algorithm is done and the current font index and potential glyph index are returned. Otherwise, a new potential glyph index is computed by subtracting the size of that range from the value of the old potential glyph index and the font index is incremented by one. If there are no more ranges in the SubsVector OctetString, then the Interval mapping sub-algorithm is done and the current font index and potential glyph index are returned.

    The sub-algorithms for the non-modal Glyph Mapping algorithm are as follows:

    Initial sub-algorithm: sz octets are extracted from the GlyphString; the octets are interpreted as a Cardinal, the first octet being the most significant octet. The resulting number is the extraction unit value. The extraction unit value is converted to a font index and potential glyph index as described in the paragraph above.

    Descendent sub-algorithm: the prior potential glyph index is multiplied by 256 to the power of (sz minus 1). Next, sz minus 1 further octets are extracted from the GlyphString; the octets are interpreted as a Cardinal, the first octet being the most significant octet. Finally, the sum of these two numbers is the new extraction unit value. The extraction unit value is converted to a font index and potential glyph index as described in the paragraph above.

    Escape Mapping

    If the value of FMapType is 3, the modal Glyph Mapping algorithm is used and there is an additional optional key/value pair in the Composite Indexed Font Specification Dictionary: <EscChar: Cardinal>, whose value shall be between 0 and 255, inclusive. This value is the Escape Code, which is used in the Escape Mapping mapping algorithm. If the EscChar key/value pair is absent from the Indexed Font Specification Dictionary, a default value of 255 shall be used. The value of EscChar in the RootFont IndexedFont shall override EscChar values specified in component Composite IndexedFonts.

    IndexedFonts with FMapType 3 may only be component fonts of other IndexedFonts with FMapType 3 or 7.

    If the value of FMapType is 3, the modal Glyph Mapping algorithm is used with state 2 detailed as follows:

    2a. The octet extracted from the GlyphString is interpreted as a Cardinal between 0 and 255, inclusive. If the Cardinal is equal to the Escape Code, then a second octet is extracted from the GlyphString, and interpreted as a Cardinal between 0 and 255, inclusive. The parent font of the currently selected font temporarily becomes the currently selected font. If the second Cardinal is equal to the Escape Code, then the temporary currently selected font becomes the currently selected font, another octet is extracted from the GlyphString and processing continues as for the second octet above. If the second Cardinal is not equal to the Escape Code, then the font index is set to the value of that Cardinal. The font index is then used as an index into the (temporary) currently selected Composite Font's Font Index Encoding Vector, to determine the font selector. The font selector is used as an index into the FDepVector to select a component Indexed Font of the Composite Font as the new currently selected font, another octet is extracted from the GlyphString and processing continues at 2a. above.

    2b. If the first Cardinal is not the Escape code, the octet is used as the potential glyph index for the currently selected font.

    Double Escape Mapping

    If the value of FMapType is 7, the modal Glyph Mapping algorithm is used and there is an additional optional key/value pair in the Composite Indexed Font Specification Dictionary: <EscChar: Cardinal>, whose value shall be a Cardinal between 0 and 255, inclusive. This value is the Escape Code, which is used in the Double Escape Mapping mapping algorithm. If the EscChar key/value pair is absent from the Indexed Font Specification Dictionary, a default value of 255 shall be used. The value of EscChar in the RootFont IndexedFont shall override EscChar values specified in any component Composite IndexedFonts.

    A IndexedFont with FMapType 7 may only be the root font; it cannot be a component of any other Composite Font.

    If the value of FMapType is 7, the modal Glyph Mapping algorithm is used with state 2 detailed as follows:

    2a. The octet extracted from the GlyphString is interpreted as a Cardinal between 0 and 255, inclusive. If the Cardinal is equal to the Escape Code, then a second octet is extracted from the GlyphString, and interpreted as a Cardinal between 0 and 255, inclusive. The parent font of the currently selected font temporarily becomes the currently selected font. If the second Cardinal is equal to the Escape Code, then a third octet is extracted from the GlyphString, and interpreted as an Cardinal between 0 and 255, inclusive. This number, plus 256, is the font index. If the second Cardinal is not equal to the Escape Code, then the font index is set to the value of that Cardinal. The font index is then used as an index into the (temporary) currently selected Composite Font's Font Index Encoding Vector, to determine the font selector. The font selector is used as an index into the FDepVector to select a component Indexed Font of the Composite Font as the new currently selected font, another octet is extracted from the GlyphString and processing continues at 2a. above.

    2b. If the first Cardinal is not the Escape code, the octet is used as the potential glyph index for the currently selected font.

    ShiftOut/ShiftIn Mapping

    If the value of FMapType is 8, the modal Glyph Mapping algorithm is used and there are two additional optional key/value pairs in the Composite Indexed Font Specification Dictionary: <ShiftOut: Cardinal>, and <ShiftIn: Cardinal>. The value of each shall be a Cardinal between 0 and 255, inclusive. If the ShiftOut key/value pair is absent from the Indexed Font Specification Dictionary, a default value of 14 shall be used. If the ShiftIn key/value pair is absent from the Indexed Font Specification Dictionary, a default value of 15 shall be used.

    A IndexedFont with FMapType 8 may only be the root font; it cannot be a component of any other Composite Font.

    If the value of FMapType is 8, the modal Glyph Mapping algorithm is used with state 2 detailed as follows:

    2a. The octet extracted from the GlyphString is interpreted as a Cardinal between 0 and 255, inclusive. If the Cardinal is equal to the ShiftIn code, then the font index is set to zero; if the Cardinal is equal to the ShiftOut code, then the font index is set to 1. The parent font of the currently selected font temporarily becomes the currently selected font. The font index is then used as an index into the currently selected Composite Font's Font Index Encoding Vector, to determine the font selector. The font selector is used as an index into the FDepVector to select a component Indexed Font of the Composite Font as the new currently selected font, another octet is extracted from the GlyphString and processing continues at 2a. above.

    2b. If the Cardinal is neither the ShiftIn code or the ShiftOut code, the octet is used as the potential glyph index for the currently selected font.

    Standard FONT INDEX MAPs

    This International Standard defines standard FONT INDEX MAPs which shall be available on all SPDL presentation systems. Other FONT INDEX MAPs may be available on specific presentation systems, or used in specific IndexedFont and Indexed Font Specification Dictionaries. Such systems or IndexedFonts need not use the standard FONT INDEX MAPs to be conforming.

    The standard FONT INDEX MAPs may be declared in RESOURCE DECLARATIONS (see ) and then used in document content within the scope of the DECLARATION.

    Algorithmic FONT INDEX MAPs

    A family of FONT INDEX MAPs named FontIndexMap/Sequential/nnn shall be available on all SPDL presentation systems. Each n is an ISO 646 decimal digit character. The sequence of digits nnn shall represent a decimal number whose value is ≤ 512.

    Each member of this family of FONT INDEX MAPs shall be a Vector of nnn Cardinals, where the elements of the Vector shall be the sequential Cardinals 0 through (nnn - 1).