MocrAllocFont()函数

Synopsis

Allocate an OCR font buffer.

Format

MIL_ID MocrAllocFont(SystemId, FontType, CharNumber, CharBoxSizeX, CharBoxSizeY, CharOffsetX, CharOffsetY, CharSizeX, CharSizeY, CharThickness, StringLength, InitFlag, FontIdPtr)

MIL_ID SystemId; System identifier
long FontType; Font type
long CharNumber; Number of characters in font
long CharBoxSizeX; Width of a character’s box
long CharBoxSizeY; Height of a character’s box
long CharOffsetX; X offset of a character in its box
long CharOffsetY; Y offset of a character in its box
long CharSizeX; Width of a character
long CharSizeY; Height of a character
long CharThickness; Thickness of a character
long StringLength; Length of string to read/verify
long InitFlag; Initialization flag
MIL_ID *FontIdPtr; Storage location for font identifier

Description

This function allocates a new, empty font that can be used to create a custom font. After allocation the font buffer must have its grayscale character representations initialized using the MocrImportFont or MocrCopyFont functions. If the default processing controls and character constraints associated with the newly created font are not satisfactory, they can be changed using MocrControl and MocrSetConstraint.

The main defaults for a newly created font are:

  • All font characters can appear at any position in the string.
  • No checksum is activated.
  • Target character size (X and Y) is set to the font character size.
  • Target character spacing is equal to the target character size X.

Refer to MocrControl for other default values.

Note that for FontTypes M_SEMI_M12_92 and M_SEMI_M13_88, the character constraints have been set according to the SEMI font standards and a checksum calculation is activated. The target character size and spacing are the same as above.

When a font is no longer required, it should be freed with MocrFree.

The SystemId parameter specifies the system on which to allocate the font buffer. This parameter must be given a valid system identifier. Alternatively, the parameter can be set to M_DEFAULT to have MIL automatically select the most appropriate system on which to allocate the buffer (either on the default Host system or on another system already allocated). If this parameter is set to M_DEFAULT_HOST, the default Host system of the current MIL application will be chosen for the allocation.

The FontType parameter specifies the type of font being defined. Possible values for this parameter are:

M_DEFAULT A general user-defined font.
M_SEMI_M12_92 A font respecting the SEMI M12-92 standard.
M_SEMI_M13_88 A font respecting the SEMI M13-88 standard.

The CharNumber parameter determines how many characters can be stored in the font.

The CharBoxSizeX and CharBoxSizeY parameters specify the font character’s box width and height.

The CharOffsetX and CharOffsetY parameters specify the X and Y offsets of a character in its character box.

The CharSizeX and CharSizeY parameters specify the font character width and height.

The CharThickness parameter specifies the maximum thickness (stroke width) of the font character.

The StringLength parameter specifies the length of the string that will be read/verified using the newly allocated font.

The InitFlag parameter is an initialization flag and should be set to either:

M_FOREGROUND_WHITE The characters to read/verify are brighter than the background.
M_FOREGROUND_BLACK The characters to read/verify are darker than the background.

The FontIdPtr parameter specifies the address of the variable to which the font buffer identifier is to be written. If allocation fails, M_NULL is written as the identifier. Since the MocrAllocFont function also returns the buffer identifier, you can set this parameter to M_NULL.

Returned value

This function returns the new font identifier. If allocation fails, M_NULL is returned as the identifier.

See also

MocrCopyFont, MocrImportFont, MocrFree, MocrControl, MocrSetConstraint