MocrSetConstraint()函数

Synopsis

Set character position constraints.

Format

void MocrSetConstraint(FontId, CharPos, CharPosType, CharValidString)

MIL_ID FontId; Font identifier
long CharPos; Character position to set
long CharPosType; Grammatical constraint parameter
char *CharValidString; String containing list of valid characters

Description

This function specifies the character value constraints to apply at each position of the string in the target image, when using the specified font. It specifies which characters can appear at given positions in the string to be read, and associates these constraints with the font specified in the FontId parameter. This function can be used to increase speed and reliability when a string has a known format and obeys certain grammatical rules.

The FontId parameter specifies the buffer identifier of the font with which to associate the constraints.

The CharPos parameter specifies the character position in the string for which a constraint is being set. Valid values range from zero to the length of the string minus 1.

The CharPosType parameter, in conjunction with the CharValidString parameter, specifies the type of character which can appear at the specified string position. It can be set to one of the following values:

M_DEFAULT All characters present in the font accepted.
M_DIGIT Only characters “0…9” (ASCII codes 48 to 57) accepted.
M_LETTER Only characters “A…Z”, “a…z” (ASCII codes 65 to 90 and 97 to 122) accepted.
M_LETTER+M_UPPERCASE Only characters “A…Z” (ASCII codes 65 to 90 ) accepted.
M_LETTER+M_LOWERCASE Only characters “a…z” (ASCII codes 97 to 122) accepted.

The CharValidString parameter is an optional, null-terminated string which gives an explicit list of valid characters for the specified position. If this parameter is set to M_NULL, all font characters matching the CharPosType specification will be programmed into the font as valid. If CharValidString is not set to M_NULL, all specified characters must match the CharPosType parameter definition and must exist in the font.

See also

MocrControl

《MocrSetConstraint()函数》上有3条评论

评论已关闭。