The Uni Font-file format: Difference between revisions

From OS2World.Com Wiki
Jump to navigation Jump to search
Jugbogdan (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
|Source=FontTechnicalInformation_1997-12-10.zip
|Source=FontTechnicalInformation_1997-12-10.zip
}}
}}
The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.  
The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.


The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file.  
The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file. The font directory and the font resource are a set of self-defining records of the form:
The font directory and the font resource are a set of self-defining records of the form:  
<PRE>
<PRE>
  typedef struct _RECORD  
  typedef struct _RECORD  
  {
  {
UCHAR  Identity[4];  /* structure identity code */
UCHAR  Identity[4];  /* structure identity code */
ULONG   Identity;     / * structure identity code */
ULONG Identity;   /* structure identity code */
ULONG  ulSize;      /* structure size in bytes */
ULONG  ulSize;      /* structure size in bytes */
.                    /* data */
.                    /* data */
Line 21: Line 20:
  } RECORD;
  } RECORD;
</PRE>
</PRE>
The notation of bit order defined in this document is that bit 0 is LSB.  
The notation of bit order defined in this document is that bit 0 is LSB. The elements in the stuructures defined in this document must be aligned in 1 byte boundaries. WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.
The elements in the stuructures defined in this document must be aligned in 1 byte boundaries.  
WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.


==The Uni Font Directory==
==The Uni Font Directory==
This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font.
This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font.


Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure.  
Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure. All values in the UNIFONTDIRECTORY structure is stored in the little endian format. The format of the font directory is:
All values in the UNIFONTDIRECTORY structure is stored in the little endian format.
The format of the font directory is:  
<PRE>
<PRE>
  typedef struct _UNIFONTDIRECTORY  
  typedef struct _UNIFONTDIRECTORY
  {
  {
UCHAR       Identity[4];
UCHAR     Identity[4];
ULONG Identity;
ULONG Identity;
ULONG ulSize;
ULONG ulSize;
ULONG       ulUniFontResources;
ULONG     ulUniFontResources;
ULONG flEndian;
ULONG flEndian;
ULONG flFileMode;
ULONG flFileMode;
Line 43: Line 38:
  } UNIFONTDIRECTORY;
  } UNIFONTDIRECTORY;
</PRE>
</PRE>
Where:  
Where:
;Identity  
;Identity:4 byte unsigned integer. Must be 0x554E4644 ('UNFD') 0x44464E55 ('U'+('N'<<8)+('F'<<16)+('D'<<24)).
:4 byte unsigned integer. Must be 0x554E4644 ('UNFD') 0x44464E55 ('U'+('N'<<8)+('F'<<16)+('D'<<24)).
;ulSize:4 byte unsigned integer. The size of the structure, in bytes, which includes all entries of UNIFONTRESOURCEENTRY. (i.e. sizeof(UNIFONTDIRECTORY) + sizeof(UNIFONTRESOURCEENTRY) * (ulUniFontResources - 1))
 
;ulUniFontResources:4 byte unsigned integer. The number of the Uni font resources in the Uni font file.
;ulSize  
;flEndian:4 bytes of flags to specify the byte order and the bit order of the font file.
:4 byte unsigned integer. The size of the structure, in bytes, which includes all entries of UNIFONTRESOURCEENTRY. (i.e. sizeof(UNIFONTDIRECTORY) + sizeof(UNIFONTRESOURCEENTRY) * (ulUniFontResources - 1))
;UNIFONT_ENDIAN_BYTEOREDER (bit 0) Must be ZERO.
 
;UNIFONT_ENDIAN_BITORDER (bit 1) Must be ZERO.
;ulUniFontResources  
:4 byte unsigned integer. The number of the Uni font resources in the Uni font file.  
 
;flEndian
:4 bytes of flags to specify the byte order and the bit order of the font file.
 
;UNIFONT_ENDIAN_BYTEOREDER (bit 0) Must be ZERO.
;UNIFONT_ENDIAN_BITORDER (bit 1) Must be ZERO.
:Other bits must be ZERO.
:Other bits must be ZERO.
 
;flFileMode:4 byte of flags to specify file mode.
;flFileMode
;UNIFONT_WRITABLE (bit 1):This flag is on if the font file is designated to be updated, such as the user defined font.
:4 byte of flags to specify file mode.
;FontResEntry:ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.
 
;UNIFONT_WRITABLE (bit 1)
:This flag is on if the font file is designated to be updated, such as the user defined font.
 
;FontResEntry  
:ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.


The format of the Uni font resource entry is  
The format of the Uni font resource entry is  
<PRE>
<PRE>
  typedef struct _UNIFONTRESOURCEENTRY  
  typedef struct _UNIFONTRESOURCEENTRY
  {
  {
ULONG flUniFont;
ULONG flUniFont;
LONG offsetUniFont;
LONG offsetUniFont;
ULONG ulBaseUniFont;
ULONG ulBaseUniFont;
  } UNIFONTRESOURCEENTRY;
  } UNIFONTRESOURCEENTRY;
</PRE>
</PRE>
where:
where:
;flUniFont
;flUniFont:4 bytes of flags.
:4 bytes of flags.  
;UNIFONT_VIRTUAL_FONT (bit 0):This flag is on if the font is a virtual font. The font definition header, theThe font character group definition and the font character definitions are not included in the font resource. The virtual font can consists of only the font signature, the font metrics, and the font end signature and the font definition header.
 
;(UNIFONT_NAME_UNICODE (bit 1)):This flag is on if the naming such as typeface and familyname is specified in the Unicode string.
;UNIFONT_VIRTUAL_FONT (bit 0)
:This flag is on if the font is a virtual font. The font definition header, theThe font character group definition and the font character definitions are not included in the font resource. The virtual font can consists of only the font signature, the font metrics, and the font end signature and the font definition header.  
;(UNIFONT_NAME_UNICODE (bit 1))
:This flag is on if the naming such as typeface and familyname is specified in the Unicode string.  
:(bit1) Reserved. Must be ZERO.
:(bit1) Reserved. Must be ZERO.
:Other bits must be ZERO.
:Other bits must be ZERO.
 
;offsetUniFont:4 byte signed integer. The offset from the beginning of the file at which the Uni font resource begins.
;offsetUniFont
:4 byte signed integer. The offset from the beginning of the file at which the Uni font resource begins.
 
;ulBaseUniFont.
;ulBaseUniFont.
:4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font.
:4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font.


==The Uni Font Resource==
==The Uni Font Resource==
The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource.  
The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource.


There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource:
There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource:
Line 103: Line 77:
*The font definition header (UNIFONTDEFINITIONHEADER)
*The font definition header (UNIFONTDEFINITIONHEADER)
*The font character group definitions (UNICHARGROUPDEFINITION)
*The font character group definitions (UNICHARGROUPDEFINITION)
*The pair kerning table. (Option) (UNIKERNPAIRTABLE)
*The pair kerning table. (Option) (UNIKERNPAIRTABLE)
*The font character definitions
*The font character definitions
*The font end signature (UNIENDFONTRESOURCE)
*The font end signature (UNIENDFONTRESOURCE)
*The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field.
*The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field.
Line 110: Line 84:
*The above figure shows an example of a Uni font resource which has N character group definitions.
*The above figure shows an example of a Uni font resource which has N character group definitions.
*The Font Signature
*The Font Signature
A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:  
A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:  
  typedef struct _UNIFONTSIGNATURE  
  typedef struct _UNIFONTSIGNATURE
  {
  {
UCHAR  Identity[4];
UCHAR  Identity[4];
ULONG   Identity;
ULONG Identity;
ULONG  ulSize;
ULONG  ulSize;
UCHAR  szSignature [24];
UCHAR  szSignature [24];
UCHAR   szTechnology[64];
UCHAR szTechnology[64];
LONG   offsetCompressTable;
LONG offsetCompressTable;
ULONG  flFontResource;
ULONG  flFontResource;
  } UNIFONTSIGNATURE;
  } UNIFONTSIGNATURE;
 
where:
where:  
Identity 4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55 ('U'+('N'<<8)+('F'<<16)+('S'<<24)).
Identity  
ulSize 4 byte unsigned integer. The size of the structure, in bytes.
4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55 ('U'+('N'<<8)+('F'<<16)+('S'<<24)).
szSignature  
ulSize
4 byte unsigned integer. The size of the structure, in bytes.
szSignature  
A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field.  
A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field.  
szTechnology
szTechnology
A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support.  
A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support.  
offsetCompressTable  
offsetCompressTable  
4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support.
4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support.  
flFontResource
flFontResource
4 Bytes of flags.
4 Bytes of flags.
UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table
UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table
Line 147: Line 118:
ULONG  ulSize;
ULONG  ulSize;
  } UNIENDFONTRESOURCE;
  } UNIENDFONTRESOURCE;
where:
;Identity:4 bytes unsigned integer. Must be 0x554E4645 ('UNFE').  0x45464E55 ('U'+('N'<<8)+('F'<<16)+('E'<<24)).
;ulSize:4 byte unsigned integer. The size of the structure, in bytes.


where:
==The Font Metrics==
 
This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.
Identity
4 bytes unsigned integer. Must be 0x554E4645 ('UNFE').  0x45464E55 ('U'+('N'<<8)+('F'<<16)+('E'<<24)).
ulSize
4 byte unsigned integer. The size of the structure, in bytes.
The Font Metrics
This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.  
<PRE>
<PRE>
/* #defines for fsType in IFIMETRICS */
/* #defines for fsType in IFIMETRICS */


#define IFIMETRICS32_FIXED      0x0001  
#define IFIMETRICS32_FIXED      0x0001
#define IFIMETRICS32_LICENSED    0x0002  
#define IFIMETRICS32_LICENSED    0x0002
#define IFIMETRICS32_KERNING    0x0004  
#define IFIMETRICS32_KERNING    0x0004
#define IFIMETRICS32_DBCS        0x0010  
#define IFIMETRICS32_DBCS        0x0010
#define IFIMETRICS32_MBCS        0x0018  
#define IFIMETRICS32_MBCS        0x0018
#define IFIMETRICS32_FAMTRUNC    0x2000  
#define IFIMETRICS32_FAMTRUNC    0x2000
#define IFIMETRICS32_FACETRUNC  0x1000  
#define IFIMETRICS32_FACETRUNC  0x1000
#define IFIMETRICS32_UNICODE   0x0020
#define IFIMETRICS32_UNICODE 0x0020
#define IFIMETRICS32_NO_CACHE   0x4000
#define IFIMETRICS32_NO_CACHE 0x4000


/* #defines for fsDefn in IFIMETRICS */
/* #defines for fsDefn in IFIMETRICS */


#define IFIMETRICS_OUTLINE      0x0001
#define IFIMETRICS_OUTLINE      0x0001
#define IFIMETRICS32_UDC   0x0002
#define IFIMETRICS32_UDC     0x0002
#define IFIMETRICS32_ANTI_ALIAS  0x0004
#define IFIMETRICS32_ANTI_ALIAS  0x0004


/* #defines for fsSelection in IFIMETRICS */
/* #defines for fsSelection in IFIMETRICS */


#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_NEGATIVE    0x1000  
#define IFIMETRICS32_NEGATIVE    0x1000
#define IFIMETRICS32_HOLLOW      0x0800  
#define IFIMETRICS32_HOLLOW      0x0800


typedef struct _IFIMETRICS32  
typedef struct _IFIMETRICS32
{  
{
   UCHAR  szFamilyname[32];  
   UCHAR  szFamilyname[32];
   UCHAR  szFacename[32];    
   UCHAR  szFacename[32];
   UCHAR  szGlyphlistName[16];  
   UCHAR  szGlyphlistName[16];
   USHORT  idRegistry;
   USHORT  idRegistry;
   ULONG  idRegistry;
   ULONG  idRegistry;
Line 249: Line 217:
typedef struct _UNIFONTMETRICS  
typedef struct _UNIFONTMETRICS  
{
{
UCHAR   Identity[4];  
UCHAR Identity[4];  
ULONG  Identity;
ULONG  Identity;
ULONG  ulSize;
ULONG  ulSize;
Line 257: Line 225:
ULONG  ulFullFamilynameLen;
ULONG  ulFullFamilynameLen;
LONG    offsetFullFamilyName;
LONG    offsetFullFamilyName;
ULONG   ulFullFacenameLen;
ULONG ulFullFacenameLen;
LONG    offsetFullFacename;
LONG    offsetFullFacename;
UCHAR  szFullFamilyname[256];
UCHAR  szFullFamilyname[256];
Line 265: Line 233:
</PRE>
</PRE>


UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields.
UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields.
Identity
;Identity:4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)).
4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)).
;ulSize:4 byte unsigned integer. The size of the UNIFONTMETRICS structure, in bytes. Note that the size includes the variable length of the FullFamilyname and the FullFacename string.
ulSize
;flOptions:4 byte unsigned integer. Option flags.
4 byte unsigned integer. The size of the UNIFONTMETRICS structure, in bytes. Note that the size includes the variable length of the FullFamilyname and the FullFacename string.
::UNIFONTMETRICS_PANOSE_EXIST (bit 0) The panose structure is represented in the Uni font metrics.
flOptions
::UNIFONTMETRICS_FULLFAMILYNAME_EXIST (bit 1) The Full familyname string is represented in the Uni font metrics.
4 byte unsigned integer. Option flags.
::UNIFONTMETRICS_FULLFACENAME_EXIST (bit 2) The full facename string is represented in the Uni font metrics.
UNIFONTMETRICS_PANOSE_EXIST (bit 0)
;ulFullFamilyName:4 byte unsigned integer. This size of FullFamilyName string located by offsetFullFamilyName, in bytes. This size includes NULL terminate character. If the FullFamilyName is not specified in the font file, the field must be ZERO.
The panose structure is represented in the Uni font metrics.
;offsetFullFamilyName:4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the FamilyName string begins. The Family name string must be NULL terminated.  
UNIFONTMETRICS_FULLFAMILYNAME_EXIST (bit 1)
;ulFullFaceName:4 byte unsigned integer. The size of FullFaceName string located by offsetFullFaceName, in bytes. This size includes NULL terminate character. If the FullFaceName is not specified in the font file, this field must be ZERO.
The Full familyname string is represented in the Uni font metrics.
;offsetFullFaceName:4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the Face name string begins. The Face name string must be NULL terminated.
UNIFONTMETRICS_FULLFACENAME_EXIST (bit 2)
;szFullFamilyname[256]:256 byte unsigned character array. The full familyname string of the Uni font resource.  
The full facename string is represented in the Uni font metrics.
;szFullFacename[256]:256 byte unsigned character array. The full facename string of the Unifont resource.
 
;panose:PANOSE structure. The ten digit PANOSE number with two bytes of padding.
ulFullFamilyName
4 byte unsigned integer. This size of FullFamilyName string located by offsetFullFamilyName, in bytes. This size includes NULL terminate character. If the FullFamilyName is not specified in the font file, the field must be ZERO.
offsetFullFamilyName
4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the FamilyName string begins. The Family name string must be NULL terminated.  
ulFullFaceName
4 byte unsigned integer. The size of FullFaceName string located by offsetFullFaceName, in bytes. This size includes NULL terminate character. If the FullFaceName is not specified in the font file, this field must be ZERO.
offsetFullFaceName
4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the Face name string begins. The Face name string must be NULL terminated.
szFullFamilyname[256]
256 byte unsigned character array. The full familyname string of the Uni font resource.  
szFullFacename[256]
256 byte unsigned character array. The full facename string of the Unifont resource.
panose
PANOSE structure. 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:  
The PANOSE definition consists of ten digits, each of which describes one of up to sixteen variations. The current digits are:  
<PRE>
<PRE>
Line 310: Line 264:
} PANOSE;
} PANOSE;
</PRE>
</PRE>
1. Family Kind (bFamilyType - 6 variations)  
1. Family Kind (bFamilyType - 6 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Text and Display  
2    = Text and Display
3    = Script  
3    = Script
4    = Decorative  
4    = Decorative
5    = Pictorial
5    = Pictorial


2. Serif Style (bSerifStyle - 16 variations)  
2. Serif Style (bSerifStyle - 16 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Cove  
2    = Cove
3    = Obtuse Cove  
3    = Obtuse Cove
4    = Square Cove  
4    = Square Cove
5    = Obtuse Square Cove  
5    = Obtuse Square Cove
6    = Square  
6    = Square
7    = Thin  
7    = Thin
8    = Bone  
8    = Bone
9    = Exaggerated  
9    = Exaggerated
10  = Triangle  
10  = Triangle
11  = Normal Sans  
11  = Normal Sans
12  = Obtuse Sans  
12  = Obtuse Sans
13  = Perp Sans  
13  = Perp Sans
14  = Flared  
14  = Flared
15  = Rounded  
15  = Rounded


3. Weight (bWeight - 12 variations)  
3. Weight (bWeight - 12 variations)  
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Very Light  
2    = Very Light
3    = Light  
3    = Light
4    = Thin  
4    = Thin
5    = Book  
5    = Book
6    = Medium  
6    = Medium
7    = Demi  
7    = Demi
8    = Bold  
8    = Bold
9    = Heavy  
9    = Heavy
10  = Black  
10  = Black
11  = Nord  
11  = Nord


4. Proportion (bProportion - 10 variations)  
4. Proportion (bProportion - 10 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Old Style  
2    = Old Style
3    = Modern  
3    = Modern
4    = Even Width  
4    = Even Width
5    = Expanded  
5    = Expanded
6    = Condensed  
6    = Condensed
7    = Very Expanded  
7    = Very Expanded
8    = Very Condensed  
8    = Very Condensed
9    = Monospaced  
9    = Monospaced


5. Contrast (bContrast - 10 variations)  
5. Contrast (bContrast - 10 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = None  
2    = None
3    = Very Low  
3    = Very Low
4    = Low  
4    = Low
5    = Medium Low  
5    = Medium Low
6    = Medium  
6    = Medium
7    = Medium High  
7    = Medium High
8    = High  
8    = High
9    = Very High  
9    = Very High


6. Stroke Variation (bStorokeVariation - 9 variations)  
6. Stroke Variation (bStorokeVariation - 9 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Gradual/Diagonal  
2    = Gradual/Diagonal
3    = Gradual/Transitional  
3    = Gradual/Transitional
4    = Gradual/Vertical  
4    = Gradual/Vertical
5    = Gradual/Horizontal  
5    = Gradual/Horizontal
6    = Rapid/Vertical  
6    = Rapid/Vertical
7    = Rapid/Horizontal  
7    = Rapid/Horizontal
8    = Instant/Vertical  
8    = Instant/Vertical


7. Arm Style (bArmStyle - 12 variations)  
7. Arm Style (bArmStyle - 12 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Straight Arms/Horizontal  
2    = Straight Arms/Horizontal
3    = Straight Arms/Wedge  
3    = Straight Arms/Wedge
4    = Straight Arms/Vertical  
4    = Straight Arms/Vertical
5    = Straight Arms/Single Serif  
5    = Straight Arms/Single Serif
6    = Straight Arms/Double Serif  
6    = Straight Arms/Double Serif
7    = Non-Straight Arms/Horizontal  
7    = Non-Straight Arms/Horizontal
8    = Non-Straight Arms/Wedge  
8    = Non-Straight Arms/Wedge
9    = Non-Straight Arms/Vertical  
9    = Non-Straight Arms/Vertical
10  = Non-Straight Arms/Single Serif  
10  = Non-Straight Arms/Single Serif
11  = Non-Straight Arms/Double Serif  
11  = Non-Straight Arms/Double Serif


8. Letterform (bLetterform - 16 variations)  
8. Letterform (bLetterform - 16 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Normal/Contact  
2    = Normal/Contact
3    = Normal/Weighted  
3    = Normal/Weighted
4    = Normal/Boxed  
4    = Normal/Boxed
5    = Normal/Flattened  
5    = Normal/Flattened
6    = Normal/Rounded  
6    = Normal/Rounded
7    = Normal/Off Center  
7    = Normal/Off Center
8    = Normal/Square  
8    = Normal/Square
9    = Oblique/Contact  
9    = Oblique/Contact
10  = Oblique/Weighted  
10  = Oblique/Weighted
11  = Oblique/Boxed  
11  = Oblique/Boxed
12  = Oblique/Flattened  
12  = Oblique/Flattened
13  = Oblique/Rounded  
13  = Oblique/Rounded
14  = Oblique/Off Center  
14  = Oblique/Off Center
15  = Oblique/Square  
15  = Oblique/Square


9. Midline (bMidline - 14 variations)  
9. Midline (bMidline - 14 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Standard/Trimmed  
2    = Standard/Trimmed
3    = Standard/Pointed  
3    = Standard/Pointed
4    = Standard/Serifed  
4    = Standard/Serifed
5    = High/Trimmed  
5    = High/Trimmed
6    = High/Pointed  
6    = High/Pointed
7    = High/Serifed  
7    = High/Serifed
8    = Constant/Trimmed  
8    = Constant/Trimmed
9    = Constant/Pointed  
9    = Constant/Pointed
10  = Constant/Serifed  
10  = Constant/Serifed
11  = Low/Trimmed  
11  = Low/Trimmed
12  = Low/Pointed  
12  = Low/Pointed
13  = Low/Serifed  
13  = Low/Serifed


10. X-height (bXHeight - 8 variations)  
10. X-height (bXHeight - 8 variations)
0    = Any  
0    = Any
1    = No Fit  
1    = No Fit
2    = Constant/Small  
2    = Constant/Small
3    = Constant/Standard  
3    = Constant/Standard
4    = Constant/Large  
4    = Constant/Large
5    = Ducking/Small  
5    = Ducking/Small
6    = Ducking/Standard  
6    = Ducking/Standard
7    = Ducking/Large  
7    = Ducking/Large


11. fbPassedISO
11. fbPassedISO
T.B.D
T.B.D


12. fbFailedISO  
12. fbFailedISO
T.B.D  
T.B.D
 
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.


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.  
See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.


See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.
==The Font Definition Header==
The Font Definition Header
The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins.
The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins.
This structure defines the format of the character group definition records and the character definition records that follow:
This structure defines the format of the character group definition records and the character definition records that follow:
Line 478: Line 433:
} UNIFONTDEFINITIONHEADER;
} UNIFONTDEFINITIONHEADER;
</PRE>
</PRE>
Identity
;Identity:4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)).
4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)).
;ulSize:4 byte unsigned integer. Size of this structure in bytes.
ulSize
;flFontDef:4 bytes of flags. Indicates which fields are present in the font definition data in the header.
4 byte unsigned integer. Size of this structure in bytes.  
:Bit 0
flFontDef  
::1 = character width is defined in the font definition header (fixed pitch)
4 bytes of flags. Indicates which fields are present in the font definition data in the header.  
::0 = character width is not defined in the font definition header      
 
:Bit 1
Bit 0 1 = character width is defined in the font  
::1 = character height is defined in the font definition header (same for all characters)
    definition header (fixed pitch)
::0 = character height is not defined in the font definition header
0 = character width is not defined in the font  
:Bit 2
    definition header      
::1 = character increment is defined in the font definition header (same for all characters)
 
::0 = character increment is not defined in the font definition header
Bit 1 1 = character height is defined in the font definition
:Bit 3
    header (same for all characters)
::1 = a_space is defined in the font definition header (same for all characters)
0 = character height is not defined in the font  
::0 = a_space is not defined in the font definition header (non abc_space font or defined for each character)
    definition header
:Bit 4
 
::1 = b_space is defined in the font definition header (same for all characters)
Bit 2 1 = character increment is defined in the font  
::0 = b_space is not defined in the font definition header (non abc_space font or defined for each character)
    definition header (same for all characters)
:Bit 5
0 = character increment is not defined in the font
::1 = c_space is defined in the font definition header (same for all characters)
    definition header
::0 = c_space is not defined in the font definition header (non abc_space font or defined for each character)
 
:Bit 6
Bit 3 1 = a_space is defined in the font definition header (same
::1 = base offset is defined in the font definition header (same for all chracters)
    for all characters)
::0 = base offset is not defined in the font definition header
0 = a_space is not defined in the font definition header
;flGroupDef:4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).
    (non abc_space font or defined for each character)
:Bit 0
 
::1 = character width is defined in the character group definitions (defined for each character group)
Bit 4 1 = b_space is defined in the font definition header (same
::0 = character width is not defined in the character group definition (same for all characters)
    for all characters)
:Bit 1
0 = b_space is not defined in the font definition header
::1 = character height is defined in the character group definitions (defined for each character group)
    (non abc_space font or defined for each character)
::0 = character height is not defined in the character group definitions (same for all characters)
 
:Bit 2
 
::1 = character increment is defined in the the character group definitions (defined for each character group)
Bit 5 1 = c_space is defined in the font definition header (same
::0 = character increment is not defined in the character group definitions (same for all characters)  
    for all characters)
:Bit 3
0 = c_space is not defined in the font definition header
::1 = a_space is defined in the character group definitions (defined for each character group)
    (non abc_space font or defined for each character)
::0 = a_space is not defined in the character group definitions (same for all characters)
 
:Bit 4
Bit 6 1 = base offset is defined in the font definition header
::1 = b_space is defined in the character group definitions (defined for each character group)
    (same for all chracters)
::0 = b_space is not defined in the character group definitions (same for all characters)
0 = base offset is not defined in the font definition header
:Bit 5
flGroupDef
::1 = c_space is defined in the character group definitions (defined for each character group)
4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).
::0 = c_space is not defined in the character group definitions (same for all characters)
 
:Bit 6
Bit 0 1 = character width is defined in the character group
::1 = base offset is defined in the character group definitions (defined for each character group)
    definitions (defined for each character group)
::0 = base offset is not defined in the character group definitions (same for all characters)
0 = character width is not defined in the character group
;flCharDef:4 bytes of flags. Indicates which fields are present on a per character basis.
    definition (same for all characters)
:Bit 0
 
::1 = character width is defined in the character definitions (defined for each character definition)
Bit 1 1 = character height is defined in the character group
::0 = character width is not defined in the character definitions
    definitions (defined for each character group)
:Bit 1
0 = character height is not defined in the character group
::1 = character height is defined in the character definitions (defined for each character definition)
    definitions (same for all characters)
::0 = character height is not defined in the character definitions
 
:Bit 2
Bit 2 1 = character increment is defined in the the character
::1 = character increment is defined in the the character definitions (defined for each character definition)
    group definitions (defined for each character group)
::0 = character increment is not defined in the character definitions  
0 = character increment is not defined in the character
:Bit 3
    group definitions (same for all characters)  
::1 = a_space is defined in the character definitions (defined for each character definition)
 
::0 = a_space is not defined in the character definitions
Bit 3 1 = a_space is defined in the character group definitions
:Bit 4
    (defined for each character group)
::1 = b_space is defined in the character definitions (defined for each character definition)
0 = a_space is not defined in the character group
::0 = b_space is not defined in the character definitions
    definitions (same for all characters)
:Bit 5
 
::1 = c_space is defined in the character definitions (defined for each character definition)
Bit 4 1 = b_space is defined in the character group definitions
::0 = c_space is not defined in the character definitions
    (defined for each character group)
:Bit 6
0 = b_space is not defined in the character group
::1 = base offset is defined in the character definitions (defined for each character definition)
    definitions (same for all characters)
::0 = base offset is not defined in the character definitions
 
:Bit 7
Bit 5 1 = c_space is defined in the character group definitions
::1 = offset to glyph is defined
    (defined for each character group)
::0 = offset to glyph is not defined
0 = c_space is not defined in the character group
::Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.
    definitions (same for all characters)
;ulCharDefSize:4-byte unsigned integer. Indicates the length in bytes of each character definition record (the per character data).
;xCellWidth:2-byte signed integer. The width of the characters, in pels for image fonts.
Bit 6 1 = base offset is defined in the character group
;yCellHeight:2-byte signed integer. The height of the characters, in pels for image fonts.
    definitions (defined for each character group)
;xCellIncrement:2-byte signed integer. The distance, in pels for image fonts,  along with the character baseline required to step from one character to the next (when forming a character string).
0 = base offset is not defined in the character group
;xCellA:2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.
    definitions (same for all characters)
;xCellB:2-byte signed integer. The width of a character (inline direction), in pels for image fonts.  (the b_space).
 
;xCellC:2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).
flCharDef  
;yCellBaseOffset:2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline, in pels for image fonts.
4 bytes of flags. Indicates which fields are present on a per character basis.  
;usReserved:2 byte unsigned integer. Must be ZERO.
 
;giFirstChar:4 byte unsigned integer. The index of the first character glyph in the font file.
Bit 0 1 = character width is defined in the character definitions
;giLastChar:4 byte unsigned integer. The index of the last character glyph in the font file.
    (defined for each character definition)
;ulCharDefNum:4 byte unsigned integer. The number of the character definitions in the font file. If all of the characters between the first and the last character are defined, the value in this field will be giLastChar - giFirstChar + 1.
0 = character width is not defined in the character
:WPOS OS/2 1.0 and OS/2 2.2 will support only type1, type2 and type3 font as the font defintion header records are defined as follows.
    definitions
 
Bit 1 1 = character height is defined in the character definitions
    (defined for each character definition)
0 = character height is not defined in the character
    definitions
 
Bit 2 1 = character increment is defined in the the character
    definitions (defined for each character definition)
0 = character increment is not defined in the character
    definitions  
 
Bit 3 1 = a_space is defined in the character definitions
    (defined for each character definition)
0 = a_space is not defined in the character definitions
 
Bit 4 1 = b_space is defined in the character definitions
    (defined for each character definition)
0 = b_space is not defined in the character definitions
 
Bit 5 1 = c_space is defined in the character definitions
    (defined for each character definition)
0 = c_space is not defined in the character definitions        
Bit 6 1 = base offset is defined in the character definitions
    (defined for each character definition)
0 = base offset is not defined in the character definitions
 
Bit 7 1 = offset to glyph is defined  
0 = offset to glyph is not defined


Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.    
ulCharDefSize
4-byte unsigned integer. Indicates the length in bytes of each character definition record (the per character data).
xCellWidth
2-byte signed integer. The width of the characters, in pels for image fonts.
yCellHeight
2-byte signed integer. The height of the characters, in pels for image fonts.
xCellIncrement
2-byte signed integer. The distance, in pels for image fonts,  along with the character baseline required to step from one character to the next (when forming a character string).
xCellA
2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.
xCellB
2-byte signed integer. The width of a character (inline direction), in pels for image fonts.  (the b_space).
xCellC
2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).
yCellBaseOffset
2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline, in pels for image fonts.
usReserved
2 byte unsigned integer. Must be ZERO.
giFirstChar
4 byte unsigned integer. The index of the first character glyph in the font file.
giLastChar
4 byte unsigned integer. The index of the last character glyph in the font file.
ulCharDefNum
4 byte unsigned integer. The number of the character definitions in the font file. If all of the characters between the first and the last character are defined, the value in this field will be giLastChar - giFirstChar + 1.
WPOS OS/2 1.0 and OS/2 2.2 will support only type1, type2 and type3 font as the font defintion header records are defined as follows.
Type 1 - fixed pitch width and height font
Type 1 - fixed pitch width and height font
ulIdentity = 0x554E4648;
ulIdentity = 0x554E4648;
ulSIze = 64;
ulSIze = 64;
Line 639: Line 538:
ulCharDefNum = The number of the character definitions
ulCharDefNum = The number of the character definitions
Type2 - Proportional width and fixed pitch height font
Type2 - Proportional width and fixed pitch height font
ulIdentity = 0x554E4648;
ulIdentity = 0x554E4648;
ulSIze = 64;
ulSIze = 64;
Line 656: Line 554:
ulLastChar = The glyph index of the last character
ulLastChar = The glyph index of the last character
ulCharDefNum = The number of the character definitions
ulCharDefNum = The number of the character definitions
Type3 - ABC_space width and fixed pitch height font
Type3 - ABC_space width and fixed pitch height font
ulIdentity = 0x554E4648;
ulIdentity = 0x554E4648;
ulSIze = 64;
ulSIze = 64;
Line 682: Line 579:


==The Font Character Group Definition==
==The Font Character Group Definition==
The character group definition record is defined to support the font indices of a large character set of which indices may consist of sparse ranges.  
The character group definition record is defined to support the font indices of a large character set of which indices may consist of sparse ranges.
 
<pre>
  typedef struct _UNICHARGROUPDEFINITION  
  typedef struct _UNICHARGROUPDEFINITION  
  {
  {
Line 692: Line 589:
UNICHARGROUPENTRY CharGroupEntry[1];
UNICHARGROUPENTRY CharGroupEntry[1];
  } UNICHARGROUPDEFINITION;
  } UNICHARGROUPDEFINITION;
</pre>
Identity
Identity
4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55  ('U'+('N'<<8)+('G'<<16)+('H'<<24)).
4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55  ('U'+('N'<<8)+('G'<<16)+('H'<<24)).
Line 700: Line 598:
CharGroupEntry
CharGroupEntry
unCharGroups size of array of the UNICHARGROUPENTRY structure.  
unCharGroups size of array of the UNICHARGROUPENTRY structure.  
The format of the UNICHARGROUPENTRY is :  
The format of the UNICHARGROUPENTRY is:
 
<pre>
typedef struct _UNICHARGROUPENTRY  
typedef struct _UNICHARGROUPENTRY  
{
{
Line 719: Line 617:
USHORT usReserved;
USHORT usReserved;
} UNICHARGROUPENTRY;
} UNICHARGROUPENTRY;
 
</pre>
where:
where:
flCharGroupEntry
;flCharGroupEntry:4 bytes of flags. Indicates which fields are present in the character definition data in the header. If the font file is created for a single repository,
4 bytes of flags. Indicates which fields are present in the character definition data in the header. If the font file is created for a single repository,  
::UNIFONT_FREQUENT_GROUP (Bit 0) Indicate that this character gorup may be frequestly used. It is recommended that the font subsystem cache the character definitions of this group in memory for the performance when this bit is ON.
UNIFONT_FREQUENT_GROUP (Bit 0)  
;giFirstChar:4 byte unsigned integer. Indicates the start font index of the character group.
Indicate that this character gorup may be frequestly used. It is recommended that the font subsystem cache the character definitions of this group in memory for the performance when this bit is ON.
;giLastChar:4 byte unsigned integer. Indicates the end font index of the character group.
giFirstChar
;offsetCharDef:4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
4 byte unsigned integer. Indicates the start font index of the character group.
;offsetImageData:4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.
giLastChar
;ulImageDataSize:4-byte unsigned integer. The size of the character glyph definition group (image data group).  
4 byte unsigned integer. Indicates the end font index of the character group.
offsetCharDef
4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
offsetImageData
4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.  
ulImageDataSize
4-byte unsigned integer. The size of the character glyph definition group (image data group).  
The following field are defined in the UNICHARGROUPENTRY structure, however, the values may or may not be present in them according to the ulGroupDef field in UNIFONTDEFINITIONHEADER. If the values are present, they are applied for only the character group.  
The following field are defined in the UNICHARGROUPENTRY structure, however, the values may or may not be present in them according to the ulGroupDef field in UNIFONTDEFINITIONHEADER. If the values are present, they are applied for only the character group.  
xCellWidth
xCellWidth
Line 755: Line 646:
This record will exist in a Uni font-file format if the UNIFONT_KERNINGPAIRS_EXIST flag in the flFontSignature field in the UNIFONTSIGNATE structure is on.  
This record will exist in a Uni font-file format if the UNIFONT_KERNINGPAIRS_EXIST flag in the flFontSignature field in the UNIFONTSIGNATE structure is on.  
The kerning pair table record is not present if the cKerningPairs field in the UNIFONTMETRICS structure is zero. This table should be sorted by the first character (usFirstChar) and the second character (usSecondChar) order to allow binary searches.  
The kerning pair table record is not present if the cKerningPairs field in the UNIFONTMETRICS structure is zero. This table should be sorted by the first character (usFirstChar) and the second character (usSecondChar) order to allow binary searches.  
 
<pre>
typedef struct _UNIKERNPAIRTABLE  
typedef struct _UNIKERNPAIRTABLE  
{
{
UCHAR  Identity[4];
UCHAR  Identity[4];
ULONG   Identity;
ULONG Identity;
ULONG  ulSize;
ULONG  ulSize;
ULONG  ulKernPairs;
ULONG  ulKernPairs;
KERNINGPAIRS KernPairs[1];
KERNINGPAIRS KernPairs[1];
} UNIKERNPAIRTABLE;
} UNIKERNPAIRTABLE;
 
</pre>
where:  
where:  
Identity
Identity
Line 774: Line 665:
KernPairs
KernPairs
ulKernPairs size of array of the KERNINGPAIR structure.
ulKernPairs size of array of the KERNINGPAIR structure.
 
<pre>
typedef struct _KERNINGPAIRS  
typedef struct _KERNINGPAIRS  
{
{
Line 781: Line 672:
LONG    lKerningAmount;
LONG    lKerningAmount;
} KERNINGPAIRS;
} KERNINGPAIRS;
 
</pre>
where:
where:


Line 789: Line 680:
4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.  
4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.  
lKerningAmount
lKerningAmount
4 byte signed integer. Kerning value in pels for image fonts. Positive values increase the inter-character spacing while negative values bring the characters closer together.  
4 byte signed integer. Kerning value in pels for image fonts. Positive values increase the inter-character spacing while negative values bring the characters closer together.  
The Font Character Definition  
The Font Character Definition  
Character Definition Record
Character Definition Record
Line 795: Line 686:
There are ulCharNumber of the records for image fonts.
There are ulCharNumber of the records for image fonts.
Character Glyph Definition Offset (offsetImageData)
Character Glyph Definition Offset (offsetImageData)
4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented.  
4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented.
Character Cell Width (xCellWidth)
Character Cell Width (xCellWidth)
2-byte integer. The width of the character definition in pels.
2-byte integer. The width of the character definition in pels.
Line 812: Line 703:
  The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.
  The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.
Image Data Format  
Image Data Format  
The bits for each character are stored separately, and start on a byte boundary. Sequential bytes represent horizontal pieces of the character image. For example, a 15-bit-wide H is stored as follows:  
The bits for each character are stored separately, and start on a byte boundary. Sequential bytes represent horizontal pieces of the character image. For example, a 15-bit-wide H is stored as follows:
 
<pre>
byte                  byte
byte                  byte
                       
0  00000000 0000000-  1    
0  00000000 0000000-  1
2  01100000 0000110-  3    
2  01100000 0000110-  3
4  01100000 0000110-  5
4  01100000 0000110-  5
6  01100000 0000110-  7    
6  01100000 0000110-  7
8  01100000 0000110-  9    
8  01100000 0000110-  9
10  01111111 1111110-  11    
10  01111111 1111110-  11
12  01111111 1111110-  13    
12  01111111 1111110-  13
14  01100000 0000110-  15
14  01100000 0000110-  15
16  01100000 0000110-  17    
16  01100000 0000110-  17
18  01100000 0000110-  19    
18  01100000 0000110-  19
20  01100000 0000110-  21
20  01100000 0000110-  21
22  00000000 0000000-  23  
22  00000000 0000000-  23  
</pre>
The format is the same as the OS/2 bitmap format of one bit per pel.
The format is the same as the OS/2 bitmap format of one bit per pel.


==The Uni Font-file format==
==The Uni Font-file format==
The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.  
The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.  


The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file.  
The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file.  


The font directory and the font resource are a set of self-defining records of the form:  
The font directory and the font resource are a set of self-defining records of the form:
 
<pre>
typedef struct _RECORD  
typedef struct _RECORD  
{
{
UCHAR  Identity[4];  /* structure identity code */
UCHAR  Identity[4];  /* structure identity code */
ULONG   Identity;     / * structure identity code */
ULONG Identity;   /* structure identity code */
ULONG  ulSize;      /* structure size in bytes */
ULONG  ulSize;      /* structure size in bytes */
.                    /* data */
.                    /* data */
Line 847: Line 738:
.
.
} RECORD;
} RECORD;
</pre>
The notation of bit order defined in this document is that bit 0 is LSB.  
The notation of bit order defined in this document is that bit 0 is LSB.  
The elements in the stuructures defined in this document must be aligned in 1 byte boundaries.  
The elements in the stuructures defined in this document must be aligned in 1 byte boundaries.  
WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.
WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.
The Uni Font Directory
The Uni Font Directory
This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font.
 
This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font.
Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure.  
Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure.  
All values in the UNIFONTDIRECTORY structure is stored in the little endian format.
All values in the UNIFONTDIRECTORY structure is stored in the little endian format.
The format of the font directory is:  
The format of the font directory is:  
 
<pre>
typedef struct _UNIFONTDIRECTORY  
typedef struct _UNIFONTDIRECTORY
{
{
UCHAR       Identity[4];
UCHAR     Identity[4];
ULONG Identity;
ULONG Identity;
ULONG ulSize;
ULONG ulSize;
ULONG       ulUniFontResources;
ULONG     ulUniFontResources;
ULONG flEndian;
ULONG flEndian;
ULONG flFileMode;
ULONG flFileMode;
UNIFONTRESOURCEENTRY FontResEntry[1];
UNIFONTRESOURCEENTRY FontResEntry[1];
} UNIFONTDIRECTORY;
} UNIFONTDIRECTORY;
 
</pre>
Where:  
Where:  
Identity  
Identity  
Line 884: Line 778:
This flag is on if the font file is designated to be updated, such as the user defined font.
This flag is on if the font file is designated to be updated, such as the user defined font.
FontResEntry  
FontResEntry  
ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.
ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.
 
The format of the Uni font resource entry is


The format of the Uni font resource entry is:
<pre>
typedef struct _UNIFONTRESOURCEENTRY  
typedef struct _UNIFONTRESOURCEENTRY  
{
{
Line 893: Line 787:
LONG offsetUniFont;
LONG offsetUniFont;
ULONG ulBaseUniFont;
ULONG ulBaseUniFont;
} UNIFONTRESOURCEENTRY;
} UNIFONTRESOURCEENTRY;
</pre>
where:
where:
flUniFont
flUniFont
Line 906: Line 801:
4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font.
4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font.
The Uni Font Resource  
The Uni Font Resource  
The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource.  
The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource.  
There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource:
There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource:
The font signature (UNIFONTSIGNATURE)
The font signature (UNIFONTSIGNATURE)
Line 912: Line 807:
The font definition header (UNIFONTDEFINITIONHEADER)
The font definition header (UNIFONTDEFINITIONHEADER)
The font character group definitions (UNICHARGROUPDEFINITION)
The font character group definitions (UNICHARGROUPDEFINITION)
The pair kerning table. (Option) (UNIKERNPAIRTABLE)
The pair kerning table. (Option) (UNIKERNPAIRTABLE)
The font character definitions
The font character definitions
The font end signature (UNIENDFONTRESOURCE)
The font end signature (UNIENDFONTRESOURCE)
The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field.
The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field.
Line 919: Line 814:
The above figure shows an example of a Uni font resource which has N character group definitions.
The above figure shows an example of a Uni font resource which has N character group definitions.
The Font Signature
The Font Signature
A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:  
A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:  
 
<pre>
typedef struct _UNIFONTSIGNATURE  
typedef struct _UNIFONTSIGNATURE  
{
{
UCHAR  Identity[4];
UCHAR  Identity[4];
ULONG   Identity;
ULONG Identity;
ULONG  ulSize;
ULONG  ulSize;
UCHAR  szSignature [24];
UCHAR  szSignature [24];
UCHAR   szTechnology[64];
UCHAR szTechnology[64];
LONG   offsetCompressTable;
LONG offsetCompressTable;
ULONG  flFontResource;
ULONG  flFontResource;
} UNIFONTSIGNATURE;
} UNIFONTSIGNATURE;
where:  
</pre>
where:
Identity  
Identity  
4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55  ('U'+('N'<<8)+('F'<<16)+('S'<<24)).
4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55  ('U'+('N'<<8)+('F'<<16)+('S'<<24)).
Line 939: Line 835:
A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field.  
A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field.  
szTechnology
szTechnology
A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support.  
A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support.  
offsetCompressTable  
offsetCompressTable  
4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support.
4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support.
flFontResource
flFontResource
4 Bytes of flags.
4 Bytes of flags.
UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table
UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table
Line 966: Line 862:
4 byte unsigned integer. The size of the structure, in bytes.
4 byte unsigned integer. The size of the structure, in bytes.
The Font Metrics
The Font Metrics
This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.  
This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.
 
<pre>
/* #defines for fsType in IFIMETRICS */
/* #defines for fsType in IFIMETRICS */


#define IFIMETRICS32_FIXED      0x0001  
#define IFIMETRICS32_FIXED      0x0001  
#define IFIMETRICS32_LICENSED    0x0002  
#define IFIMETRICS32_LICENSED    0x0002  
#define IFIMETRICS32_KERNING    0x0004  
#define IFIMETRICS32_KERNING    0x0004  
#define IFIMETRICS32_DBCS        0x0010  
#define IFIMETRICS32_DBCS        0x0010  
#define IFIMETRICS32_MBCS        0x0018  
#define IFIMETRICS32_MBCS        0x0018  
#define IFIMETRICS32_FAMTRUNC    0x2000  
#define IFIMETRICS32_FAMTRUNC    0x2000  
#define IFIMETRICS32_FACETRUNC  0x1000  
#define IFIMETRICS32_FACETRUNC  0x1000  
#define IFIMETRICS32_UNICODE   0x0020
#define IFIMETRICS32_UNICODE 0x0020
#define IFIMETRICS32_NO_CACHE   0x4000
#define IFIMETRICS32_NO_CACHE 0x4000


/* #defines for fsDefn in IFIMETRICS */
/* #defines for fsDefn in IFIMETRICS */


#define IFIMETRICS_OUTLINE       0x0001
#define IFIMETRICS_OUTLINE     0x0001
#define IFIMETRICS32_UDC   0x0002
#define IFIMETRICS32_UDC     0x0002
#define IFIMETRICS32_ANTI_ALIAS 0x0004
#define IFIMETRICS32_ANTI_ALIAS 0x0004


/* #defines for fsSelection in IFIMETRICS */
/* #defines for fsSelection in IFIMETRICS */


#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_NEGATIVE    0x1000  
#define IFIMETRICS32_NEGATIVE    0x1000
#define IFIMETRICS32_HOLLOW      0x0800  
#define IFIMETRICS32_HOLLOW      0x0800


typedef struct _IFIMETRICS32  
typedef struct _IFIMETRICS32  
{  
{  
   UCHAR  szFamilyname[32];  
   UCHAR  szFamilyname[32];
   UCHAR  szFacename[32];    
   UCHAR  szFacename[32];
   UCHAR  szGlyphlistName[16];  
   UCHAR  szGlyphlistName[16];
   USHORT  idRegistry;
   USHORT  idRegistry;
   ULONG  idRegistry;
   ULONG  idRegistry;
Line 1,060: Line 956:
typedef struct _UNIFONTMETRICS  
typedef struct _UNIFONTMETRICS  
{
{
UCHAR   Identity[4];  
UCHAR Identity[4];
ULONG  Identity;
ULONG  Identity;
ULONG  ulSize;
ULONG  ulSize;
Line 1,068: Line 964:
ULONG  ulFullFamilynameLen;
ULONG  ulFullFamilynameLen;
LONG    offsetFullFamilyName;
LONG    offsetFullFamilyName;
ULONG   ulFullFacenameLen;
ULONG ulFullFacenameLen;
LONG    offsetFullFacename;
LONG    offsetFullFacename;
UCHAR  szFullFamilyname[256];
UCHAR  szFullFamilyname[256];
Line 1,074: Line 970:
} UNIFONTMETRICS;  
} UNIFONTMETRICS;  
typedef UNIFONTMETRICS *PUNIFONTMETRICS;
typedef UNIFONTMETRICS *PUNIFONTMETRICS;
UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields.
</pre>
UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields.
Identity
Identity
4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)).
4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)).
Line 1,258: Line 1,155:
T.B.D  
T.B.D  


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.  
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.
 
See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.


See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.
The Font Definition Header
The Font Definition Header
The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins.
The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins.
This structure defines the format of the character group definition records and the character definition records that follow:
This structure defines the format of the character group definition records and the character definition records that follow:
 
<pre>
typedef struct _UNIFONTDEFINITIONHEADER  
typedef struct _UNIFONTDEFINITIONHEADER  
{
{
Line 1,286: Line 1,185:
ULONG ulCharDefNum;
ULONG ulCharDefNum;
} UNIFONTDEFINITIONHEADER;
} UNIFONTDEFINITIONHEADER;
 
</pre>
Identity
Identity
4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)).
4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)).
Line 1,329: Line 1,228:
0 = base offset is not defined in the font definition header
0 = base offset is not defined in the font definition header
flGroupDef
flGroupDef
4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).
4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).


Bit 0 1 = character width is defined in the character group
Bit 0 1 = character width is defined in the character group
Line 1,366: Line 1,265:
    definitions (same for all characters)
    definitions (same for all characters)


flCharDef  
flCharDef 4 bytes of flags. Indicates which fields are present on a per character basis.  
4 bytes of flags. Indicates which fields are present on a per character basis.  


Bit 0 1 = character width is defined in the character definitions
Bit 0 1 = character width is defined in the character definitions
Line 1,394: Line 1,292:
Bit 5 1 = c_space is defined in the character definitions
Bit 5 1 = c_space is defined in the character definitions
    (defined for each character definition)
    (defined for each character definition)
0 = c_space is not defined in the character definitions        
0 = c_space is not defined in the character definitions
Bit 6 1 = base offset is defined in the character definitions
Bit 6 1 = base offset is defined in the character definitions
    (defined for each character definition)
    (defined for each character definition)
Line 1,402: Line 1,300:
0 = offset to glyph is not defined
0 = offset to glyph is not defined


Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.    
Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.


;ulCharDefSize  
;ulCharDefSize  
Line 1,411: Line 1,309:
:2-byte signed integer. The height of the characters, in pels for image fonts.
:2-byte signed integer. The height of the characters, in pels for image fonts.
;xCellIncrement  
;xCellIncrement  
:2-byte signed integer. The distance, in pels for image fonts, along with the character baseline required to step from one character to the next (when forming a character string).
:2-byte signed integer. The distance, in pels for image fonts, along with the character baseline required to step from one character to the next (when forming a character string).
;xCellA  
;xCellA  
:2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.  
:2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.  
;xCellB  
;xCellB  
:2-byte signed integer. The width of a character (inline direction), in pels for image fonts. (the b_space).  
:2-byte signed integer. The width of a character (inline direction), in pels for image fonts. (the b_space).  
;xCellC  
;xCellC  
:2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).  
:2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).  
Line 1,432: Line 1,330:


Type 1 - fixed pitch width and height font
Type 1 - fixed pitch width and height font
ulIdentity = 0x554E4648;
ulIdentity = 0x554E4648;
ulSIze = 64;
ulSIze = 64;
Line 1,471: Line 1,368:


Type3 - ABC_space width and fixed pitch height font
Type3 - ABC_space width and fixed pitch height font
ulIdentity = 0x554E4648;
ulIdentity = 0x554E4648;
ulSIze = 64;
ulSIze = 64;
Line 1,494: Line 1,390:
a,b,c >= 0
a,b,c >= 0
2. Characters where a, b, and c are definitions for all characters:
2. Characters where a, b, and c are definitions for all characters:
b >= 0  
b >= 0
a, c any integer  
a, c any integer


==The Font Character Group Definition==
==The Font Character Group Definition==
Line 1,510: Line 1,406:
</PRE>
</PRE>


Identity
;Identity:4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55 ('U'+('N'<<8)+('G'<<16)+('H'<<24)).
4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55 ('U'+('N'<<8)+('G'<<16)+('H'<<24)).
;ulSize:4 byte unsigned integer. Size of this structure, in bytes, which includes all entries of UNICHARGROUPENTRY. (i.e. sizeof(UNICHARGROUPDEFINITION) + sizeof(UNICHARGROUPENTRY) * (ulCharGroups - 1))
ulSize
;ulCharGroups:4 byte unsigned integer. The number of the character groups in the record.
4 byte unsigned integer. Size of this structure, in bytes, which includes all entries of UNICHARGROUPENTRY. (i.e. sizeof(UNICHARGROUPDEFINITION) + sizeof(UNICHARGROUPENTRY) * (ulCharGroups - 1))
ulCharGroups  
4 byte unsigned integer. The number of the character groups in the record.
CharGroupEntry
CharGroupEntry
unCharGroups size of array of the UNICHARGROUPENTRY structure.  
unCharGroups size of array of the UNICHARGROUPENTRY structure.  
Line 1,549: Line 1,442:
:4 byte unsigned integer. Indicates the end font index of the character group.
:4 byte unsigned integer. Indicates the end font index of the character group.
;offsetCharDef
;offsetCharDef
:4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
:4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
;offsetImageData
;offsetImageData
:4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.  
:4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.  
Line 1,566: Line 1,459:
:2-byte signed integer. The width of the character shape in the inline direction in pels. (b_space)
:2-byte signed integer. The width of the character shape in the inline direction in pels. (b_space)
;xCellC
;xCellC
:2-byte signed integer. The width of the space after the character in the inline direction in pels. (c_space)
:2-byte signed integer. The width of the space after the character in the inline direction in pels. (c_space)
;yCellBaseOffset
;yCellBaseOffset
:2-byte signed integer. The position of the top of the chraacters in the character group definition relative to the baseline in the direction perpendicular to the baseline in pels.  
:2-byte signed integer. The position of the top of the chraacters in the character group definition relative to the baseline in the direction perpendicular to the baseline in pels.  
Line 1,580: Line 1,473:
  {
  {
UCHAR  Identity[4];
UCHAR  Identity[4];
ULONG   Identity;
ULONG Identity;
ULONG  ulSize;
ULONG  ulSize;
ULONG  ulKernPairs;
ULONG  ulKernPairs;
Line 1,586: Line 1,479:
  } UNIKERNPAIRTABLE;
  } UNIKERNPAIRTABLE;


where:  
where:
 
;Identity:4bytes unsigned integer. Must be 0x554E4B54 ('UNKT'). 0x544B4E55  ('U'+('N'<<8)+('K'<<16)+('T'<<24)).
Identity
;ulSize:4 byte unsigned integer. The size of the stucture in bytes, which includes all entries of KERNINGPAIRS. (i.e. sizeof(UNIKERNINGPAIRTABLE) + sizeof(KERNINGPAIRS) * (ulKernPairs - 1))
4bytes unsigned integer. Must be 0x554E4B54 ('UNKT'). 0x544B4E55  ('U'+('N'<<8)+('K'<<16)+('T'<<24)).
;ulKernPairs:4 byte unsigned integer. The number of kerning pairs in the record.
ulSize
4 byte unsigned integer. The size of the stucture in bytes, which includes all entries of KERNINGPAIRS. (i.e. sizeof(UNIKERNINGPAIRTABLE) + sizeof(KERNINGPAIRS) * (ulKernPairs - 1))  
ulKernPairs    
4 byte unsigned integer. The number of kerning pairs in the record.
KernPairs
KernPairs
ulKernPairs size of array of the KERNINGPAIR structure.
ulKernPairs size of array of the KERNINGPAIR structure.
Line 1,605: Line 1,494:


where:
where:
;ulFirstChar:4 byte unsigned integer. First character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
;ulSecondChar:4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
;lKerningAmount:4 byte signed integer. Kerning value in pels for image fonts. Positive values increase the inter-character spacing while negative values bring the characters closer together.


ulFirstChar
==The Font Character Definition==
4 byte unsigned integer. First character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
===Character Definition Record===
ulSecondChar
4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
lKerningAmount
4 byte signed integer. Kerning value in pels for image fonts.  Positive values increase the inter-character spacing while negative values bring the characters closer together.
The Font Character Definition  
Character Definition 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. The fields in the record should be in the order of the following.
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. The fields in the record should be in the order of the following.
There are ulCharNumber of the records for image fonts.
There are ulCharNumber of the records for image fonts.
Character Glyph Definition Offset (offsetImageData)
Character Glyph Definition Offset (offsetImageData)
4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented.  
4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented.
Character Cell Width (xCellWidth)
Character Cell Width (xCellWidth) 2-byte integer. The width of the character definition in pels.
2-byte integer. The width of the character definition in pels.
Character Cell Height (xCellHeight) 2-byte integer. The height of the character definition in pels.  
Character Cell Height (xCellHeight)  
Character Increment (xCellIncrement) 2-byte integer. The length along the character baseline required to step from this character to the next in pels (when forming a character string).  
2-byte integer. The height of the character definition in pels.  
Character a-space (xCellA) 2-byte signed integer. The width of the space before the character in the inline direction in pels.  
Character Increment (xCellIncrement)
Character b-space (xCellB) 2-byte integer. The width of the character shape in the inline direction in pels.  
2-byte integer. The length along the character baseline required to step from this character to the next in pels (when forming a character string).  
Character c-space (xCellC) 2-byte signed integer. The width of the space after the character in the inline direction in pels.  
Character a-space (xCellA)
Character Baseline Offset (xCellBaseOffset) 2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline in pels.
2-byte signed integer. The width of the space before the character in the inline direction in pels.  
Character b-space (xCellB)
2-byte integer. The width of the character shape in the inline direction in pels.  
Character c-space (xCellC)  
2-byte signed integer. The width of the space after the character in the inline direction in pels.  
Character Baseline Offset (xCellBaseOffset)  
2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline in pels.
  The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.
  The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.
Image Data Format
The bits for each character are stored separately, and start on a byte boundary.  Sequential bytes represent horizontal pieces of the character image.  For example, a 15-bit-wide H is stored as follows:


==Image Data Format==
The bits for each character are stored separately, and start on a byte boundary. Sequential bytes represent horizontal pieces of the character image. For example, a 15-bit-wide H is stored as follows:
<pre>
byte                  byte
byte                  byte
                       
0  00000000 0000000-  1    
0  00000000 0000000-  1
2  01100000 0000110-  3    
2  01100000 0000110-  3
4  01100000 0000110-  5
4  01100000 0000110-  5
6  01100000 0000110-  7    
6  01100000 0000110-  7
8  01100000 0000110-  9    
8  01100000 0000110-  9
10  01111111 1111110-  11    
10  01111111 1111110-  11
12  01111111 1111110-  13    
12  01111111 1111110-  13
14  01100000 0000110-  15
14  01100000 0000110-  15
16  01100000 0000110-  17    
16  01100000 0000110-  17
18  01100000 0000110-  19    
18  01100000 0000110-  19
20  01100000 0000110-  21
20  01100000 0000110-  21
22  00000000 0000000-  23  
22  00000000 0000000-  23  
</pre>
The format is the same as the OS/2 bitmap format of one bit per pel.
The format is the same as the OS/2 bitmap format of one bit per pel.


[[Category:IBM Publication‎]]
[[Category:IBM Publication‎]]

Latest revision as of 15:07, 12 July 2023

Article Info
Author IBM
Date 1997-02-19
OS Version OS/2 2.0
Companion File N/A
Source FontTechnicalInformation_1997-12-10.zip

The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.

The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file. The font directory and the font resource are a set of self-defining records of the form:

 typedef struct _RECORD 
 {
	UCHAR   Identity[4];  /* structure identity code */
	ULONG	Identity;	  /* structure identity code */	
	ULONG   ulSize;       /* structure size in bytes */
	.                     /* data */
	.
	.
 } RECORD;

The notation of bit order defined in this document is that bit 0 is LSB. The elements in the stuructures defined in this document must be aligned in 1 byte boundaries. WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.

The Uni Font Directory

This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font.

Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure. All values in the UNIFONTDIRECTORY structure is stored in the little endian format. The format of the font directory is:

 typedef struct _UNIFONTDIRECTORY
 {
	UCHAR	    Identity[4];
	ULONG		Identity;
	ULONG		ulSize;
	ULONG	    ulUniFontResources;
	ULONG		flEndian;
	ULONG		flFileMode;
	UNIFONTRESOURCEENTRY FontResEntry[1];
 } UNIFONTDIRECTORY;

Where:

Identity
4 byte unsigned integer. Must be 0x554E4644 ('UNFD') 0x44464E55 ('U'+('N'<<8)+('F'<<16)+('D'<<24)).
ulSize
4 byte unsigned integer. The size of the structure, in bytes, which includes all entries of UNIFONTRESOURCEENTRY. (i.e. sizeof(UNIFONTDIRECTORY) + sizeof(UNIFONTRESOURCEENTRY) * (ulUniFontResources - 1))
ulUniFontResources
4 byte unsigned integer. The number of the Uni font resources in the Uni font file.
flEndian
4 bytes of flags to specify the byte order and the bit order of the font file.
UNIFONT_ENDIAN_BYTEOREDER (bit 0) Must be ZERO.
UNIFONT_ENDIAN_BITORDER (bit 1) Must be ZERO.
Other bits must be ZERO.
flFileMode
4 byte of flags to specify file mode.
UNIFONT_WRITABLE (bit 1)
This flag is on if the font file is designated to be updated, such as the user defined font.
FontResEntry
ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.

The format of the Uni font resource entry is

 typedef struct _UNIFONTRESOURCEENTRY
 {
	ULONG		flUniFont;
	LONG		offsetUniFont;
	ULONG		ulBaseUniFont;
 } UNIFONTRESOURCEENTRY;

where:

flUniFont
4 bytes of flags.
UNIFONT_VIRTUAL_FONT (bit 0)
This flag is on if the font is a virtual font. The font definition header, theThe font character group definition and the font character definitions are not included in the font resource. The virtual font can consists of only the font signature, the font metrics, and the font end signature and the font definition header.
(UNIFONT_NAME_UNICODE (bit 1))
This flag is on if the naming such as typeface and familyname is specified in the Unicode string.
(bit1) Reserved. Must be ZERO.
Other bits must be ZERO.
offsetUniFont
4 byte signed integer. The offset from the beginning of the file at which the Uni font resource begins.
ulBaseUniFont.
4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font.

The Uni Font Resource

The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource.

There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource:

  • The font signature (UNIFONTSIGNATURE)
  • The font metrics (UNIFONTMETRICS)
  • The font definition header (UNIFONTDEFINITIONHEADER)
  • The font character group definitions (UNICHARGROUPDEFINITION)
  • The pair kerning table. (Option) (UNIKERNPAIRTABLE)
  • The font character definitions
  • The font end signature (UNIENDFONTRESOURCE)
  • The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field.
  • The font character definition of the image format is only supported.
  • The above figure shows an example of a Uni font resource which has N character group definitions.
  • The Font Signature

A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:

typedef struct _UNIFONTSIGNATURE
{

UCHAR Identity[4]; ULONG Identity; ULONG ulSize; UCHAR szSignature [24]; UCHAR szTechnology[64]; LONG offsetCompressTable; ULONG flFontResource;

} UNIFONTSIGNATURE;

where:

Identity 4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55 ('U'+('N'<<8)+('F'<<16)+('S'<<24)).
ulSize 4 byte unsigned integer. The size of the structure, in bytes.
szSignature 

A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field. szTechnology A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support. offsetCompressTable 4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support. flFontResource 4 Bytes of flags. UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table UNIFONT_PANOSE_EXIST (bit 1) Indicates that the font has PANOSE description Other bits must be ZERO. The Font End Signature

The font end structure has the form:

typedef struct _UNIENDFONTRESOURCE 
{

UCHAR Identity[4]; ULONG Identity; ULONG ulSize;

} UNIENDFONTRESOURCE;

where:

Identity
4 bytes unsigned integer. Must be 0x554E4645 ('UNFE'). 0x45464E55 ('U'+('N'<<8)+('F'<<16)+('E'<<24)).
ulSize
4 byte unsigned integer. The size of the structure, in bytes.

The Font Metrics

This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.

/* #defines for fsType in IFIMETRICS */

#define IFIMETRICS32_FIXED       0x0001
#define IFIMETRICS32_LICENSED    0x0002
#define IFIMETRICS32_KERNING     0x0004
#define IFIMETRICS32_DBCS        0x0010
#define IFIMETRICS32_MBCS        0x0018
#define IFIMETRICS32_FAMTRUNC    0x2000
#define IFIMETRICS32_FACETRUNC   0x1000
#define IFIMETRICS32_UNICODE	 0x0020
#define IFIMETRICS32_NO_CACHE	 0x4000

/* #defines for fsDefn in IFIMETRICS */

#define IFIMETRICS_OUTLINE       0x0001
#define IFIMETRICS32_UDC	     0x0002
#define IFIMETRICS32_ANTI_ALIAS  0x0004

/* #defines for fsSelection in IFIMETRICS */

#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_NEGATIVE    0x1000
#define IFIMETRICS32_HOLLOW      0x0800

typedef struct _IFIMETRICS32
{
  UCHAR   szFamilyname[32];
  UCHAR   szFacename[32];
  UCHAR   szGlyphlistName[16];
  USHORT  idRegistry;
  ULONG   idRegistry;
  LONG    lCapEmHeight;
  LONG    lXHeight;
  LONG    lMaxAscender;
  LONG    lMaxDescender;
  LONG    lLowerCaseAscent;
  LONG    lLowerCaseDescent;
  LONG    lInternalLeading;
  LONG    lExternalLeading;
  LONG    lAveCharWidth;
  LONG    lMaxCharInc;
  LONG    lEmInc;
  LONG    lMaxBaselineExt;
  FIXED   fxCharSlope;
  FIXED   fxInlineDir;
  FIXED   fxCharRot;
  USHORT  usWeightClass;
  USHORT  usWidthClass;
  ULONG   ulWeightClass;
  ULONG   ulWidthClass;
  LONG    lEmSquareSizeX;
  LONG    lEmSquareSizeY;
  GLYPH   giFirstChar;
  GLYPH   giLastChar;
  GLYPH   giDefaultChar;
  GLYPH   giBreakChar;
  USHORT  usNominalPointSize;
  USHORT  usMinimumPointSize;
  USHORT  usMaximumPointSize;
  USHORT  fsType;
  USHORT  fsDefn;
  USHORT  fsSelection;
  USHORT  fsCapabilities;
  ULONG   ulNominalPointSize;
  ULONG   ulMinimumPointSize;
  ULONG   ulMaximumPointSize;
  ULONG   flType;
  ULONG   flDefn;
  ULONG   flSelection;
  ULONG   flCapabilities;
  LONG    lSubscriptXSize;
  LONG    lSubscriptYSize;
  LONG    lSubscriptXOffset;
  LONG    lSubscriptYOffset;
  LONG    lSuperscriptXSize;
  LONG    lSuperscriptYSize;
  LONG    lSuperscriptXOffset;
  LONG    lSuperscriptYOffset;
  LONG    lUnderscoreSize;
  LONG    lUnderscorePosition;
  LONG    lStrikeoutSize;
  LONG    lStrikeoutPosition;
  SHORT   cKerningPairs;
  ULONG   ulKerningPairs;
  ULONG   ulFontClass;
} IFIMETRICS32;
typedef IFIMETRICS32 *PIFIMETRICS32;

typedef struct _UNIFONTMETRICS 
{
	UCHAR	Identity[4]; 
	ULONG   Identity;	
	ULONG   ulSize;
	IFIMETRICS32 ifiMetrics;
	ULONG   flOptions;
	PANOSE  panose;
	ULONG   ulFullFamilynameLen;
	LONG    offsetFullFamilyName;
	ULONG	ulFullFacenameLen;
	LONG    offsetFullFacename;
	UCHAR   szFullFamilyname[256];
	UCHAR   szFullFacename[256];
} UNIFONTMETRICS; 
typedef UNIFONTMETRICS *PUNIFONTMETRICS;

UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields.

Identity
4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)).
ulSize
4 byte unsigned integer. The size of the UNIFONTMETRICS structure, in bytes. Note that the size includes the variable length of the FullFamilyname and the FullFacename string.
flOptions
4 byte unsigned integer. Option flags.
UNIFONTMETRICS_PANOSE_EXIST (bit 0) The panose structure is represented in the Uni font metrics.
UNIFONTMETRICS_FULLFAMILYNAME_EXIST (bit 1) The Full familyname string is represented in the Uni font metrics.
UNIFONTMETRICS_FULLFACENAME_EXIST (bit 2) The full facename string is represented in the Uni font metrics.
ulFullFamilyName
4 byte unsigned integer. This size of FullFamilyName string located by offsetFullFamilyName, in bytes. This size includes NULL terminate character. If the FullFamilyName is not specified in the font file, the field must be ZERO.
offsetFullFamilyName
4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the FamilyName string begins. The Family name string must be NULL terminated.
ulFullFaceName
4 byte unsigned integer. The size of FullFaceName string located by offsetFullFaceName, in bytes. This size includes NULL terminate character. If the FullFaceName is not specified in the font file, this field must be ZERO.
offsetFullFaceName
4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the Face name string begins. The Face name string must be NULL terminated.
szFullFamilyname[256]
256 byte unsigned character array. The full familyname string of the Uni font resource.
szFullFacename[256]
256 byte unsigned character array. The full facename string of the Unifont resource.
panose
PANOSE structure. 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:

typedef struct _PANOSE {
   	BYTE    bFamilyType;
   	BYTE    bSerifStyle;
   	BYTE    bWeight;
   	BYTE    bProportion;
   	BYTE    bContrast;
   	BYTE    bStrokeVariation;
   	BYTE    bArmStyle;
   	BYTE    bLetterform;
   	BYTE    bMidline;
   	BYTE    bXHeight;
   	BYTE    fbPassedISO;
   	BYTE    fbFailedISO;
} PANOSE;

1. Family Kind (bFamilyType - 6 variations) 0 = Any 1 = No Fit 2 = Text and Display 3 = Script 4 = Decorative 5 = Pictorial

2. Serif Style (bSerifStyle - 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 (bWeight - 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 (bProportion - 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 (bContrast - 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 (bStorokeVariation - 9 variations) 0 = Any 1 = No Fit 2 = Gradual/Diagonal 3 = Gradual/Transitional 4 = Gradual/Vertical 5 = Gradual/Horizontal 6 = Rapid/Vertical 7 = Rapid/Horizontal 8 = Instant/Vertical

7. Arm Style (bArmStyle - 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 (bLetterform - 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 (bMidline - 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 (bXHeight - 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

11. fbPassedISO T.B.D

12. fbFailedISO T.B.D

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.

See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.

The Font Definition Header

The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins. This structure defines the format of the character group definition records and the character definition records that follow:

typedef struct _UNIFONTDEFINITIONHEADER 
{
	UCHAR        Identity[4];
	ULONG		 Identity;
	ULONG        ulSize;
	ULONG        flFontDef;
	ULONG		 flGroupDef;
	ULONG		 flCharDef;
	ULONG        ulCharDefSize;
	SHORT        xCellWidth;
	SHORT        yCellHeight;
	SHORT        xCellIncrement;
	SHORT        xCellA;
	SHORT        xCellB;
	SHORT        xCellC;
	SHORT        yCellBaseOffset;
	USHORT	 usReserved;
	GLYPH		 giFirstChar;
	GLYPH		 giLastChar;
	ULONG		 ulCharDefNum;
} UNIFONTDEFINITIONHEADER;
Identity
4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)).
ulSize
4 byte unsigned integer. Size of this structure in bytes.
flFontDef
4 bytes of flags. Indicates which fields are present in the font definition data in the header.
Bit 0
1 = character width is defined in the font definition header (fixed pitch)
0 = character width is not defined in the font definition header
Bit 1
1 = character height is defined in the font definition header (same for all characters)
0 = character height is not defined in the font definition header
Bit 2
1 = character increment is defined in the font definition header (same for all characters)
0 = character increment is not defined in the font definition header
Bit 3
1 = a_space is defined in the font definition header (same for all characters)
0 = a_space is not defined in the font definition header (non abc_space font or defined for each character)
Bit 4
1 = b_space is defined in the font definition header (same for all characters)
0 = b_space is not defined in the font definition header (non abc_space font or defined for each character)
Bit 5
1 = c_space is defined in the font definition header (same for all characters)
0 = c_space is not defined in the font definition header (non abc_space font or defined for each character)
Bit 6
1 = base offset is defined in the font definition header (same for all chracters)
0 = base offset is not defined in the font definition header
flGroupDef
4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).
Bit 0
1 = character width is defined in the character group definitions (defined for each character group)
0 = character width is not defined in the character group definition (same for all characters)
Bit 1
1 = character height is defined in the character group definitions (defined for each character group)
0 = character height is not defined in the character group definitions (same for all characters)
Bit 2
1 = character increment is defined in the the character group definitions (defined for each character group)
0 = character increment is not defined in the character group definitions (same for all characters)
Bit 3
1 = a_space is defined in the character group definitions (defined for each character group)
0 = a_space is not defined in the character group definitions (same for all characters)
Bit 4
1 = b_space is defined in the character group definitions (defined for each character group)
0 = b_space is not defined in the character group definitions (same for all characters)
Bit 5
1 = c_space is defined in the character group definitions (defined for each character group)
0 = c_space is not defined in the character group definitions (same for all characters)
Bit 6
1 = base offset is defined in the character group definitions (defined for each character group)
0 = base offset is not defined in the character group definitions (same for all characters)
flCharDef
4 bytes of flags. Indicates which fields are present on a per character basis.
Bit 0
1 = character width is defined in the character definitions (defined for each character definition)
0 = character width is not defined in the character definitions
Bit 1
1 = character height is defined in the character definitions (defined for each character definition)
0 = character height is not defined in the character definitions
Bit 2
1 = character increment is defined in the the character definitions (defined for each character definition)
0 = character increment is not defined in the character definitions
Bit 3
1 = a_space is defined in the character definitions (defined for each character definition)
0 = a_space is not defined in the character definitions
Bit 4
1 = b_space is defined in the character definitions (defined for each character definition)
0 = b_space is not defined in the character definitions
Bit 5
1 = c_space is defined in the character definitions (defined for each character definition)
0 = c_space is not defined in the character definitions
Bit 6
1 = base offset is defined in the character definitions (defined for each character definition)
0 = base offset is not defined in the character definitions
Bit 7
1 = offset to glyph is defined
0 = offset to glyph is not defined
Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.
ulCharDefSize
4-byte unsigned integer. Indicates the length in bytes of each character definition record (the per character data).
xCellWidth
2-byte signed integer. The width of the characters, in pels for image fonts.
yCellHeight
2-byte signed integer. The height of the characters, in pels for image fonts.
xCellIncrement
2-byte signed integer. The distance, in pels for image fonts, along with the character baseline required to step from one character to the next (when forming a character string).
xCellA
2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.
xCellB
2-byte signed integer. The width of a character (inline direction), in pels for image fonts. (the b_space).
xCellC
2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).
yCellBaseOffset
2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline, in pels for image fonts.
usReserved
2 byte unsigned integer. Must be ZERO.
giFirstChar
4 byte unsigned integer. The index of the first character glyph in the font file.
giLastChar
4 byte unsigned integer. The index of the last character glyph in the font file.
ulCharDefNum
4 byte unsigned integer. The number of the character definitions in the font file. If all of the characters between the first and the last character are defined, the value in this field will be giLastChar - giFirstChar + 1.
WPOS OS/2 1.0 and OS/2 2.2 will support only type1, type2 and type3 font as the font defintion header records are defined as follows.

Type 1 - fixed pitch width and height font ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000047; flGroupDef = 0x00000000; flCharDef = 0x00000081; (width defined for each character for the performance even if the font is deifned as a fixed pitch width font) ulCharDefSize = 6; xCellWidth = Width of the characters yCellHeight = Height of the characters xCellIncrement = Width of the characters xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions Type2 - Proportional width and fixed pitch height font ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000042; flGroupDef = 0x00000000; flCharDef = 0x00000081; ulCharDefSize = 6; xCellWidth = 0 yCellHeight = Height of the characters xCellIncrement = 0 xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions Type3 - ABC_space width and fixed pitch height font ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000042; flGroupDef = 0x00000000; flCharDef = 0x000000B8; ulCharDefSize = 10; xCellWidth = 0 yCellHeight = Height of the characters xCellIncrement = 0 xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions

The following is a explanation of a_space, b_space and c_space definition.

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

The Font Character Group Definition

The character group definition record is defined to support the font indices of a large character set of which indices may consist of sparse ranges.

 typedef struct _UNICHARGROUPDEFINITION 
 {
	UCHAR		Identity[4];
	ULONG		Identity;
	ULONG		ulSize;
	ULONG		ulCharGroups;
	UNICHARGROUPENTRY CharGroupEntry[1];
 } UNICHARGROUPDEFINITION;

Identity 4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55 ('U'+('N'<<8)+('G'<<16)+('H'<<24)). ulSize 4 byte unsigned integer. Size of this structure, in bytes, which includes all entries of UNICHARGROUPENTRY. (i.e. sizeof(UNICHARGROUPDEFINITION) + sizeof(UNICHARGROUPENTRY) * (ulCharGroups - 1)) ulCharGroups 4 byte unsigned integer. The number of the character groups in the record. CharGroupEntry unCharGroups size of array of the UNICHARGROUPENTRY structure. The format of the UNICHARGROUPENTRY is:

typedef struct _UNICHARGROUPENTRY 
{
	ULONG		flCharGroupEntry;
	GLYPH		giFirstChar;
	GLYPH		giLastChar;
	LONG		offsetCharDef;
	LONG		offsetImageData;
	ULONG 	ulImageDataSize;
	SHORT		xCellWidth;
	SHORT		yCellHeight;
	SHORT		xCellIncrement;
	SHORT		xCellA;
	SHORT		xCellB;
	SHORT		xCellC;
	SHORT		yCellBaseOffset;
	USHORT	usReserved;
} UNICHARGROUPENTRY;

where:

flCharGroupEntry
4 bytes of flags. Indicates which fields are present in the character definition data in the header. If the font file is created for a single repository,
UNIFONT_FREQUENT_GROUP (Bit 0) Indicate that this character gorup may be frequestly used. It is recommended that the font subsystem cache the character definitions of this group in memory for the performance when this bit is ON.
giFirstChar
4 byte unsigned integer. Indicates the start font index of the character group.
giLastChar
4 byte unsigned integer. Indicates the end font index of the character group.
offsetCharDef
4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
offsetImageData
4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.
ulImageDataSize
4-byte unsigned integer. The size of the character glyph definition group (image data group).

The following field are defined in the UNICHARGROUPENTRY structure, however, the values may or may not be present in them according to the ulGroupDef field in UNIFONTDEFINITIONHEADER. If the values are present, they are applied for only the character group. xCellWidth 2-byte signed integer. The width of the characters in the character group definition in pels. yCellHeight 2-byte signed integer. The height of the characters in the character group definition in pels. xCellIncrement 2-byte signed integer. The length along the character baseline required to step from this character to the next in pels(when forming a character string). xCellA 2-byte signed integer. The width of the space before the character in the inline direction in pels. (a_space) xCellB 2-byte signed integer. The width of the character shape in the inline direction in pels. (b_space) xCellC 2-byte signed integer. The width of the space after the character in the inline direction in pels. (c_space) yCellBaseOffset 2-byte signed integer. The position of the top of the chraacters in the character group definition relative to the baseline in the direction perpendicular to the baseline in pels. usReserved 2-byte unsigned integer. Must be ZERO. The Kerning Pair Table This record will exist in a Uni font-file format if the UNIFONT_KERNINGPAIRS_EXIST flag in the flFontSignature field in the UNIFONTSIGNATE structure is on. The kerning pair table record is not present if the cKerningPairs field in the UNIFONTMETRICS structure is zero. This table should be sorted by the first character (usFirstChar) and the second character (usSecondChar) order to allow binary searches.

typedef struct _UNIKERNPAIRTABLE 
{
	UCHAR   Identity[4];
	ULONG	Identity;	
	ULONG   ulSize;
	ULONG   ulKernPairs;
	KERNINGPAIRS KernPairs[1];
} UNIKERNPAIRTABLE;

where: Identity 4bytes unsigned integer. Must be 0x554E4B54 ('UNKT'). 0x544B4E55 ('U'+('N'<<8)+('K'<<16)+('T'<<24)). ulSize 4 byte unsigned integer. The size of the stucture in bytes, which includes all entries of KERNINGPAIRS. (i.e. sizeof(UNIKERNINGPAIRTABLE) + sizeof(KERNINGPAIRS) * (ulKernPairs - 1)) ulKernPairs 4 byte unsigned integer. The number of kerning pairs in the record. KernPairs ulKernPairs size of array of the KERNINGPAIR structure.

typedef struct _KERNINGPAIRS 
{
	ULONG   ulFirstChar;
	ULONG   ulSecondChar;
	LONG    lKerningAmount;
} KERNINGPAIRS;

where:

ulFirstChar 4 byte unsigned integer. First character of the kerning pair. This value must be zero-extended when converted to the GLYPH type. ulSecondChar 4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type. lKerningAmount 4 byte signed integer. Kerning value in pels for image fonts. Positive values increase the inter-character spacing while negative values bring the characters closer together. The Font Character Definition Character Definition 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. The fields in the record should be in the order of the following. There are ulCharNumber of the records for image fonts. Character Glyph Definition Offset (offsetImageData) 4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented. Character Cell Width (xCellWidth) 2-byte integer. The width of the character definition in pels. Character Cell Height (xCellHeight) 2-byte integer. The height of the character definition in pels. Character Increment (xCellIncrement) 2-byte integer. The length along the character baseline required to step from this character to the next in pels (when forming a character string). Character a-space (xCellA) 2-byte signed integer. The width of the space before the character in the inline direction in pels. Character b-space (xCellB) 2-byte integer. The width of the character shape in the inline direction in pels. Character c-space (xCellC) 2-byte signed integer. The width of the space after the character in the inline direction in pels. Character Baseline Offset (xCellBaseOffset) 2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline in pels.

The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.

Image Data Format The bits for each character are stored separately, and start on a byte boundary. Sequential bytes represent horizontal pieces of the character image. For example, a 15-bit-wide H is stored as follows:

byte                   byte
 
0   00000000 0000000-   1
2   01100000 0000110-   3	
4   01100000 0000110-   5
6   01100000 0000110-   7
8   01100000 0000110-   9
10  01111111 1111110-  11
12  01111111 1111110-  13
14  01100000 0000110-  15
16  01100000 0000110-  17
18  01100000 0000110-  19
20  01100000 0000110-  21
22  00000000 0000000-  23 

The format is the same as the OS/2 bitmap format of one bit per pel.

The Uni Font-file format

The Uni Font-file format is designed for image fonts which has large character set in the font file such as the DBCS (Double Byte Character Set) and the UNICODE encoding. The Uni Font-file format is a super set format of the OS/2 2.1 PM Font-file format.

The Uni Font-file consists of a Uni font directory and several Uni font resources which are included in the font file.

The font directory and the font resource are a set of self-defining records of the form:

typedef struct _RECORD 
{
	UCHAR   Identity[4];  /* structure identity code */
	ULONG	Identity;	  /* structure identity code */	
	ULONG   ulSize;       /* structure size in bytes */
	.                     /* data */
	.
	.
} RECORD;

The notation of bit order defined in this document is that bit 0 is LSB. The elements in the stuructures defined in this document must be aligned in 1 byte boundaries. WPOS OS/2 1.0 and OS/2 2.2 will support only image fonts for the Uni font-file format.

The Uni Font Directory

This section describes the directory section of a Uni font resource. A Uni font directory contains a directory consisting of a set of structures. Each structure contains the flags, the offset to a Uni font resource, the index to a base Uni font resource if the font is a virtual font. Several Uni font resources can be contained in a Uni font-file by specifying them in the FontResEntry array in the UNIFONTDIRECTORY structure. All values in the UNIFONTDIRECTORY structure is stored in the little endian format. The format of the font directory is:

typedef struct _UNIFONTDIRECTORY
{
	UCHAR	    Identity[4];
	ULONG		Identity;
	ULONG		ulSize;
	ULONG	    ulUniFontResources;
	ULONG		flEndian;
	ULONG		flFileMode;
	UNIFONTRESOURCEENTRY FontResEntry[1];
} UNIFONTDIRECTORY;

Where: Identity 4 byte unsigned integer. Must be 0x554E4644 ('UNFD') 0x44464E55 ('U'+('N'<<8)+('F'<<16)+('D'<<24)). ulSize 4 byte unsigned integer. The size of the structure, in bytes, which includes all entries of UNIFONTRESOURCEENTRY. (i.e. sizeof(UNIFONTDIRECTORY) + sizeof(UNIFONTRESOURCEENTRY) * (ulUniFontResources - 1)) ulUniFontResources 4 byte unsigned integer. The number of the Uni font resources in the Uni font file. flEndian 4 bytes of flags to specify the byte order and the bit order of the font file. UNIFONT_ENDIAN_BYTEOREDER (bit 0) Must be ZERO. UNIFONT_ENDIAN_BITORDER (bit 1) Must be ZERO. Other bits must be ZERO. flFileMode 4 byte of flags to specify file mode. UNIFONT_WRITABLE (bit 1) This flag is on if the font file is designated to be updated, such as the user defined font. FontResEntry ulUniFontResources size of array of the UNIFONTRESOURCEENTRY structure.

The format of the Uni font resource entry is:

typedef struct _UNIFONTRESOURCEENTRY 
{
	ULONG		flUniFont;
	LONG		offsetUniFont;
	ULONG		ulBaseUniFont;
} UNIFONTRESOURCEENTRY;

where: flUniFont 4 bytes of flags. UNIFONT_VIRTUAL_FONT (bit 0) This flag is on if the font is a virtual font. The font definition header, theThe font character group definition and the font character definitions are not included in the font resource. The virtual font can consists of only the font signature, the font metrics, and the font end signature and the font definition header. (UNIFONT_NAME_UNICODE (bit 1)) This flag is on if the naming such as typeface and familyname is specified in the Unicode string. (bit1) Reserved. Must be ZERO. Other bits must be ZERO. offsetUniFont 4 byte signed integer. The offset from the beginning of the file at which the Uni font resource begins. ulBaseUniFont. 4 bytes unsigned integer. The index in the FontResEntry array in UNIFONTDIRECTORY which specifies the base Uni font resource used by the virtual font. This field will be specified only when the font is defined as a virtual font. The Uni Font Resource The Uni font resource format consists of two sections. The first section contains the general attributes of the Uni font resource and describes features such as its typeface, style and nominal size. The second section contains the actual definitions of the characters belonging to the Uni font resource. There are four to six records in a Uni font resource in a Uni font file between the font signature and the font end resource: The font signature (UNIFONTSIGNATURE) The font metrics (UNIFONTMETRICS) The font definition header (UNIFONTDEFINITIONHEADER) The font character group definitions (UNICHARGROUPDEFINITION) The pair kerning table. (Option) (UNIKERNPAIRTABLE) The font character definitions The font end signature (UNIENDFONTRESOURCE) The records in the Uni font resource must be in the order defined above. Former record has less number in the identity field. The font character definition of the image format is only supported. The above figure shows an example of a Uni font resource which has N character group definitions. The Font Signature A Uni font resource starts with a special font-signature structure and ends with an ending structure. The font signature has the form:

typedef struct _UNIFONTSIGNATURE 
{
	UCHAR   Identity[4];
	ULONG	Identity;
	ULONG   ulSize;
	UCHAR   szSignature [24];
	UCHAR	szTechnology[64];
	LONG	offsetCompressTable;
	ULONG   flFontResource;
} UNIFONTSIGNATURE;

where: Identity 4 bytes unsigned integer. Must be 0x554E4653 ('UNFS'). 0x53464E55 ('U'+('N'<<8)+('F'<<16)+('S'<<24)). ulSize 4 byte unsigned integer. The size of the structure, in bytes. szSignature A NULL terminated string. Must be "UNI FONT". The future enhancement of the Uni font-file format may have a different signature in this field. szTechnology A NULL terminated string which represents the compress technology of the character glyph images. If the charcater glyph images are not compressed, the NULL string "" must be placed. This field must be NULL string for WPOS and OS/2 2.2. This field is reserved for the future compressed font support. offsetCompressTable 4 byte signed integer. The offset from the beginning of the file at which the compress table begins. This field will be used only if the compress technology name is specifed in the szTechnology field. This field must be ZERO and reserve for the future compressed font support. flFontResource 4 Bytes of flags. UNIFONT_KERNINGPAIRS_EXIST (bit 0) Indicates that the font has the kerning pairs table UNIFONT_PANOSE_EXIST (bit 1) Indicates that the font has PANOSE description Other bits must be ZERO.

The Font End Signature

The font end structure has the form:

typedef struct _UNIENDFONTRESOURCE 
{
	UCHAR   Identity[4];
	ULONG   Identity;
	ULONG   ulSize;
} UNIENDFONTRESOURCE;

where:

Identity 4 bytes unsigned integer. Must be 0x554E4645 ('UNFE'). 0x45464E55 ('U'+('N'<<8)+('F'<<16)+('E'<<24)). ulSize 4 byte unsigned integer. The size of the structure, in bytes. The Font Metrics This section gives an explanation of how to set the fields of the UNIFONTMETRICS structure which contains the physical font metrics used when creating fonts.

/* #defines for fsType in IFIMETRICS */

#define IFIMETRICS32_FIXED       0x0001 
#define IFIMETRICS32_LICENSED    0x0002 
#define IFIMETRICS32_KERNING     0x0004 
#define IFIMETRICS32_DBCS        0x0010 
#define IFIMETRICS32_MBCS        0x0018 
#define IFIMETRICS32_FAMTRUNC    0x2000 
#define IFIMETRICS32_FACETRUNC   0x1000 
#define IFIMETRICS32_UNICODE	 0x0020
#define IFIMETRICS32_NO_CACHE	 0x4000

/* #defines for fsDefn in IFIMETRICS */

#define IFIMETRICS_OUTLINE      0x0001
#define IFIMETRICS32_UDC	    0x0002
#define IFIMETRICS32_ANTI_ALIAS 0x0004

/* #defines for fsSelection in IFIMETRICS */

#define IFIMETRICS32_ITALIC      0x8000
#define IFIMETRICS32_UNDERSCORE  0x4000
#define IFIMETRICS32_OVERSTRUCK  0x2000
#define IFIMETRICS32_NEGATIVE    0x1000
#define IFIMETRICS32_HOLLOW      0x0800

typedef struct _IFIMETRICS32 
{ 
  UCHAR   szFamilyname[32];
  UCHAR   szFacename[32];
  UCHAR   szGlyphlistName[16];
  USHORT  idRegistry;
  ULONG   idRegistry;
  LONG    lCapEmHeight;
  LONG    lXHeight;
  LONG    lMaxAscender;
  LONG    lMaxDescender;
  LONG    lLowerCaseAscent;
  LONG    lLowerCaseDescent;
  LONG    lInternalLeading;
  LONG    lExternalLeading;
  LONG    lAveCharWidth;
  LONG    lMaxCharInc;
  LONG    lEmInc;
  LONG    lMaxBaselineExt;
  FIXED   fxCharSlope;
  FIXED   fxInlineDir;
  FIXED   fxCharRot;
  USHORT  usWeightClass;
  USHORT  usWidthClass;
  ULONG   ulWeightClass;
  ULONG   ulWidthClass;
  LONG    lEmSquareSizeX;
  LONG    lEmSquareSizeY;
  GLYPH   giFirstChar;
  GLYPH   giLastChar;
  GLYPH   giDefaultChar;
  GLYPH   giBreakChar;
  USHORT  usNominalPointSize;
  USHORT  usMinimumPointSize;
  USHORT  usMaximumPointSize;
  USHORT  fsType;
  USHORT  fsDefn;
  USHORT  fsSelection;
  USHORT  fsCapabilities;
  ULONG   ulNominalPointSize;
  ULONG   ulMinimumPointSize;
  ULONG   ulMaximumPointSize;
  ULONG   flType;
  ULONG   flDefn;
  ULONG   flSelection;
  ULONG   flCapabilities;
  LONG    lSubscriptXSize;
  LONG    lSubscriptYSize;
  LONG    lSubscriptXOffset;
  LONG    lSubscriptYOffset;
  LONG    lSuperscriptXSize;
  LONG    lSuperscriptYSize;
  LONG    lSuperscriptXOffset;
  LONG    lSuperscriptYOffset;
  LONG    lUnderscoreSize;
  LONG    lUnderscorePosition;
  LONG    lStrikeoutSize;
  LONG    lStrikeoutPosition;
  SHORT   cKerningPairs;
  ULONG   ulKerningPairs;
  ULONG   ulFontClass;
} IFIMETRICS32;
typedef IFIMETRICS32 *PIFIMETRICS32;

typedef struct _UNIFONTMETRICS 
{
	UCHAR	Identity[4];
	ULONG   Identity;	
	ULONG   ulSize;
	IFIMETRICS32 ifiMetrics;
	ULONG   flOptions;
	PANOSE  panose;
	ULONG   ulFullFamilynameLen;
	LONG    offsetFullFamilyName;
	ULONG	ulFullFacenameLen;
	LONG    offsetFullFacename;
	UCHAR   szFullFamilyname[256];
	UCHAR   szFullFacename[256];
} UNIFONTMETRICS; 
typedef UNIFONTMETRICS *PUNIFONTMETRICS;

UNIFONTMETRICS is an extension of IFIMETRICS32 which is redefined for the 32 bit environment by assuring the 4 byte alignment. UNIFONTMETRICS has the following additional fields. Identity 4 bytes unsigned integer. This must be 0x554E464D ('UNFM'). 0x4D464E55 ('U'+('N'<<8)+('F'<<16)+('M'<<24)). ulSize 4 byte unsigned integer. The size of the UNIFONTMETRICS structure, in bytes. Note that the size includes the variable length of the FullFamilyname and the FullFacename string. flOptions 4 byte unsigned integer. Option flags. UNIFONTMETRICS_PANOSE_EXIST (bit 0) The panose structure is represented in the Uni font metrics. UNIFONTMETRICS_FULLFAMILYNAME_EXIST (bit 1) The Full familyname string is represented in the Uni font metrics. UNIFONTMETRICS_FULLFACENAME_EXIST (bit 2) The full facename string is represented in the Uni font metrics.

ulFullFamilyName 4 byte unsigned integer. This size of FullFamilyName string located by offsetFullFamilyName, in bytes. This size includes NULL terminate character. If the FullFamilyName is not specified in the font file, the field must be ZERO. offsetFullFamilyName 4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the FamilyName string begins. The Family name string must be NULL terminated. ulFullFaceName 4 byte unsigned integer. The size of FullFaceName string located by offsetFullFaceName, in bytes. This size includes NULL terminate character. If the FullFaceName is not specified in the font file, this field must be ZERO. offsetFullFaceName 4 byte signed integer. The offset from the top of the UNIFONTMETRICS structure at which the Face name string begins. The Face name string must be NULL terminated. szFullFamilyname[256] 256 byte unsigned character array. The full familyname string of the Uni font resource. szFullFacename[256] 256 byte unsigned character array. The full facename string of the Unifont resource. panose PANOSE structure. 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:

typedef struct _PANOSE {

  	BYTE    bFamilyType;
  	BYTE    bSerifStyle;
  	BYTE    bWeight;
  	BYTE    bProportion;
  	BYTE    bContrast;
  	BYTE    bStrokeVariation;
  	BYTE    bArmStyle;
  	BYTE    bLetterform;
  	BYTE    bMidline;
  	BYTE    bXHeight;
  	BYTE    fbPassedISO;
  	BYTE    fbFailedISO;

} PANOSE;

1. Family Kind (bFamilyType - 6 variations) 0 = Any 1 = No Fit 2 = Text and Display 3 = Script 4 = Decorative 5 = Pictorial

2. Serif Style (bSerifStyle - 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 (bWeight - 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 (bProportion - 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 (bContrast - 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 (bStorokeVariation - 9 variations) 0 = Any 1 = No Fit 2 = Gradual/Diagonal 3 = Gradual/Transitional 4 = Gradual/Vertical 5 = Gradual/Horizontal 6 = Rapid/Vertical 7 = Rapid/Horizontal 8 = Instant/Vertical

7. Arm Style (bArmStyle - 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 (bLetterform - 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 (bMidline - 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 (bXHeight - 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

11. fbPassedISO T.B.D

12. fbFailedISO T.B.D

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.

See the definition of IFIMETRICS in the IFI specification for a detailed explanation of the IFIMETRICS fields.

The Font Definition Header

The font definition header contains information about the format of the character definitions, the character group definitions, data about each group, each character including width data and the offset into the definition section at which the character glyph definition begins. This structure defines the format of the character group definition records and the character definition records that follow:

typedef struct _UNIFONTDEFINITIONHEADER 
{
	UCHAR        Identity[4];
	ULONG		 Identity;
	ULONG        ulSize;
	ULONG        flFontDef;
	ULONG		 flGroupDef;
	ULONG		 flCharDef;
	ULONG        ulCharDefSize;
	SHORT        xCellWidth;
	SHORT        yCellHeight;
	SHORT        xCellIncrement;
	SHORT        xCellA;
	SHORT        xCellB;
	SHORT        xCellC;
	SHORT        yCellBaseOffset;
	USHORT	 usReserved;
	GLYPH		 giFirstChar;
	GLYPH		 giLastChar;
	ULONG		 ulCharDefNum;
} UNIFONTDEFINITIONHEADER;

Identity 4 bytes unsigned integer. Must be equal to 0x554E4648 ('UNFH'). 0x48464E55 ('U'+('N'<<8)+('F'<<16)+('H'<<24)). ulSize 4 byte unsigned integer. Size of this structure in bytes. flFontDef 4 bytes of flags. Indicates which fields are present in the font definition data in the header.

Bit 0 1 = character width is defined in the font definition header (fixed pitch) 0 = character width is not defined in the font definition header

Bit 1 1 = character height is defined in the font definition header (same for all characters) 0 = character height is not defined in the font definition header

Bit 2 1 = character increment is defined in the font definition header (same for all characters) 0 = character increment is not defined in the font definition header

Bit 3 1 = a_space is defined in the font definition header (same for all characters) 0 = a_space is not defined in the font definition header (non abc_space font or defined for each character)

Bit 4 1 = b_space is defined in the font definition header (same for all characters) 0 = b_space is not defined in the font definition header (non abc_space font or defined for each character)


Bit 5 1 = c_space is defined in the font definition header (same for all characters) 0 = c_space is not defined in the font definition header (non abc_space font or defined for each character)

Bit 6 1 = base offset is defined in the font definition header (same for all chracters) 0 = base offset is not defined in the font definition header flGroupDef 4 bytes of flags. Indicates which fields are present on a per character group basis. Each flag is valid only when the correnponding flFontDef flag bit is on (= 1).

Bit 0 1 = character width is defined in the character group definitions (defined for each character group) 0 = character width is not defined in the character group definition (same for all characters)

Bit 1 1 = character height is defined in the character group definitions (defined for each character group) 0 = character height is not defined in the character group definitions (same for all characters)

Bit 2 1 = character increment is defined in the the character group definitions (defined for each character group) 0 = character increment is not defined in the character group definitions (same for all characters)

Bit 3 1 = a_space is defined in the character group definitions (defined for each character group) 0 = a_space is not defined in the character group definitions (same for all characters)

Bit 4 1 = b_space is defined in the character group definitions (defined for each character group) 0 = b_space is not defined in the character group definitions (same for all characters)

Bit 5 1 = c_space is defined in the character group definitions (defined for each character group) 0 = c_space is not defined in the character group definitions (same for all characters)

Bit 6 1 = base offset is defined in the character group definitions (defined for each character group) 0 = base offset is not defined in the character group definitions (same for all characters)

flCharDef 4 bytes of flags. Indicates which fields are present on a per character basis.

Bit 0 1 = character width is defined in the character definitions (defined for each character definition) 0 = character width is not defined in the character definitions

Bit 1 1 = character height is defined in the character definitions (defined for each character definition) 0 = character height is not defined in the character definitions

Bit 2 1 = character increment is defined in the the character definitions (defined for each character definition) 0 = character increment is not defined in the character definitions

Bit 3 1 = a_space is defined in the character definitions (defined for each character definition) 0 = a_space is not defined in the character definitions

Bit 4 1 = b_space is defined in the character definitions (defined for each character definition) 0 = b_space is not defined in the character definitions

Bit 5 1 = c_space is defined in the character definitions (defined for each character definition) 0 = c_space is not defined in the character definitions Bit 6 1 = base offset is defined in the character definitions (defined for each character definition) 0 = base offset is not defined in the character definitions

Bit 7 1 = offset to glyph is defined 0 = offset to glyph is not defined

Bit 7 must be ON for WPOS OS/2 1.0 and OS/2 2.2.

ulCharDefSize
4-byte unsigned integer. Indicates the length in bytes of each character definition record (the per character data).
xCellWidth
2-byte signed integer. The width of the characters, in pels for image fonts.
yCellHeight
2-byte signed integer. The height of the characters, in pels for image fonts.
xCellIncrement
2-byte signed integer. The distance, in pels for image fonts, along with the character baseline required to step from one character to the next (when forming a character string).
xCellA
2-byte signed integer. The width of the space before a character in the inline direction (the a_space), in pels for image fonts.
xCellB
2-byte signed integer. The width of a character (inline direction), in pels for image fonts. (the b_space).
xCellC
2-byte signed integer. The width of the space after a character in the inline direction, in pels for image fonts (the c_space).
yCellBaseOffset
2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline, in pels for image fonts.
usReserved
2 byte unsigned integer. Must be ZERO.
giFirstChar
4 byte unsigned integer. The index of the first character glyph in the font file.
giLastChar
4 byte unsigned integer. The index of the last character glyph in the font file.
ulCharDefNum
4 byte unsigned integer. The number of the character definitions in the font file. If all of the characters between the first and the last character are defined, the value in this field will be giLastChar - giFirstChar + 1.

WPOS OS/2 1.0 and OS/2 2.2 will support only type1, type2 and type3 font as the font defintion header records are defined as follows.

Type 1 - fixed pitch width and height font ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000047; flGroupDef = 0x00000000; flCharDef = 0x00000081; (width defined for each character for the performance even if the font is deifned as a fixed pitch width font) ulCharDefSize = 6; xCellWidth = Width of the characters yCellHeight = Height of the characters xCellIncrement = Width of the characters xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions

Type2 - Proportional width and fixed pitch height font

ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000042; flGroupDef = 0x00000000; flCharDef = 0x00000081; ulCharDefSize = 6; xCellWidth = 0 yCellHeight = Height of the characters xCellIncrement = 0 xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions

Type3 - ABC_space width and fixed pitch height font ulIdentity = 0x554E4648; ulSIze = 64; flFontDef = 0x00000042; flGroupDef = 0x00000000; flCharDef = 0x000000B8; ulCharDefSize = 10; xCellWidth = 0 yCellHeight = Height of the characters xCellIncrement = 0 xCellA = 0 xCellB = 0 xCellC = 0 yCellBaseOffset = Baseline offset for all characters ulFirstChar = The glyph index of the first character ulLastChar = The glyph index of the last character ulCharDefNum = The number of the character definitions

The following is a explanation of a_space, b_space and c_space definition.

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

The Font Character Group Definition

The character group definition record is defined to support the font indices of a large character set of which indices may consist of sparse ranges.

typedef struct _UNICHARGROUPDEFINITION 
{
	UCHAR		Identity[4];
	ULONG		Identity;
	ULONG		ulSize;
	ULONG		ulCharGroups;
	UNICHARGROUPENTRY CharGroupEntry[1];
} UNICHARGROUPDEFINITION;
Identity
4 bytes unsigned integer. Must be 0x554E4748 ('UNGH'). 0x48474E55 ('U'+('N'<<8)+('G'<<16)+('H'<<24)).
ulSize
4 byte unsigned integer. Size of this structure, in bytes, which includes all entries of UNICHARGROUPENTRY. (i.e. sizeof(UNICHARGROUPDEFINITION) + sizeof(UNICHARGROUPENTRY) * (ulCharGroups - 1))
ulCharGroups
4 byte unsigned integer. The number of the character groups in the record.

CharGroupEntry unCharGroups size of array of the UNICHARGROUPENTRY structure. The format of the UNICHARGROUPENTRY is :

typedef struct _UNICHARGROUPENTRY 
{

ULONG flCharGroupEntry; GLYPH giFirstChar; GLYPH giLastChar; LONG offsetCharDef; LONG offsetImageData; ULONG ulImageDataSize; SHORT xCellWidth; SHORT yCellHeight; SHORT xCellIncrement; SHORT xCellA; SHORT xCellB; SHORT xCellC; SHORT yCellBaseOffset; USHORT usReserved;

} UNICHARGROUPENTRY;

where:

flCharGroupEntry
4 bytes of flags. Indicates which fields are present in the character definition data in the header. If the font file is created for a single repository,

UNIFONT_FREQUENT_GROUP (Bit 0) Indicate that this character gorup may be frequestly used. It is recommended that the font subsystem cache the character definitions of this group in memory for the performance when this bit is ON.

giFirstChar
4 byte unsigned integer. Indicates the start font index of the character group.
giLastChar
4 byte unsigned integer. Indicates the end font index of the character group.
offsetCharDef
4 bytes signed integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character definition record of this character group begins.
offsetImageData
4-byte unsigned integer. The offset from the beginning of the Uni font resource (the beginning of the font signature structure) at which the character glyph definitions begins which belongs to the character group. All character glyph definitions (Image data) must be stored from the offsetImageData position continuously and must be stored in the ulImageDataSize block size of the block.
ulImageDataSize
4-byte unsigned integer. The size of the character glyph definition group (image data group).

The following field are defined in the UNICHARGROUPENTRY structure, however, the values may or may not be present in them according to the ulGroupDef field in UNIFONTDEFINITIONHEADER. If the values are present, they are applied for only the character group.

xCellWidth
2-byte signed integer. The width of the characters in the character group definition in pels.
yCellHeight
2-byte signed integer. The height of the characters in the character group definition in pels.
xCellIncrement
2-byte signed integer. The length along the character baseline required to step from this character to the next in pels(when forming a character string).
xCellA
2-byte signed integer. The width of the space before the character in the inline direction in pels. (a_space)
xCellB
2-byte signed integer. The width of the character shape in the inline direction in pels. (b_space)
xCellC
2-byte signed integer. The width of the space after the character in the inline direction in pels. (c_space)
yCellBaseOffset
2-byte signed integer. The position of the top of the chraacters in the character group definition relative to the baseline in the direction perpendicular to the baseline in pels.
usReserved
2-byte unsigned integer. Must be ZERO.

The Kerning Pair Table

This record will exist in a Uni font-file format if the UNIFONT_KERNINGPAIRS_EXIST flag in the flFontSignature field in the UNIFONTSIGNATE structure is on.

The kerning pair table record is not present if the cKerningPairs field in the UNIFONTMETRICS structure is zero. This table should be sorted by the first character (usFirstChar) and the second character (usSecondChar) order to allow binary searches.

typedef struct _UNIKERNPAIRTABLE 
{

UCHAR Identity[4]; ULONG Identity; ULONG ulSize; ULONG ulKernPairs; KERNINGPAIRS KernPairs[1];

} UNIKERNPAIRTABLE;

where:

Identity
4bytes unsigned integer. Must be 0x554E4B54 ('UNKT'). 0x544B4E55 ('U'+('N'<<8)+('K'<<16)+('T'<<24)).
ulSize
4 byte unsigned integer. The size of the stucture in bytes, which includes all entries of KERNINGPAIRS. (i.e. sizeof(UNIKERNINGPAIRTABLE) + sizeof(KERNINGPAIRS) * (ulKernPairs - 1))
ulKernPairs
4 byte unsigned integer. The number of kerning pairs in the record.

KernPairs ulKernPairs size of array of the KERNINGPAIR structure.

typedef struct _KERNINGPAIRS { ULONG ulFirstChar; ULONG ulSecondChar; LONG lKerningAmount; } KERNINGPAIRS;

where:

ulFirstChar
4 byte unsigned integer. First character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
ulSecondChar
4 byte unsigned integer. Second character of the kerning pair. This value must be zero-extended when converted to the GLYPH type.
lKerningAmount
4 byte signed integer. Kerning value in pels for image fonts. Positive values increase the inter-character spacing while negative values bring the characters closer together.

The Font Character Definition

Character Definition 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. The fields in the record should be in the order of the following. There are ulCharNumber of the records for image fonts. Character Glyph Definition Offset (offsetImageData) 4 byte signed integer. The offset from the beginning of the Uni font resource at which the character glyph definition begins. This field should be set to zero if the character glyph is not defined in the font file. If the font subsystem detect the zero value in this field, it should return the character glyph image of giDefaultChar index which is specified in UNIFONTMETRICS. This field must be presented. Character Cell Width (xCellWidth) 2-byte integer. The width of the character definition in pels. Character Cell Height (xCellHeight) 2-byte integer. The height of the character definition in pels. Character Increment (xCellIncrement) 2-byte integer. The length along the character baseline required to step from this character to the next in pels (when forming a character string). Character a-space (xCellA) 2-byte signed integer. The width of the space before the character in the inline direction in pels. Character b-space (xCellB) 2-byte integer. The width of the character shape in the inline direction in pels. Character c-space (xCellC) 2-byte signed integer. The width of the space after the character in the inline direction in pels. Character Baseline Offset (xCellBaseOffset) 2-byte signed integer. The position of the top of a character definition relative to the baseline in the direction perpendicular to the baseline in pels.

The xCellWidth and the xCellIncrement field in the FONTDEFINITIONHEADER structure are nonzero and that represents a fixed pitch width font for the type 1 font. However, the type 1 fonts have offset (offsetImageData) and width (xCellWidth) pairs in the character definition records and the proportional-space flag, bit 0, is set in the fsType field of the UNIFONTMETRICS structure. OS/2 2.1 PM font-file format has the same definition for the type 1 fonts.

Image Data Format

The bits for each character are stored separately, and start on a byte boundary. Sequential bytes represent horizontal pieces of the character image. For example, a 15-bit-wide H is stored as follows:

byte                   byte
 
0   00000000 0000000-   1
2   01100000 0000110-   3	
4   01100000 0000110-   5
6   01100000 0000110-   7
8   01100000 0000110-   9
10  01111111 1111110-  11
12  01111111 1111110-  13
14  01100000 0000110-  15
16  01100000 0000110-  17
18  01100000 0000110-  19
20  01100000 0000110-  21
22  00000000 0000000-  23 

The format is the same as the OS/2 bitmap format of one bit per pel.