MocrImportFont()函数

Synopsis

Import font data from file on disk.

Format

void MocrImportFont(FileName, FileFormat, Operation, CharListString, FontId)

char *FileName; Name of font data source file
long FileFormat; File format
long Operation; Operation type
char *CharListString; String containing list of characters
MIL_ID FontId; Font identifier

Description

This function imports font character representations from a file to initialize or overwrite an existing font. This function’s main use is to initialize custom fonts.

The FileName parameter specifies the name of the file from which to retrieve the font character representation information.

The FileFormat parameter specifies how the data is stored in the file. Possible formats are:

M_MIL MIL format image file.
M_TIFF TIFF format image file.
M_FONT_ASCII User-drawn ASCII file.

When either M_MIL or M_TIFF is selected as the file format, the characters in the string specified by CharListString are read from the image file. The font character data is read from this file assuming that the source image is a grid of character representations matching the specified font size. The character representations are read from left to right and top to bottom, and the number of characters in the source image must equal the number of characters in the list pointed to by CharListString.

When M_FONT_ASCII is selected as FileFormat, font character data is to be presented as follows:

File representation Comments
MIL_ASCII_FONT<CR> Specifies ASCII file format
<CR> Optional end-of-line(s)
CharValue 65<CR> Identifier of start of first character, followed by a space, followed by the value (generally ASCII) associated with that character data
00 00 00 00 00 00 00 <CR> Data of character matching box size X
00 00 00 FF 00 00 00 <CR> Data of character matching box size X
00 00 00 FF 00 00 00 <CR> Data of character matching box size X
00 FF FF FF FF FF 00 <CR> Data of character matching box size X
00 00 00 FF 00 00 00 <CR> Data of character matching box size X
00 00 00 FF 00 00 00 <CR> Data of character matching box size X
00 00 00 00 00 00 00 <CR> Data of character matching box size X
<CR> Optional end-of-line(s)
CharValue 66<CR> Identifier of start of next character, followed by a space, followed by the value (generally ASCII) associated with that character data
etc.

For an example of a user-drawn ASCII file see the semi.txt file in the MILEXAMPLES directory.

The Operation parameter indicates the type of import operation to be performed. It should be set to M_LOAD_CHARACTER.

The CharListString parameter specifies a null-terminated string giving the list of characters to be read from the font file. The number of characters in this list must match the number of character representations present in the source image. For the M_FONT_ASCII FileFormat, this parameter is ignored and must be set to M_NULL since the codes associated with each character representation are already included in the file.

The FontId parameter specifies the font identifier to which character representations will be written.

See also

MocrAllocFont, MocrCopyFont, MocrRestoreFont, MocrSaveFont

《MocrImportFont()函数》上有2条评论

评论已关闭。