| MIL 10 Reference
| Customize Help
| Save Settings

MocrCopyFont



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Copy a font character to or from an image buffer.
Syntax
void MocrCopyFont(
MIL_ID ImageBufId, //in
MIL_ID FontContextOcrId, //in
MIL_INT64 Operation, //in
MIL_CONST_TEXT_PTR CharListString //in
)
Description

This function copies a character representation of one, or many, font characters to/from the specified image buffer. This buffer can then be used to initialize, change or obtain a visual representation of the font's characters.

If character representations from the image buffer are being copied to the OCR font context, the OCR font context must be large enough to hold the representations of all the specified characters. You can use MocrInquire() to determine the maximum number of characters that can be stored in the font and the size of each character.

The characters are stored in contiguous cells in the image buffer.

The character representations are read from either a font or an image buffer, 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 the characters in CharListString must exist in the font.

If the character representation being added already exists in the font, it will be replaced by the new character representation. If the character representation does not already exist in the font, it is appended to the end of the font. If the maximum string length, as set using MocrAllocFont(), is equal to or greater than the number of characters in the font (use MocrInquire() with M_CHAR_NUMBER_IN_FONT), an error will occur and the copy operation will fail.

Note that it is crucial that the character representation respects the foreground value as set in MocrAllocFont(). If the foreground value of the character representation does not match, the font will be unusable.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ImageBufId

Specifies the identifier of the image buffer to/from which characters are copied.

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

FontContextOcrId

Specifies the identifier of the OCR font context to/from which the characters are copied.

Operation

Specifies the direction of the copy operation. This parameter can be set to one of the following values:

function map For specifying the direction of the copy operation
CollapseValue Description
Collapse M_COPY_FROM_FONT +

Copies character(s) from a font context to an image buffer.

Note that the maximum number of characters that can be copied from a font context to an image buffer is limited to the number of characters in the font.

Note that The buffer height must be at least the character Cell size Y multiplied by the number of lines necessary to hold all the characters. For more details see MocrInquire() with M_CHAR_CELL_SIZE_Y.

(summarize)
Collapse M_COPY_TO_FONT +

Copies character(s) from an image buffer to a font context.

Combination constant for any of the possible values of the Operation parameter.

You can add the following value to the above-mentioned values to specify that all font characters are copied.

function map For the Operations parameter
CollapseCombination value Description
Collapse M_ALL_CHAR

Copies all font characters to/from the image buffer, stacked from left to right.

Note that when M_ALL_CHAR is added, the CharListString parameter should be set to M_NULL and is ignored.

(summarize)
Combination constant for M_COPY_FROM_FONT.

You can add the following value to the above-mentioned value to specify that fonts are sorted by their ACII character values.

function map For M_COPY_FROM_FONT
CollapseCombination value Description
Collapse M_SORT

Sorts font by its ASCII character values.

CharListString INQ

Specifies a string containing the list of characters to be copied.

function map For specifying the string
CollapseValue Description
Collapse M_NULL

Specifies to ignore this parameter. This is the only possible setting when copying all characters with M_ALL_CHAR.

(summarize)
Collapse MIL_TEXT("CharListString") 1

Specifies the string containing the list of characters to be copied. This string must be null-terminated. Character representations copied to the font are associated with the characters, and their ASCII code, in the string. If a character exists in both the list and the font, the character representation will be overwritten with the new character representation. New characters will be added to the font provided that there is sufficient space in the OCR font context.

If M_ALL_CHAR is added to the Operation parameter, this setting cannot be used.

(summarize)

1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().

Compilation information
Header Include mil.h.
Library Use mil.lib; milocr.lib.
DLL Requires mil.dll; milocr.dll.
PROC NONE COPY FROM FONT COPY TO FONT ALL CHAR SORT NULL