# PM.TXT
    
    
                       OS/2 2.0 Technical Library
    
               Presentation Manager Programming Reference
    
                               Volume III
    
                           Part Number 1OG6272
    
    Note
    
    Before using this information and the product it supports, be sure
    to read the general information under "Notices" on page vii.
    
    
    First Edition (March 1992)
    
    The following paragraph does not apply to the United Kingdom or
    any country where such provisions are inconsistent with local law:
    INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
    PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
    OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states
    do not allow disclaimer of express or implied warranties in certain
    transactions, therefore, this statement may not apply to you.
    
    This publication could include technical inaccuracies or
    typographical errors. Changes are periodically made to the
    information herein; these changes will be incorporated in new
    editions of the publication. IBM may make improvements and/or
    changes in the product(s) and/or the program(s) described in this
    publication at any time.
    
    It is possible that this publication may contain reference to, or
    information about, IBM products (machines and programs),
    programming, or services that are not announced in your country.
    Such references or information must not be construed to mean that
    IBM intends to announce such IBM products, programming, or services
    in your country.
    
    Requests for technical information about IBM products should be
    made to your IBM Authorized Dealer or your IBM Marketing
    Representative.
    
    COPYRIGHT LICENSE: This publication contains printed sample
    application programs in source language, which illustrate OS/2
    programming techniques. You may copy and distribute these sample
    programs in any form without payment to IBM, for the purposes of
    developing, using, marketing or distributing application programs
    conforming to the OS/2 application programming interface.
    
    Each copy of any portion of these sample programs or any derivative
    work, which is distributed to others, must include a copyright
    notice as follows: "(c) (your company name) (year) All Rights
    Reserved."
    
    (c) Copyright International Business Machines Corporation 1992. All
    rights reserved.
    Note to U.S. Government Users--Documentation related to restricted
    rights--Use, duplication or disclosure is subject to restrictions
    set forth in GSA ADP Schedule Contract with IBM Corp.
    
    
    Appendix D. Standard Bit-Map Formats
    
    There are four standard bit-map formats. All device drivers have
    to be able to translate between any of these formats and their own
    internal formats. The standard formats are:
    
    Bitcount  Planes
    1         1
    4         1
    8         1
    24        1
    
    These formats are chosen because they are identical or similar to
    all formats commonly used by raster devices. Only single-plane
    formats are standard, but it is very easy to convert these to any
    multiple-plane format used internally by a device.
    
    Bit-Map Data
    The pel data is stored in the bit map in the order that the
    coordinates appear on a display screen. That is, the pel in the
    lower-left corner is the first in the bit map. Pels are scanned to
    the right, and upward, from that position. The bits of the first
    pel are stored, beginning with the most significant bits of the
    first byte. The data for pels in each scan line is packed together
    tightly, but all scan lines are padded at the end, so that each one
    begins on a ULONG boundary.
    
    Bit-Map Information Tables
    Each standard-format bit map must be accompanied by a bit-map
    information table. Because the standard-format bit maps are
    intended to be traded between devices, the color indexes in the bit
    map are meaningless without more information; for a description of
    this structure, see BITMAPINFO2.
    
    Some calls use a structure that is similar to BITMAPINFO2 but does
    not have the color table array; for a description of this
    structure, see BITMAPINFOHEADER2. Wherever BITMAPINFO2 is shown,
    BITMAPINFO is also allowed. Similarly, wherever BITMAPINFOHEADER2
    is shown, BITMAPINFOHEADER is also allowed.
    
    Bit-Map Example
    To make the ordering of all the bytes clear, consider this simple
    example of a 5-by-3 array of colored pels:
    
    Red   Green  Blue   Red    Green
    Blue  Red    Green  Blue   Red
    Green Blue   Red    Green  Blue
    
    ULONG ExampleBitmap[] {
         0x23,0x12,0x30,0x00             /* bottom line */
         0x31,0x23,0x10,0x00             /* middle line */
         0x12,0x31,0x20,0x00             /* top line */
    };
    
    #define BLACK     0X00000000L
    #define RED       0X00FF0000L
    #define GREEN     0X0000FF00L
    #define BLUE      0X000000FFL
    
    struct BitmapInfoTable ExampleInfo
           5,                       /* width       */
           3,                       /* height      */
           1,                       /* planes      */
           4,                       /* bitcount    */
           BLACK,RED,GREEN,BLUE,    /* color table */
           BLACK,BLACK,BLACK,BLACK,
           BLACK,BLACK,BLACK,BLACK,
           BLACK,BLACK,BLACK,BLACK
    };
    
    Bit-Map File Format
    The operating system uses the same file format for bit maps, icons,
    and pointers in resource files. in the following description, "bit
    map" refers to bit maps, icons, and pointers unless otherwise
    specified.
    
    Two formats are supported. In the first, a single-size version of
    the bit map is defined. This is used whatever the target device.
    
    The second format allows multiple versions of the bit map to be
    defined, including one or more device-independent versions, and a
    number of device-dependent versions, each intended for use with a
    particular device.
    
    In the case of icons and pointers, when more than one version of
    the bit map exists, the preferred version is one that matches the
    device size of icon or pointer. Otherwise the device-independent
    version is used to scale a bit map to the required size.
    
    The operating system provides pointers that match the requirements
    of the display device in use, typically pointers are 32x32 pels,
    one bit per plane.
    
    Icons provided with the operating system are designed to match the
    requirements of the most common display devices. The following
    versions of each icon are included in each file:
    
         32x32 4 bpp (16 color)
         40x40 4 bpp (16 color)
         32x32 1 bpp (black and white)
         20x20 1 bpp (black and white)
         16x16 1 bpp (black and white)
    
    The 32x32 versions are designed for VGA displays and for
    device-independent use.
    
    The 40x40 version is for 8514/A and XGA displays.
    
    The 20x20 and 16x16 are half-size icons designed for use as
    mini-icons.
    
    For general bit maps, which may be of arbitrary size, the preferred
    version is one matching the requested bit map size; otherwise one
    matching the display size is selected. If neither is available, the
    device-independent version is used from which to scale a bit map.
    
    For both formats, the definition consists of two sections. The
    first section contains general information about the type,
    dimensions, and other attributes of the resource. The second
    section contains data describing the pels that make up the bit
    map(s), and is in the format specified in "Bit-Map Data" on page
    D-1.
    
    In the multiple-version format, the first section contains an array
    of BITMAPARRAYFILEHEADER structures. or BITMAPARRAYFILEHEADER2
    structures. The format of these is as follows:
    
    typedef struct _BITMAPARRAYFILEHEADER {     /* bafh */
          USHORT             usType;
          ULONG              cbSize;
          ULONG              offNext;
          USHORT             cxDisplay;
          USHORT             cyDisplay;
          BITMAPFILEHEADER   bfh;
    } BITMAPARRAYFILEHEADER;
    typedef BITMAPARRAYFILEHEADER *PBITMAPARRAYFILEHEADER;
    
    typedef struct _BITMAPARRAYFILEHEADER2 {    /* bafh */
    
          USHORT             usType;
          ULONG              cbSize;
          ULONG              offNext;
          USHORT             cxDisplay;
          USHORT             cyDisplay;
          BITMAPFILEHEADER2  bfh2;
    } BITMAPARRAYFILEHEADER2;
    typedef BITMAPARRAYFILEHEADER2 *PBITMAPARRAYFILEHEADER2;
    
    The fields in BITMAPARRAYFILEHEADER and BITMAPARRAYFILEHEADER2 have
    these meanings:
    
    usType                   Type of structure. This is:
    
                             BFT_BITMAPARRAY (X'4142'--`BA'for
                             BITMAPARRAYFILEHEADER or
                             BITMAPARRAYFILEHEADER2)
    
    cbSize                   Size of the BITMAPARRAYFILEHEADER or
                             BITMAPARRAYFILEHEADER2 structure in bytes.
    
    offNext                  Offset of the next BITMAPARRAYFILEHEADER
                             or BITMAPARRAYFILEHEADER2 structure from
                             the start of the file
    
    cxDisplay, CyDisplay     Pel dimensions of the device for which
                             this version is intended (for example,
                             640 x 480 for VGA).
    
    The device-independent version must be the first
    BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 defined.
    
    In the single-size format, the BITMAPARRAYFILEHEADER or
    BITMAPARRAYFILEHEADER2 structure is not present. The definition
    consists of one or two BITMAPFILEHEADER or BITMAPFILEHEADER2
    structures.
    
    The format of the BITMAPFILEHEADER and BITMAPFILEHEADER2 structure
    is:
    
    typedef struct _BITMAPFILEHEADER {          /* bfh */
    
          USHORT             usType;
          ULONG              cbSize;
          SHORT              xHotspot;
          SHORT              yHotspot;
          ULONG              offBits;
          BITMAPINFOHEADER   bmp;
    } BITMAPFILEHEADER;
    typedef BITMAPFILEHEADER *PBITMAPFILEHEADER;
    
    typedef struct _BITMAPFILEHEADER2           /* bfh2 */
    
          USHORT             usType;
          ULONG              cbSize;
          SHORT              xHotspot;
          SHORT              yHotspot;
          ULONG              offBits;
          BITMAPINFOHEADER2  bmp2;
    } BITMAPFILEHEADER2;
    typedef BITMAPFILEHEADER2 *PBITMAPFILEHEADER2;
    
    BITMAPINFOHEADER2 is a standard data type (see above, and also
    BITMAPINFOHEADER2).
    
    The fields in BITMAPFILEHEADER and BITMAPFILEHEADER2 have these
    meanings:
    
    usType              Type of resource the file contains. The valid
                        values are:
    
                        BFT_BMAP (X'4D42'--`BM' for bit maps)
                        BFT_ICON (X'4349'--`IC' for icons)
                        BFT_POINTER (X'5450'--`PT' for pointers).
                        BFT_COLORICON (X'4943'--`CI' for color icons).
                        BFT_COLORPOINTER (X'5043'--`CP' for color
                        pointers).
    
    cbSize              Size of the BITMAPFILEHEADER or
                        BITMAPFILEHEADER2 structure in bytes.
    
    xHotspot, yHotspot  Coordinates of the hotspot for icons and
                        pointers. This field is ignored for bit maps.
    
    offBits             Offset in bytes to the beginning of the bit-map
                        pel data in the file, from the start of the
                        definition.
    
    For icons and pointers, the cy field in bmp is actually twice the
    pel height of the image that appears on the screen. This is because
    these types actually contain two full bit-map pel definitions. The
    first bit-map definition is the XOR mask, which contains invert
    information (0 = no invert, 1 = invert) for the pointer or icon.
    The second is the AND mask, which determines whether the pointer
    or the screen is shown (0 = black/white, 1 = screen/inverse
    screen).
    
    For color icons or pointers, there are two bit-maps involved: one
    that is black and white and consists of an AND and an XOR mask,
    and one that is color that defines the color content.
    
    The cy field in the BITMAPINFOHEADER2 structure for the color
    bit-map must be the real height, that is, half the value specified
    for the black and white bit-map. The cx fields must be the same.
    
    The following table shows how these two bit-maps are used for a
    color icon or pointer:
    
         XOR     AND     COLOR
          1       1        x         Invert screen
          0       0        x         Use color x
          0       1        x         Transparency
          1       0        x         Use color x
    
    For color icons or pointers, two BITMAPFILEHEADER or
    BITMAPFILEHEADER2 structures are therefore required:
    
    BITMAPFILEHEADER2     with ustype BFT_COLORICON or BFT-COLORPOINTER
       BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
       Color table
    BITMAPFILEHEADER2     with same ustype
       BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
       Color table
    **
    bits for one bit-map
    **
    **
    bits for other bit-map
    **
    
    The ustype for the first BITMAPFILEHEADER2 is either BFT_COLORICON
    or BFT_COLORPOINTER. This means that a second BITMAPFILEHEADER2 is
    present as part of the definition of a color icon or pointer. The
    first BITMAPFILEHEADER2 structure contains the information for the
    black and white AND and XOR masks, while the second
    BITMAPFILEHEADER2 structure contains the information for the color
    part of the pointer or icon.
    
    BITMAPFILEHEADER and BITMAPINFOHEADER can occur in place of
    BITMAPFILEHEADER2 and BITMAPINFOHEADER2 in this example.
    
    For the multiple version format, the file is as follows:
    
    BITMAPARRAYFILEHEADER2    for device-independent version
       BITMAPFILEHEADER2      (part of BITMAPARRAYFILEHEADER2)
          BITMAPINFOHEADER2   (part of BITMAPFILEHEADER2)
          Color table
    
        BITMAPFILEHEADER2     )
           BITMAPINFOHEADER2  ) only if this is a color icon or pointer
           Color table        )
    
    BITMAPARRAYFILEHEADER2    for first device-dependent version
       BITMAPFILEHEADER2      (part of BITMAPARRAYFILEHEADER2)
          BITMAPINFOHEADER2   (part of BITMAPFILEHEADER2)
          Color table
    
        BITMAPFILEHEADER2     )
           BITMAPINFOHEADER2  ) only if this is a color icon or pointer
           Color table        )
    
    
    Further BITMAPARRAYFILEHEADER2 groups occur here as required for
    additional device-dependent versions
    
    **
    bits for one bit-map
    **
    **
    bits for next bit-map
    **
    
    And so on for as many bit-maps as necessary.
    
    As before, BITMAPARRAYFILEHEADER, BITMAPFILEHEADER and
    BITMAPINFOHEADER can occur in place of BITMAPARRAYFILEHEADER2,
    BITMAPFILEHEADER2 and BITMAPINFOHEADER2.
    
    
    Appendix F. The Font-File Format
    
    The OS/2 font-file format consists of two sections. The first
    section contains the general attributes of the font, and describes
    features such as its typeface, style, and nominal size. The second
    section contains the actual definitions of the characters belonging
    to the font.
    
    The font resource is a set of self-defining records of the form:
    typedef struct _RECORD {
          ULONG     ulIdentity;        /* structure identity code */
          ULONG     ulsize;            /* structure size in bytes */
            .                          /*  data */
            .
            .
          } RECORD;
    
    A font starts with a special font-signature structure and ends with
    an ending structure. The font signature has the form:
    
    typedef struct _FONTSIGNATURE
            ULONG  ulIdentity;
            ULONG  ulSize;
            CHAR   achSignature [12]
            } FONTSIGNATURE;
    
    where:
    
    ulIdentity     = X'FFFFFFFE'
    ulSize         = 20
    achSignature   = "OS/2 FONT"   for an OS/2 1.x format font, or
                   = "OS/2 FONT 2" for an OS/2 2.0 format font.
    
    A 2.0 format font includes additional font description information
    in the PANOSE structure. This structure will be added to the end
    of the .FNT file (prior to the ENDFONT record).
    
    The font end structure has the form:
    
    typedef struct _ENDFONT{
            ULONG   ulIdentity;
            ULONG   ulSize;
            }ENDFONT
    
    where:
    
    ulIdentity    = X'FFFFFFFFI
    ulSize        = 8
    
    All records should be in the order of their identity fields.
    
    There are three or four records in a font resource between the font
    signature and the font end:
    
      *  The font metrics
      *  The font character definitions
      *  The pair kerning table.
      *  The PANOSE description (for "OS/2 FONT 2" fonts).
    
    Following compilation, the records in the resource are in the order
    defined above.
    
    
    Metric Information Contained in Fonts
    
    This section gives an explanation of how to set the fields of the
    FOCAMETRICS structure when developing:
    
      *  A bit map or outline font for general use by PM graphics
         applications
    
      *  A description of a bit map or outline device font that is
         built in to a device or can be downloaded to a device.
    
    The following structure contains the physical font metrics used
    when creating fonts. It is defined in the file \INCLUDE\PMFONT.H.
    
    typedef struct _FOCAMETRICS {
         ULONG          ulIdentity;
         ULONG          ulSize;
         CHAR           szFamilyname[321;
         CHAR           szFacename[321;
         SHORT          usRegistryId;
         SHORT          usCodePage;
         SHORT          yEmHeight;
         SHORT          yXHeight;
         SHORT          yMaxAscender;
         SHORT          yMaxDescender;
         SHORT          yLowerCaseAscent;
         SHORT          yLowerCaseDescent;
         SHORT          yInternalLeading;
         SHORT          yExternalLeading;
         SHORT          xAveCharWidth;
         SHORT          xMaxCharInc;
         SHORT          xEmInc;
         SHORT          yMaxBaselineExt;
         SHORT          sCharSlope;
         SHORT          sInlineDir;
         SHORT          sCharRot;
         USHORT         usWeightClass;
         USHORT         usWidthClass;
         SHORT          xDeviceRes;
         SHORT          yDeviceRes;
         SHORT          usFirstChar;
         SHORT          usLastChar;
         SHORT          usDefauItChar;
         SHORT          usBreakChar;
         SHORT          usNominalPointSize;
         SHORT          usMinimumPointSize;
         SHORT          usMaximumPointSize;
         SHORT          fsTypeFlags;
         SHORT          fsdefn;
         SHORT          fsSelectionFlags;
         SHORT          fscapabilities;
         SHORT          ySubscriptXSize;
         SHORT          ySubscriptYSize;
         SHORT          ySubscriptXOffset;
         SHORT          ySubscriptYOffset;
         SHORT          ySuperscriptXSize;
         SHORT          ySuperscriptYSize;
         SHORT          ySuperscriptXOffset;
         SHORT          ySuperscriptYOffset;
         SHORT          yUnderscoreSize;
         SHORT          yUnderscorePosition;
         SHORT          yStrikeoutSize;
         SHORT          yStrikeoutPosition;
         SHORT          usKerningPairs;
         SHORT          sFamilyClass;
         PSZ            pszDeviceNameOffset;
      }  FOCAMETRICS;
    
    Note:  FOCAMETRICS is a parallel structure with FONTMETRICS as
           returned to applications in the GpiQueryFonts and
           GpiQueryFontMetrics function calls.
    
    The FONTMETRICS fields are derived from FOCAMETRICS by the
    Presentation Manager graphics engine. Most values are passed though
    unchanged. The exceptions are:
    
      *  The identity field. This must be 1. This field is not a part
         of the FONTMETRICS structure.
    
      *  The Size field. This must be set to the size of the
         FOCAMETRICS structure. This field is not a part of the
         FONTMETRICS structure.
    
      *  The Codepage field. Ignore the description in FONTMETRICS,
         and use the following:
    
             Place 850 in this field if the font is intended to
             support any PM supported code page. The list of
             Presentation Manager supported code pages is given in
             Chapter 34, "Code Pages" on page 34-1.
    
             Place 65400 in this field if the font has special glyphs,
             for example if it is a Symbol font.
    
             Place other valid code pages in this field if the font is
             specific to this code page. Do not place other values in
             this field.
    
         * FONTMETRICS fields which contain values in world
           coordinates. The corresponding field in FOCAMETRICS should
           contain pel values for bit-map fonts, and notional units for
           outline fonts.
    
    See FONTMETRICS on page A-56 for a detailed explanation of the
    fields.
    
    
    Font Character Definitions
    
    Two formats of font character definition are supported. These are:
    
    Image format
         The character glyphs are represented as pel images.
    
    Outline format
         The character glyphs are represented by vector data that
         traces the outline of the character.
    
         Note: Intelligent Font Technology fonts (such as ATM Type-1
         fonts) may be stored in a technology specific format, and thus
         will not conform to this definition for outline fonts.
    
    The definition consists of a header portion and a portion carrying
    the characters themselves.
    
    The header portion contains information about the format of the
    character definitions and data about each character including width
    data and the offset into the definition section at which the
    character definition begins. (See "a-space, b-space, c-space" on
    page F-13.)
    
      1. Proportional characters (a + b+ c = character increment) for
         each character:
         a,b,c ***> 0
    
      2. Characters where a, b, and c are definitions for all
         characters:
    
         b ***> 0
         a, c any integer
    
    Raster fonts contain a "null character." The character definition
    record for this occurs after the one for the last character. Thus
    the format has usLastChar + 2 characters, although the null
    character is not counted in the range returned. The null character
    is composed of zeros and is always eight pels wide.
    
    
    Font Definition Header
    
    This structure defines the format or the character definition
    records that follow it:
    
        typedef struct_FONTDEFINITIONHEADER {
         ULONG     ulIdentity;
         ULONG     ulSize;
         SHORT     fsfontdef;
         SHORT     fschardef;
         SHORT     usCellSize;
         SHORT     xCellWidth;
         SHORT     yCellHeight;
         SHORT     xCellIncrement;
         SHORT     xCellA;
         SHORT     xCellB;
         SHORT     xCellC;
         SHORT     pCellBaseOffset;
         } FONTDEFINITIONHEADER;
    typedef FONTDEFINITIONHEADER FAR *PFONTDEFINITIONHEADER;
    
    ulIdentity       4 bytes.
    
                     Must be equal to 2.
    
    ulSize           4 bytes.
    
                     Size of this structure in bytes.
    
    fsFontdef        2 bytes of flags.
    
                     Indicates which fields are present in the font
                     definition data in the header.
    
                     Type 1
    
                     Bit 0     1 = width defined in header
                     Bit 1     1 = height defined in header
                     Bit 2     1 = char increment same as width, so
                               that it is defined for the whole font
                     Bit 3     0 = a-space not defined
                     Bit 4     0 = b-space not defined
                     Bit 5     0 = c-space not defined
                     Bit 6     1 = base offset same for all characters.
    
                     Type 2
    
                     Bit 0     0 = width for each character unique
                     Bit 1     1 = height defined in header
                     Bit 2     0 = char increment same as width, so
                               that it is unique for each character
                     Bit 3     0 = a-space not defined
                     Bit 4     0 = b-space not defined
                     Bit 5     0 = c-space not defined
                     Bit 6     1 = base offset same for all characters.
    
                     Type 3
    
                     Bit 0     0 = width for each character unique
                     Bit 1     1 = height defined in header
                     Bit 2     0 = char increment same as width, so
                               that it is unique
                     Bit 3     0 = a-space not defined
                     Bit 4     0 = b-space not defined
                     Bit 5     0 = c-space not defined
                     Bit 6     1 = base offset same for all characters.
    
    FaChardef        2 bytes of flags.
                     Indicates which fields are present on a per
                     character basis.
    
                     Type 1
    
                     Bit 0     1 = width defined for each character
                               (performance op)
                     Bit 1     0 = height is in header
                     Bit 2     0 = char increment is in header
                     Bit 3     0 = a-space not defined
                     Bit 4     0 = b-space not defined
                     Bit 5     0 = c-space not defined
                     Bit 6     0 = base offset defined in header
                     Bit 7     1 = offset to glyph defined.
    
                     Type 2
    
                     Bit 0     1 = width defined for each character
                     Bit 1     0 = height is in header
                     Bit 2     0 = char increment same as width
                     Bit 3     0 = a-space not defined
                     Bit 4     0 = b-space not defined
                     Bit 5     0 = c-space not defined
                     Bit 6     0 = base offset defined in header
                     Bit 7     1 = offset to glyph defined.
    
                     Type 3
    
                     Bit 0     1 = width not defined, use a, b, c
                     Bit 1     0 = height is in header
                     Bit 2     0 = char increment same as width
                     Bit 3     1 = a-space defined
                     Bit 4     1 = b-space defined
                     Bit 5     1 = c-space defined
                     Bit 6     0 = base offset defined in header
                     Bit 7     1 = offset to glyph defined.
    
    usCellSize       2-byte integer.
    
                     Indicates the length in bytes of each character
                     definition record (the per character data).
    
                     Type 1    6 bytes
                     Type 2    6 bytes
                     Type 3    10 bytes.
    
    xCellWidth       2-byte integer
    
                     The width of the characters, in pels for image
                     fonts, and relative units for outline fonts.
    
                     Type 1    Width of the characters
                     Type 2    Zero
                     Type 3    Zero.
    
    yCellHeight      2-byte integer.
    
                     The height of the characters, in pels for image
                     fonts, and relative units for outline fonts.
    
                     Type 1    Height of the characters
                     Type 2    Height of the characters
                     Type 3    Height of the characters.
    
    xCellincrement   2-byte integer.
    
                     The distance along the character baseline required
                     to step from one character to the next (when
                     forming a character string).
    
                     Type 1    Width of the characters
                     Type 2    Zero
                     Type 3    Zero.
    
    xCellA           2-byte signed integer.
    
                     The width of the space before a character in the
                     inline direction (the a-space).
    
                     Type 1    Zero
                     Type 2    Zero
                     Type 3    a-space for all characters.
    
    xCellB           2-byte integer.
    
                     The width of a character (inline direction). The
                     b-space.
    
                     Type 1    Zero
                     Type 2    Zero
                     Type 3    b-space for all characters.
    
    xcellc           2-byte signed integer.
    
                     The width of the space after a character in the
                     inline direction (the c-space).
    
                     Type 1    Zero
                     Type 2    Zero
                     Type 3    c-space for all characters.
    
    pCellBaseOffset  2-byte signed integer.
    
                     The position of the top of a character definition
                     relative to the baseline in the direction
                     perpendicular to the baseline.
    
                     Type 1  Baseline offset for all characters
                     Type 2  Baseline offset for all characters
                     Type 3  Baseline offset for all characters.
    
    Character Definition Record
                     xCellSize bytes per record.
    
                     The following fields may or may not be present,
                     according to the font character definition fields
                     flags. if a field is present, it is present for
                     each character and the value applies to that
                     character only.
    
                     There are usLastChar+2 such records for raster
                     fonts. The final one is for the null character.
    
                      * Character Definition Offset: 4-byte integer.
    
                        The offset into the Font File at which the
                        character definition begins.
    
                        Data for a single character raster or vector
                        should not span two segments; that is, if a
                        character is too big to fit into a segment it
                        should be put in the next segment.
    
                        This field should be set to zero if the
                        character being defined is a blank character.
    
                      * Character Cell Width: 2-byte integer.
    
                        The width of the character definition in pels.
    
                      * Character Cell Height: 2-byte integer.
    
                        The height of the character definition in pels.
    
                      * Character Increment: 2-byte integer.
    
                        The length along the character baseline
                        required to step from this character to the
                        next (when forming a character string).
    
                      * Character a-space: 2-byte signed integer.
    
                        The width of the space before the character in
                        the inline direction.
    
                      * Character b-space: 2-byte integer.
    
                        The width of the character shape (inline
                        direction).
    
                      * Character c-space: 2-byte signed integer.
    
                        The width of the space after the character in
                        the inline direction.
    
                      * Character Baseline Offset: 2-byte signed
                        integer.
    
                        The position of the top of a character
                        definition relative to the baseline in the
                        direction perpendicular to the baseline.
    
         Note: Type 1 fonts have offset/width pairs (like type 2);
         however, the usCellSize and xCellIncrement are nonzero. In
         the fstype field of the font metrics, the proportional-space
         flag, bit 0, is set.
    
    Image Data Format
      The bits for each character are stored separately, and start on
      a byte boundary. Sequential bytes represent vertical pieces of
      the character image. For example, a 15-bit-wide H is stored as
      follows:
    
    byte                    byte
     1   00000000.0000000-.  13
     2   01100000 0000110-   14
     3   01100000 0000110-   15
     4   01100000 0000110-   16
     5   01100000 0000110-   17
     6   01111111 1111110-   18
     7   01111111 1111110-   19
     8   01100000 0000110-   20
     9   01100000 0000110-   21
    10   01100000 0000110-   22
    11   01100000 0000110-   23
    12   00000000.0000000-.  24
    
    Bytes 1 through 12 are composed of whole bytes of data stored row
    by row.
    
    Bytes 13 through 24 are composed of bytes stored row by row, where
    each byte contains 7 bits of information and the last bit is
    unused.
    
    Thus the character is laid down in byte-wide columns.
    
    Notes:
    
    1. There is always an additional (null) character defined in an
       image Font (defined at character position LastChar + 2) which
       is 8 bits wide, the height of the font character, and set to all
       zeros.
    
    2. The maximum size of each individual Image Font must not exceed
       64KB.
    
    
    The Kerning Pair Table
    
    The kerning pair table record is not present if the _KerningPairs
    record in the metrics is zero. If it is present, the code points
    are words, not bytes. This table should be sorted by kpChar1 and
    kpChar2 order to allow binary searches.
    
    typedef struct_KERNPAIRTABLE
            ULONG     ulIdentity;
            ULONG     ulSize;
            CHAR      cFirstpair;
    }KERNPAIRTABLE;
    
    typedef struct _KERNPAIRS
            SHORT  sFirstChar;
            SHORT  sSecondChar;
            SHORT  sKerningAmount;
    }KERNINGPAIRS;
    
    where:
    
      ulIdentity      = 3
      ulSize          = 10
      sFirstChar      = First character of the kerning pair
      sSecondChar     = Second character of the kerning pair
      sKerningAmount  = Kerning value. Positive values increase the
                        inter-character spacing while negative values
                        bring the characters closer together.
    
    Outline Data Format
      Fonts defined by outlines (vectors) may contain any of these
      graphics orders:
    
       * Line at given position (GLINE)
       * Line at current position (GCLINE)
       * Relative line at given position (GRLINE)
       * Relative line at current position (GCRLINE)
       * Fillet at given position (GFLT)
       * Fillet at current position (GCFLT)
       * Sharp fillet at given position (GSFLT)
       * Sharp fillet at current position (GCSFLT)
       * B�zier curve at given position (GBEZ)
       * B�zier curve at current position (GCBEZ)
       * No operation (GNOPL)
       * Comment (GCOMT)
       * End of symbol definition (GESD).
    
    The maximum length of the data in these orders is 255 bytes. The
    drawing order code and the length fields are not included in the
    length count.
    
    The size of each outline font definition must not be longer than
    64KB.
    
    
    The Additional Metrics
    
    The additional metrics structure extends the metrics describing the
    font to include the PANOSE fields. The fields allow for
    quantitative descriptions of the visual properties of font faces.
    The format of the ADDITIONALMETRICS structure is:
    
      typedef struct {
            ULONG       ulIdentity;
            ULONG       ulSize;
            PANOSE      panose;
      } ADDITIONALMETRICS;
    
      where:
    
        ulIdentity      = 4
        ulSize          = 20
        panose          = The ten digit PANOSE number with two bytes
                          of padding.
    
    The PANOSE definition consists of ten digits, each of which
    describes one of up to sixteen variations. The current digits are:
    
    1. Family Kind (6 variations)
    
       0     = Any
       1     = No Fit
       2     = Text and Display
       3     = Script
       4     = Decorative
       5     = Pictorial
    
    2. Serif Style (16 variations)
    
       0     = Any
       1     = No Fit
       2     = Cove
       3     = Obtuse Cove
       4     = Square Cove
       5     = Obtuse Square Cove
       6     = Square
       7     = Thin
       8     = Bone
       9     = Exaggerated
       10    = Triangle
       11    = Normal Sans
       12    = Obtuse Sans
       13    = Perp Sans
       14    = Flared
       15    = Rounded
    
    3. Weight (12 variations)
    
       0     = Any
       1     = No Fit
       2     = Very Light
       3     = Light
       4     = Thin
       5     = Book
       6     = Medium
       7     = Demi
       8     = Bold
       9     = Heavy
       10    = Black
       11    = Nord
    
    4. Proportion (10 variations)
    
       0     = Any
       1     = No Fit
       2     = Old Style
       3     = Modern
       4     = Even Width
       5     = Expanded
       6     = Condensed
       7     = Very Expanded
       8     = Very Condensed
       9     = Monospaced
    
    5. Contrast (10 variations)
    
       0     = Any
       1     = No Fit
       2     = None
       3     = Very Low
       4     = Low
       5     = Medium Low
       6     = Medium
       7     = Medium High
       8     = High
       9     = Very High
    
    6. Stroke Variation (9 variations)
    
       1     = Any
       2     = No Fit
       3     = Gradual/Diagonal
       4     = Gradual/Transitional
       5     = Gradual/Vertical
       6     = Gradual/Horizontal
       7     = Rapid/Vertical
       8     = Rapid/Horizontal
       9     = Instant/Vertical
    
    7. Arm Style (12 variations)
    
       0     = Any
       1     = No Fit
       2     = Straight Arms/Horizontal
       3     = Straight Arms/Wedge
       4     = Straight Arms/Vertical
       5     = Straight Arms/Single Serif
       6     = Straight Arms/Double Serif
       7     = Non-Straight Arms/Horizontal
       8     = Non-Straight Arms/Wedge
       9     = Non-Straight Arms/Vertical
       10    = Non-Straight Arms/Single Serif
       11    = Non-Straight Arms/Double Serif
    
    8. Letterform (16 variations)
    
       0     = Any
       1     = No Fit
       2     = Normal/Contact
       3     = Normal/Weighted
       4     = Normal/Boxed
       5     = Normal/Flattened
       6     = Normal/Rounded
       7     = Normal/Off Center
       8     = Normal/Square
       9     = Oblique/Contact
       10    = Oblique/Weighted
       11    = Oblique/Boxed
       12    = Oblique/Flattened
       13    = Oblique/Rounded
       14    = Oblique/Off Center
       15    = Oblique/Square
    
    9. Midline (14 variations)
    
       0     = Any
       1     = No Fit
       2     = Standard/Trimmed
       3     = Standard/Pointed
       4     = Standard/Serifed
       5     = High/Trimmed
       6     = High/Pointed
       7     = High/Serifed
       8     = Constant/Trimmed
       9     = Constant/Pointed
       10    = Constant/Serifed
       11    = Low/Trimmed
       12    = Low/Pointed
       13    = Low/Serifed
    
    10. X-height (8 variations)
    
        0    = Any
        1    = No Fit
        2    = Constant/Small
        3    = Constant/Standard
        4    = Constant/Large
        5    = Ducking/Small
        6    = Ducking/Standard
        7    = Ducking/Large
    
    When using the PANOSE number to match fonts, the ordering of the
    PANOSE digit is the key to finding the closest match. The most
    significant digit is the first digit, and the least significant
    digit is number ten. To find matches, the digits need to be
    compared, in the order given. A font mapper may want to change the
    precedence of the digits, to give higher weightings to other font
    features.
    
    
    Font Directory
    
    This section describes the directory section of a font resource.
    A font resource contains a directory consisting of a set of
    structures each containing the metrics of a font and a pointer to
    the font itself This font directory is generated by the resource
    compiler.
    
    The format of the font directory is:
    
    typedef struct (
       USHORT      usHeaderSize;
       USHORT      usnFonts;
       USHORT      usiMETRICS;
       FONTENTRY   fntEntry[1];
    } FONTDIRECTORY;
    
    typedef struct {
       USHORT          usIndex;
       FONTFILEMETRICS metrics;
    } FONTENTRY;
    
    Where:
    
    usHeaderSize     The size of the header, in bytes.
    
    usnFonts         The number of fonts in the resource.
    
    usiMetrics       The size of the FOCAMETRICS structures that follow
                     the header. Note that the set of metrics for all
                     the fonts in the resource follow the header.
    
    usindex          The index of a particular font; an identifier
                     assigned to the font when the resource was created
                     (defined in the RC file).
    
    metrics          The font metrics structure for the font. This is
                     identical to a FOCAMETRICS structure with the
                     addition of the PANOSE fields to the end.
    
    Definitions of Terms Used When Describing Fonts
    
    a-space, b-space, c-space
    The a-space is the distance from the left of the character frame
    to the left edge of the character. The b-space is the width of the
    character. The c-space is the distance from the right edge of the
    character to the right of the character frame. Negative values of
    a and c allow adjacent character frames to overlap. See also
    character increment, and space default values.
    
    average char width
    The average horizontal distance from the left edge of one character
    to the left edge of the next. Contrast with max char increment.
    
    baseline
    The line on which the bottom of a character rests, and below which
    a descender extends.
    
    break char cade point
    The code point of the space or break character. Contrast with
    default char code point, first char code point, and last char code
    point.
    
    character increment
    A set.of three values (a-space, b-space, and c-space) that define
    the proportions of a character. The sum of the three values (a+b+c)
    specifies only one value for the entire character increment.
    See also font width and space default values.
    
    character rotation
    The angle by which each character is rotated around its own center,
    increasing clockwise from vertical. Contrast with character slope
    and inline direction.
    
    character slope
    The angle by which a character is slanted, increasing clockwise
    from vertical. Contrast with character rotation and inline
    direction.
    
    default char code point
    The code point of the character to be used if a code point outside
    the range of a font is passed to an application using that font.
    Contrast with break char code point, first char code point, and
    last char code point.
    
    em height
    The maximum distance above the baseline reached by an uppercase
    symbol. Contrast with x height.
    
    external leading
    The vertical distance from the bottom of one character to the top
    of the character below it. Contrast with internal leading and max
    baseline extent.
    
    first char code point
    The code point of the first character. All numbers between the
    first char code point and the last char code point must represent
    a character in the font. Contrast with break char code point,
    default char code point, and last char code point.
    
    fixed spacing
    The same amount of space separates each character. Contrast with
    proportional spacing.
    
    font weight
    The line-thickness of a character relative to its size. Contrast
    with font width.
    
    font width
    The relative width of a character to its height; condensed fonts
    are very narrow while expanded fonts are very wide. See also
    character increment. Contrast with font weight.
    
    Inline direction
    The angle of a line of type, increasing clockwise from horizontal.
    Contrast with character rotation and character slope.
    
    Internal leading
    The vertical distance from the top or bottom of a character to any
    accent marks that may appear with it. Contrast with external
    leading.
    
    last char code point
    The code point of the last character. All numbers between the first
    char code point and the last char code point must represent a
    character in the font. Contrast with break char code point, default
    char code point, and first char code point.
    
    lowercase ascent
    The maximum distance above the baseline reached by any part of any
    lowercase character. Contrast with maximum ascender and x height.
    
    lowercase descent
    The maximum distance below the baseline reached by any part of any
    lowercase character. Contrast with maximum descender.
    
    max baseline extent
    The maximum space occupied by the font (typically, the sum of the
    maximum ascender and maximum descender). Contrast with external
    leading and max char increment.
    
    max char increment
    The maximum horizontal distance from the left edge of one character
    to the left edge of the next character to the right. Contrast with
    average char width and max baseline extent.
    
    maximum ascender
    The maximum distance that any part of any character may extend
    above the x height of a font. Contrast with lowercase ascent and
    maximum descender.
    
    maximum descender
    The maximum distance that any part of any character may extend
    below the x height of a font. Contrast with lowercase descent and
    maximum ascender.
    
    maximum vert point size
    The maximum vertical dimensions to which a font can be resized.
    Contrast with minimum vert point size and nominal vert point size.
    
    minimum vert point size
    The minimum vertical dimensions to which a font can be resized.
    Contrast with maximum vert point size and nominal vert point size.
    
    nominal vert point size
    The normal display size of a font. Contrast with maximum vert point
    size and minimum vert point size.
    
    pel
    The smallest element of a display surface that can be independently
    assigned color and density.
    
    point
    Printer's unit of measurement. There are 72 points to an inch
    (approximately 3.5 points to a millimeter).
    
    proportional spacing
    The space that each character occupies is in proportion to its
    width. See also font width, Contrast with fixed spacing.
    
    Registry ID
    A code number that Presentation Manager uses to register a font
    file as a resource.
    
    space default values
    Values that specify the space to be left between characters. Once
    defined, they are used for the entire font, and do not have to be
    specified for each character. However, they can be changed for
    characters that require more or less spacing than the defaults
    provide, by giving values for the a Space and the c Space. See also
    character increment.
    
    strikeout position
    The distance of the strikeout character above the baseline (in
    pels). See also strikeout size and underscore position.
    
    strikeout size
    The size of the strikeout character (in points). See also strikeout
    position and underscore size.
    
    subscript position
    The distance of a subscript character of a font below the baseline
    (in pels). See also subscript size and superscript position.
    
    subscript size
    The size of a subscript character (in points). See also subscript
    position and superscript size.
    
    superscript position
    The distance of a superscript character above the baseline (in
    pels). See also subscript position and superscript size.
    
    superscript size
    The size of a superscript character (in points). See also subscript
    size and superscript position.
    
    target dev resolution X
    The number of pels per inch in the horizontal axis of a display
    device on which a font is to be displayed. Contrast with target dev
    resolution Y.
    
    target dev resolution Y
    The number of pels per inch in the vertical axis of a display
    device on which a font is to be displayed. Contrast with target dev
    resolution X.
    
    underscore position
    The distance in pels of the first underscore stroke from the
    baseline of a font. Successive strokes below this create a heavier
    underscore. See also strikeout position and underscore size.
    
    underscore size
    The size of the underscore character measured in single strikeout
    strokes. See also strikeout size and underscore position.
    
    x height
    The maximum distance above the baseline reached by a lowercase
    character. Contrast with em height and lowercase ascent.
    
    
    Appendix G. Format of Interchange Files
    
    A metafile is a file in which graphics are stored. The file is
    application-created, and it contains the graphics orders generated
    from those GPI calls that are valid in a metafile. Metafiled
    graphics can be reused by the application that created them. They
    can also be made available to other applications at the same, or
    at a different, workstation.
    
    This chapter describes the restrictions which apply when generating
    the metafile and gives detail of the overall structure. For the
    graphics orders descriptions, see Chapter 33, "Graphics Orders" on
    page 33-1.
    
    
    Metafile Restrictions
    
    The following restrictions apply to the generation of all
    metafiles, and also to the generation of a PM_Q-STD print file to
    a OD_QUEUED device:
    
      *  If GpiWCBitBit or GpiBitBit is used to copy a bit map to a
         device context in an application, the application should not
         delete that bit map handle with GpiDeleteBitmap before the
         device context is closed (metafile is closed).
    
      *  GpiSetPS must not be used.
    
      *  GpiSetPageViewport is ignored.
    
    The following section lists some general rules that must be
    followed when creating a metafile that is to be acceptable to
    SAA-conforming implementations, or replayed into a presentation
    space that is in draw-and-retain or retain mode (see
    GpiSetDrawingMode).
    
     *  These items must be established or defaulted before any drawing
        occurs to the graphics presentation space, and not changed
        subsequently:
    
        --  The graphics field (GpiSetGraphicsField). For an
            SAA-conforming metafile, the graphics field must be
            defaulted or set to no clipping.
        --  The code page for the default character set (GpiSetCp).
        --  The color table or palette (GpiCreateLogColorTable or
            GpiCreatePalette). The size of the color table must not
            exceed 31 KB (KB equals 1024 bytes).
        --  The default viewing transform (GpiSetDefaultViewMatrix).
        --  The setting of the draw controls (GpiSetDrawControl).
            DCTL-DISPLAY must be defaulted or set ON.
        --  The default values of attributes (see GpiSetDefAttrs),
            viewing limits (see GpiSetDefViewingLimits), primitive tag
            (see GpiSetDefrag) and arc parameters (see
            GpiSetDefArcParams).
    
     *  These calls should not be used:
    
        --  GpiBitBit
        --  GpiDeleteSetId (note that this means that local identifiers
            cannot be used again within the picture)
        --  GpiErase
        --  GpiExcludeClipRectangle
        --  GpilntersectClipRectangle
        --  GpiOffsetClipRegion
        --  GpiPaintRegion
        --  GpiResetPS
        --  GpiSetClipRegion
        --  GpiSetPel
        --  GpiSetPS
        --  DevEscape (for an escape which is metafiled).
    
     *  GpiCreateLogFont must not redefine a local identifier that has
        previously been used within the picture.
    
     *  The metafile context must not be reassociated.
    
     *  If a bit map is used as the source of a GpiWCBitBit operation,
        or as an area-fill pattern, it must not be modified or deleted
        (GpiDeleteBitmap) before the metafile is closed.
    
     *  Only these foreground mixes must be used (see GpiSetMix):
    
        --FM_DEFAULT
        --FM_OR
        --FM_OVERPAINT
        --FM_LEAVEALONE.
    
     *  Only these background mixes must be used (see GpiSetBackMix):
    
        --BM_DEFAULT
        --BM_OVERPAINT
        --BM_LEAVEALONE.
    
     *  If palettes are used (see GpiCreatePalette), the palette that
        is metafiled is the one in force when the metafile device
        context is dissociated from the (final) presentation space. if
        the palette is changed during the course of the picture (using
        GpiSetPaletteEntries), it must therefore only be with
        incremental additions.
    
    Note: There is no restriction concerning the use of primitives
    outside segments. These are metafiled in segment(s) with zero
    identifier.
    
    
    Metafile Data Format
    
    This section describes the format of the data in a metafile, as it
    would be stored in an OS/2 Version 2.0 disk file.
    
    Metafile data is stored as a sequence of structured fields. Each
    structured field starts with an eight-byte header consisting of a
    two-byte length field and a three-byte identifier field. These are
    followed by a one-byte flags field and a two-byte segment sequence
    number field.
    
    The length field contains a count of the total number of bytes in
    the structured field, including the length field. The identifier
    field uniquely identifies the type of the structured field.
    
    The flags and segment sequence number fields are always zero.
    
    Following the header are positional parameters that are optional
    and dependent on the particular structured field.
    
    Following the positional parameters are non-positional parameters
    called triplets. These are self-defining parameters and consist of
    a one-byte length field, followed by a one-byte identifier field,
    followed by the data of the parameter.
    
    The length field contains a count of the total number of bytes in
    the triplet, including the length and identifier fields. The
    identifier field identifies uniquely the type of the triplet.
    
    A metafile is structured into a number of different functional
    components; for example, document and graphics object. Each
    component comprises a number of structured fields, and is delimited
    by "begin-component" and "end-component" structured fields.
    Structured fields marked as required, inside an optional structured
    field bracket, are required if the containing bracket is present.
    
    The graphics orders that describe a picture occur in the graphics
    data structured field. See page G-17.
    
    
    Structured Field Formats
    
    The format of the various structured fields is given below:
    
    Begin Document
    
    Structured Field Introducer (BDT): required
    0-1     Length X'n+1E'
    2-4     BDT X'D3A8AB'
    5       Flags X'00'
    6-7     Segment sequence number X'0000'
    
    Parameters
    0-7     Document name C'0000 0001'
    8       Architecture version X'00'
    9       Document security X'00'
    
    Triplets (all required)
    0       Length X'05'
    1       Triplet Id X'18'
    2       Interchange set type X'03' (resource document)
    3-4     Base set definition X'0C00' (level 12, version 0)
    
    0       Length X'06'
    1       Triplet Id X'01'
    2-5     GCID
    
    0       Length X'n+1'
    1       Triplet Id X'65'
    2-n     Comment, used for metafile description of up to 252 bytes.
    
    Begin Resource Group (BRG): required
    
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   BRG X'D3ABC6'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Resource group name    C'0000 0002'
    
    Begin Color Attribute (BCA) Table: required
    
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   BCA X'D3AB77'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Color table name C'0000 0004'
    
    Color Attribute Table (CAT) required
      Structured Field Introducer
      0-1   Length X'n+B'
      2-4   CAT X'D3BO77'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
    
      Base Part (required)
      0     Flags
            0   Reserved B'0'
            1   Reset
                B'0' Do not reset to default
                B'1' Do reset to default
            2-7 Reserved B'000000'
      1     Reserved X'00'
      2     LCTID X'00'
    
      Element list(s) (triple generating) are mutually-exclusive. One
      or other is required.
    
      Element List (repeating)
      0     Length of this parameter
      1     Type X'01': element list
      2     Flags X'00': reserved
      3     Format
            X'01' RGB
      4-6   Starting Index
            (Top Byte Truncated)
      7     Size of RGB component1 X'08'
      8     Size of RGB component2 X'08'
      9     Size of RGB component3 X'08'
      10    Number of bytes in each
            following color triple X'04'
      11-m  Color triples
    
    Triple Generating
      0     Length of this parameter X'OA'
      1     Type X'02': bit generator
      2     Flags
            0 ABFlag
             B'0' Normal
            1-7 Reserved B'0000000'
      3     Format
            X'01' RGB
      4-6   Starting index (top byte truncated)
      7     Size of RGB component1 X'08'
      8     Size of RGB component2 X'08'
      9     Size of RGB component3 X'08'
    
    End Color Attribute (ECA) Table: required
    
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   ECA X'D3A977'
      5     Flags '00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Color table name C'0000 0004'
    
    Begin Image Object (BIM): optional, repeating
    
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   BIM X'D3A8FB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Image name C'xxxx xxxx'
    
    Begin Resource Group (BRG): optional
    
        Structured Field Introducer
        0-1   Length X'9010'
        2-4   BRG X'D3A8C6'
        5     Flags X'00'
        6-7   Segment sequence number X'0000'
    
        Parameters
        0-7   Resource group name C'xxxx xxxx'
    
    Color Attribute Table (BCA): optional
    
          Structured Field Introducer
          0-1   Length X'0010'
          2-4   BCA X'D3A877'
          5     Flags X'00'
          6-7   Segment sequence number X'0000'
    
          Parameters
          0-7   Color table name C'xxxx xxxx'
    
    Color Attribute Table (CAT): required
    
            Structured Field Introducer
            0-1   Length
            2-4   CAT X'D3B077'
            5     Flags X'00'
            6-7   Segment sequence number X'0000'
    
            Parameters
    
            Base Part
            0     Flags X'00'
            1     Reserved X'00'
            2     LUTID
    
            Element List (repeating)
            0     Length of this parameter
            1     Type X'01': element list
            2     Flags X'00': reserved
            3     Format X'01': RGB
            4-6   Starting index
                  (top byte truncated)
            7     Size of RGB component1 X'08'
            8     Size of RGB component2 X'08'
            9     Size of RGB component3 X'08'
            10    Number of bytes in each following color triple X'03'
            11-n  Color triples
    
    End Color Attribute Table (ECA): required if BCA present
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   ECA X'D3A977'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Color Table name C'xxxx xxxx'
    
    End Resource Group (ERG): required if RG present
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   ERG X'D3A9C6'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7 Resource Group name C'xxxx xxxx'
    
    Begin Object Environment Group (BOG): optional
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   BOG X'D3A8C7'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Object environment group
            name C'xxxx xxxx'
    
    Map Color Attribute (MCA) Table: required
      Structured Field Introducer
      0-1   Length X'001A'
      2-4   MCA X'D3AB77'
      5     Flags '00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      9-1   Length
    
      Triplet (required)
      0     Length X'0C'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to
            Begin Resource Object X'84'
      3     ID X'00'
      4-11  Color table name C'xxxx xxxx'
    
      lcid (required)
      0     Length X'04'
      1     Triplet type:
            resource local ID X'24'
      2     Type color table resource X'07'
      3     Local identifier (LUT-ID) X'01'
    
    End Object Environment Group (EOG): required if BOG present
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   EOG X'D3A9C7'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Object Environment Group
            name C'xxxx xxxx'
    
    Image Data Descriptor (IDD): required
      Structured Field Introducer
      0-1   Length X'0011'
      2-4   IDD X'D3A6FB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0     Unit of measure:
            X'00' tens of inches
            X'01' tens of centimeters
      1-2   X resolution image points / UOM
      3-4   Y resolution image points / UOM
      5-6   X extent of image PS
      7-8   Y extent of image PS
    
    Image Picture Data (IPD): required
      Structured Field Introducer
      0-1   Length
      2-4   IPD XID3EEFB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters (all required and in this order, except that only one
      of image LUT-ID and IDE structure is present)
    
      Begin Segment
      0     Type X'70': begin segment
      1     Length of following X'00'
    
      Begin Image Content
      0     Type X'91': Begin Image Content
      1     Length of following X'01'
      2     Format X'FF'
    
      Image Size
      0     Type X'94': image size
      1     Length of following X'09'
      2     Units of measure X'02': logical
      3-4   Horizontal resolution
      5-6   Vertical resolution
      7-8   Height in pels
      9-10  Width in pels
    
      Image Encoding
      0     Type X'95': image encoding
      1     Length of following X'02'
      2     Compression algorithm X'03': none
      3     Recording algorithm X'03': bottom-to-top
    
      Image IDE-Size
      0     Type X'96': image IDE-Size
      1     Length of following X'0l'
      2     Number of bits per element
    
      Image LUT-ID
            (For bit maps with other than 24 bits per pel)
      0     Type X'97' Image LUT-ID
      1     Length of following X'Ol'
      2     LUT-ID
    
      IDE Structure
            (For bit maps with 24 bits per pel)
      0     Type X'9B': IDE structure
      1     Length of following X'08'
      2     Flags:
            0  ABFlag
               B'0' Normal (Additive)
            1-7 Reserved B'0000000'
      3     Format
            X'01' RGB
      4-6   Reserved X'000000'
      7     Size of element 1
      8     Size of element 2
      9     Size of element 3
    
    Image Picture Data (IPD): required, repeating
      Structured Field Introducer
      0-1   Length
      2-4   IPD X'D3EEFB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
    
      Image Data
      0-1   Type X'FE92': image data
      2-3   Length of following
      4-n   Image data (scan lines of bit maps)
    
      End Image Content
            (required, only present in last Image Picture Data)
      0     Type X'93': End Image Content
      1     Length of following X'00'
    
      End Segment
            (required, only present in last Image Picture Data)
      0     Type X'71': end segment
      1     Length of following X'00'
    
    End Image Object (EIM): required if BIM present
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   EIM X'D3A9FB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7 Image name C'xxxx xxxx'
    
    Begin Graphics Object (BGR): required
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   BGR X'D3A8BB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7   Graphics object name C'0000 0007'
    
    Begin Object Environment Group (BOG): optional
      Structured Field Introducer
      0-1   Length X'0016'
      2-4   BOG X'D3A8C7'
      5       Flags X'00'
      6-7     Segment sequence number X'0000'
    
      Parameters
      0-7 Object Environment Group
          name C'0000 0007'
    
    Map Color Attribute Table (MCA): required
      Structured Field Introducer
      0-1   Length X'0016'
      2-4   MCA X'D3AB77'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-1 Length
    
      Triplet (required)
      0     Length X'0C'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to
            Begin Resource Object X'84'
      3     ID    X'00'
      4-11  Color table name C'0000 0004'
    
    Map Coded Font (MCF): required, for default font
      Structured Field Introducer
      0-1   Length X'20'
      2-4   MCF X'D3AB8A'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-1   Length
    
      Triplets (required)
    
      Font name
      0     Length X'0C'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to coded font X'84'
      3     ID  X'00'
      4-11  Coded font name: C'nnxx xxxx'
            where n is X'FF'
    
      lcid
      0     Length X'04'
      1     Triplet type:
            Resource Local ID X'24'
      2     Type: Coded Font Resource X'05'
      3     Local identifier (LCID) X'00'
    
      Font Binary GCID
      0     Length X'06'
      1     Triplet type: Font Binary GCID X'20'
      2-5   GCID
    
    Map Coded Font (MCF): optional, repeating, for loaded fonts
      Structured Field Introducer
      0-1   Length X'58'
      2-4   MCF X'D3AB8A'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-1 Length
    
      Triplets (required)
    
      Font name
      0     Length X'0C'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to coded font X'84'
      3     ID X'00'
      4-11  Coded font name
    
      lcid
      0     Length X'04'
      1     Triplet type:
            Resource Local ID X'24'
      2     Type: coded font resource X'05'
      3     Local identifier (LCID)
    
      Font Attributes
      0     Length X'14'
      1     Triplet type:
            Font Descriptor X'IF'
      2     Weight Class
      3     Width Class
      4-5   Font Height
      6-7   Char Width
      8     Descript Flags
      9     Usage Codes
      10    Family
      11    Activity Class
      12    Font Quality
      13-14 CAP Height
      15-16 X Height
      17-18 Line Density
      19    Use Flags
    
      Font Binary GCID
      0     Length X'06'
      1     Triplet type:
            Font Binary GCID X'20'
      2-5   GCID
    
      Font Typeface
      0     Length X'24'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to font typeface X'08'
      3     ID X'00'
      4-35  Font typeface C'xxx..xxx'
    
    Map Data Resource (MDR): optional, repeating
      Structured Field Introducer
      0-1   Length X'lD'
      2-4   MDR X'D3ABC3'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-1   Length
    
      Triplets (required)
    
      Bit-map Name
      0     Length X'0C'
      1     Triplet type:
            fully qualified name X'02'
      2     Type: ref to Imaqe Object X'84'
      3     ID X'00' .
      4-11  Image name C'xxxx xxxx'
    
      Extended Resource lcid
      0     Length X'07'
      1     Triplet type:
            Extended Resource Local ID X'22'
      2     Type: Image Resource X'10'
      3-6   Bit-map handle
    
    End Object Environment Group (EOG): required if BOG present
    
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   EOG X'D3A9C7'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7 Object Environment Group name C'0000 0007'
    
    Graphics Data Descriptor (GDD): required
    
      Structured Field Introducer
      0-1   Length X'nnnn'
      2-4   GDD X'D3A6BB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters (all required and in this order)
      0     X'F7' Specify GVM Subset
      1     Length of following data X'07'
      2     X'B0' drawing order subset
      3-4   X'0000'
      5     X'23' Level 3.2
      6     X'Ol' Version 1
      7     Length of following field X'Ol'
      8     Coordinate types in data
            X'04' Intel16
            X'05' Intel32
    
      0     X'F6' Set Picture Descriptor
      1     Length of following data
      2     Flags
            0 B'0' Picture in 2D
            1 Picture Dimensions
              B'0' Not absolute (PU_ARBITRARY PS)
              B'1' Absolute (example: PU_TWIPS PS)
            2 Picture Elements
              B'0' Not pels
              B'1' Pels (PU_PELS PS)
                   (Bit 1 must also be set)
            3-7 B'00000'
      3     X'00' Reserved
      4     Picture frame size coordinate type
            X'04' Intel16
            X'05' Intel32
      5     UnitsOfMeasure
            X'00' Ten inches
            X'0l' Decimeter
      6-11 or 6-17 (2 or 4 bytes) Resolution.
            GPS Units / UOM on x axis
            GPS Units / UOM on y axis
            GPS Units / UOM on z axis
      12-23 or 18-41 (2 or 4 bytes) Window Size.
            GPS X left, X right
            GPS Y bottom, Y top
            GPS Z near, Z far
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Parameter Format X'08'
      3-4   Mask X'E000'
      5     Names X'8F'
      6     Coordinates
            X'00' Picture in 2D
      7     Transforms
            X'04' Intel16
            X'05' Intel32
      8     Geometrics
            X'04' Intel16
            X'05' Intel32
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set default viewing transform X'07'
      3-4   Mask X'CC0C'
      5     Names X'8F'
      6-n   M11, M12, M21, M22, M41, M42  Matrix elements
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set default line attributes X'01'
      3-4   Mask--OR of as many of the following bits as are required:
            X'8000'  Line type
            X'4000'  Line width
            X'2000'  Line end
            X'1000'  Line join
            X'0800'  Stroke width
            X'0008'  Line color
            X'0002'  Line mix
      5	   Flags
            X'0F'Set indicated default
                        attributes to initial values.
                        (Data field is not present
                        in this instance).
            X'8F' Set indicated default attributes
                        to specified values.
      6-n Data--data values as required, in the
                        following order if present.
          No space is reserved for attributes for which the
          corresponding mask flag was not set.
          (1 byte)---Line type
          (1 byte)---Line width
          (1 byte)---Line end
          (1 byte)---Line join
          (G bytes)--Stroke width
          (4 bytes)--Line color
          (1 byte)---Line mix
                     (G=2 or 4 depending on the Geometrics
                     parameter of Set Default Parameter Format)
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Character Attributes X'02'
      3-4   Mask--OR of as many of the following bits as are required:
    
            X'8000'  Character angle
            X'4000'  Character box
            X'2000'  Character direction
            X'1000'  Character precision
            X'0800'  Character set
            X'0400'  Character shear
            X'0040'  Character break extra
            X'0020'  Character extra
            X'O008'  Character color
            X'0004'  Character background color
            X'0002'  Character mix
            X'0001'  character background mix
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                        (Data field is not present in this case).
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in the following order if
            present.
    
            No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (2*G bytes) - Character angle
            (2*G + 4 bytes) - Character box
            (1 byte)    - Character direction
            (1 byte)    - Character precision
            (1 byte)    - Character set
            (2*G bytes) - Character shear
            (4 bytes)   - Character break extra
            (4 bytes)   - Character extra
            (4 bytes)   - Character color
            (4 bytes)   - Character background color
            (1 byte)    - Character mix
            (1 byte)    - Character background mix
               (G=2 or 4 depending on the Geometrics parameter of Set
               Default Parameter Format)
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Marker Attributes X'03'
      3-4   Mask--OR of as many of the following bits as are required:
            X'4000'   Marker box
            X'1000'   Marker precision
            X'0800'   Marker set
            X'0080'   Marker symbol
            X'0008'   Marker color
            X'0004'   Marker background color
            X'0002'   Marker mix
            X'0001'   Marker background mix
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                          (Data field is not present in this instance)
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in this order if present.
            No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (2*G bytes) - Marker box
            (1 byte)    - Marker precision
            (1 byte)    - Marker set
            (1 byte)    - Marker symbol
            (4 bytes)   - Marker color
            (4 bytes)   - Marker background color
            (1 byte)    - Marker mix
            (1 byte)    - Marker background mix
              (G=2 or 4 depending on the Geometrics parameter of Set
              Default Parameter Format)
    
      0     X,'21,' Set Current Defaults
      1     Length of following data
      2     Set Default Pattern Attributes X'04'
      3-4   Mask--OR of as many of the following bits as are required:
    
            X'0800'   Pattern set
            X'0100'   Pattern symbol
            X'0080'   Pattern reference point
            X'0008'   Pattern color
            X'0004'   Pattern background color
            X'0002'   Pattern mix
            X'0001'   Pattern background mix
      5     Flags
            X'0F' Set indicated default attributes to initial values.
               (Data field is not present in this instance)
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in this order if present.
            No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (1 byte)    - Pattern set
            (1 byte)    - Pattern symbol
            (2*G bytes) - Pattern reference point
            (4 bytes)   - Pattern color
            (4 bytes)   - Pattern background color
            (1 byte)    - Pattern mix
            (1 byte)    - Pattern background mix
    
            (G=2 or 4 depending on the Geometrics parameter of Set
            Default Parameter Format)
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Image Attributes X'06'
      3-4   Mask--OR of as many of these bits as are required:
            X'0008' Image color
            X'0004' Image background color
            X'0002' Image mix
            X'0001' Image background mix
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                         (Data field is not present in this instance)
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in this order if present.
            No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (4 bytes)       - Image color
            (4 bytes)       - Image background color
            (1 byte)        - Image mix
            (1 byte)        - Image background mix
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Viewing Window X'05'
      3-4   Mask--OR of as many of the following bits as are required:
            X'8000' x left limit
            X'4000' x right limit
            X'2000' y bottom limit
            X'1000' y top limit
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                            (Data field is not present in this case).
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in the following order if
            present. No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (2*G bytes) - x left limit
            (2*G bytes) - x right limit
            (2*G bytes) - y bottom limit
            (2*G bytes) - y top limit
               (G=2 or 4 depending on the Geometrics parameter of Set
               Default Parameter Format)
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Arc Parameters X'0B'
      3-4   Mask--OR of as many of the following bits as are required:
            X'8000' P value
            X'4000' Q value
            X'2000' R value
            X'1000' S value
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                            (Data field is not present in this case).
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in the following order if
            present. No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (G bytes) - P value
            (G bytes) - Q value
            (G bytes) - R value
            (G bytes) - S value
              (G=2 or 4 depending on the Geometrics parameter of Set
              Default Parameter Format)
    
      0     X'21' Set Current Defaults
      1     Length of following data
      2     Set Default Pick Identifier X'0C'
      3-4   Mask--OR of as many of the following bits as are required:
            X'8000' Pick identifier
      5     Flags
            X'0F' Set indicated default attributes to initial values.
                            (Data field is not present in this case).
            X'8F' Set indicated default attributes to specified values.
      6-n   Data--data values as required, in the following order if
            present. No space is reserved for attributes for which the
            corresponding Mask flag was not set.
            (4 bytes) - Pick identifier
    
      0     X'E7' Set Bit-map Identifier
      1     Length of following data X'07'
      2-3   Usage Flags X'8000'
      4-7   Bit-map handle
      8     Lcid
    
    Graphics Data (GAD): optional, repeating
    
      Structured Field Introducer
      0-1   Length X'n+9'
      2-4   GAD X'D3EEBB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters (maximum length in one structured field is 32759)
    
      Graphics Segment (optional, repeating)
      Segment data (including the Begin Segment parameter) can be split
      at any point between successive Graphics Data structured fields.
      0     X'70' Begin Segment
      1     Length of following data X'0E'
      2-5   Segment identifier
      6     Segment attributes (1)
            0 B'1' Invisible
            1 B'1' Propagate invisibility
            2 B'1' Detectable
            3 B'1' Propagate detectability
            6 B'1' Dynamic
            7 B'1' Fast chaining
      7     Segment attributes (2)
            0 B'1' Non-chained
            3 B'1' Prolog
      8-9   Segment data length (low-order 2 bytes)
      10-13 Reserved
      14-15 Segment data length (high-order 2 bytes)
      16-n  Graphics orders (see page 33-1)
    
    End Graphics Object (EGR)
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   EGR X'D3A9BB'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7 Graphics object name C'0000 0007'
    
    End Resource Group (ERG): required
      Structured Field Introducer
      0-1   Length X'0010'
      2-4   ERG X'D3A9C6'
      5     Flags X'00'
      6-7   Segment sequence number X'0000'
    
      Parameters
      0-7 Resource Group name  C'0000 0002'
    
    End Document (EDT): required
    
    Structured Field Introducer
    0-1     Length X'0010'
    2-4     EDT X'D3A9A8'
    5       Flags X'00'
    6-7     Segment sequence number X'0000'
    
    Parameters
    0-7     Document name    C'0000 0001'