The OKFHEADER structure contains the members of an OKF Font file header.
typedef struct tagOKFHEADER {
unsigned char signature[4];
unsigned char version;
union {
unsigned short
flags;
struct {
unsigned short
colorDepth :
1;
unsigned short
bitmapRLEEncoded :
1;
unsigned short alphaMask :
1;
unsigned short maskRLEEncoded :
1;
unsigned short shadowMask :
1;
unsigned short indents :
1;
unsigned short postProcessed :
1;
unsigned short proportional :
1;
unsigned short serif :
1;
unsigned short script :
1;
unsigned short bold :
1;
unsigned short italic :
1;
unsigned short underline :
1;
unsigned short strikethrough :
1;
};
};
unsigned char size;
unsigned char name[32];
unsigned long fileSize;
unsigned long bitmapOffset;
unsigned long maskOffset;
unsigned short transColor;
unsigned short shadowColor;
unsigned char reserved1[2];
unsigned short bitmapWidth;
unsigned char bitmapHeight;
unsigned char defaultWidth;
unsigned char defaultHeight;
unsigned char maxWidth;
unsigned char maxHeight;
signed char
maskWidthInc;
signed char
maskHeightInc;
signed char
shadowOX;
signed char
shadowOY;
signed char
shadowXPos;
signed char
shadowYPos;
signed char
lineSeparation;
signed char
charSeparation;
unsigned char nbChars;
unsigned char reserved2[2];
} OKFHEADER;
Members
signature
An array of 4 unsigned chars that determines the signature of the file. To be a valid OKF Font file, this array must be equal to "OKF\0".
version
The version of the OKF File Format Specification followed by the OKF Font file. Actually always 1.
flags
The flags of the OKF Font file.
colorDepth |
If 0 then font is 8 bits colors, else font is 16 bits colors. |
||
bitmapRLEEncoded | If 1 then font bitmap is RLE encoded, else font is in RAW format. | ||
alphaMask | If 1 then an alpha mask is present in the font file. | ||
maskRLEEncoded | If 1 then font mask is RLE encoded, else mask is in RAW format. | ||
shadowMask | If 1 then the alpha mask is a shadow mask, else alpha mask is a generic mask. | ||
indents | If 1 then left and right char indents are present in the font file. | ||
postProcessed | If 1 then the font bitmap has been post processed by an image processor, else the font bitmap has been generated directly from a TrueType font (or other) and has no fancy colors. | ||
proportional | If 1 then the pitch of the font is proportional, else the pitch is monospaced. | ||
serif | If 1 then the font has serif (like in Times New Roman), else the font has no serif (like Arial). | ||
script | If 1 then the font is a script font. | ||
bold | If 1 then the font is bold. | ||
italic | If 1 then the font is italic. | ||
underline | If 1 then the font is underlined. | ||
strikethrough | If 1 then the font has an horizontal line placed through the characters. |
size
The size of the font. TrueType size when possible.
name
An array of 32 unsigned chars with the name of the font. It's not an zero ended string, although the array is filled with zeros after the last valid character.
fileSize
The total size of the file in bytes.
bitmapOffset
The offset of the first byte of the font bitmap in the font file.
maskOffset
The offset of the first byte of the font mask in the font file. If there is no mask (alphaMask is 0), maskOffset is equal to 0.
transColor
A GP32 16 bits color that represents the transparent color of the font.
shadowColor
A GP32 16 bits color that represents the default color of the font shadow. If there is no shadow (shadowMask is 0), shadowColor is equal to 0.
bitmapOffset
The offset of the first byte of the font bitmap in the font file.
reserved1
Two bytes reserved for future usage. Always 0.
bitmapWidth, bitmapHeight
The size in pixels of the font bitmap.
defaultWidth
The default width of a character in the font. When a character is not found in the font character set, cursor x position (okf.x) is moved defaultWidth pixels to the right (usually this technique is used for the space character).
defaultHeight
The default height of a character in the font. It's also the height of the font.
maxWidth
The width of the widest character in the font character set.
maxHeight
The height of the highest character in the font character set.
maskWidthInc, maskHeightInc
The
size of a shadow mask can be different from the size of the font, maskWidthInc
and maskHeightInc contain the difference in pixels between the size of a
font character and the size of the shadow of the same character.
If there is no shadow (shadowMask is 0), maskWidthInc
and maskHeightInc are equal to 0.
shadowOX, shadowOY
shadowOX
and shadowOY
contain the displacement to add to the coordinates of a character shadow to
place this one just underneath the real character, when shadowXPos
and shadowYPos
are equal to 0. Its the
origin of the shadow.
If there is no shadow (shadowMask is 0), shadowOX
and shadowOY
are equal to 0.
shadowXPos, shadowYPos
shadowXPos
and shadowYPos
contain the default coordinates of the shadow mask in relation the the real
character.
If there is no shadow (shadowMask is 0), shadowXPos
and shadowYPos
are equal to 0.
lineSeparation
Pixels to add to the height of the font when moving the vertical cursor position (okf.y) to the next line.
charSeparation
Pixels to add to the with of the character (including indents when applicable) when moving the horizontal cursor position (okf.x) to the next character.
nbChars
The number of chars included in the font character set.
reserved2
Two bytes reserved for future usage. Always 0.
Remarks
The OKFHEADER structure match the properties of an OKF Font file header.
Some of the members can be modified by program to change the behaviour of a font: indents, transColor, shadowColor, defaultWidth, shadowOX, shadowOY, shadowXPos, shadowYPos, lineSeparation, charSeparation.
A change to one of these members alters permanently a font the same way OkfApplyEffect does on the font bitmap.
Use OkfClone function to make a copy of the font, in case the font with its original settings is also needed in the program.
See Also
OKF Font Engine Routines, OKF Font Engine Structures, OkfApplyEffect, OkfClone