| Customize Help
| Save Settings

MstrEditFont



Function Map
Synopsis
Edit a specified font.
Syntax
void MstrEditFont(
MIL_ID ContextId, //in
MIL_INT FontIndex, //in
MIL_INT64 Operation, //in
MIL_INT64 OperationMode, //in
MIL_INT Param1, //in
const void *Param2Ptr, //in
const void *Param3Ptr //in
)
Description

This function allows you to edit a specified font. For example, you can add or remove characters from a font, as well as normalize a character in a font. Use MstrControl() with M_FONT_ADD to add a font to the context.

Note that this function is only available for a font-based context.

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 which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextId

Specifies the String Reader context that contains the font to edit. The String Reader context must have been previously allocated on the required system using MstrAlloc().

FontIndex

Specifies the index of the font to edit.

function map For specifying the font to edit
Click to summarizeValue Description
Click to summarize

Specifies the font to which to apply the edit settings.

(summarize)
Parameters

This parameter specifies the index of the font to edit. You can set this parameter to the following:

0 <= Value < M_NUMBER_OF_FONTS

Specifies the index of the individual font.

Operation

Specifies the operation to be performed.

See the Parameter associations section for possible values that can be specified.

OperationMode

Specifies the mode of the operation.

See the Parameter associations section for possible values that can be specified.

Param1

Specifies a value that is dependent on the operation and mode chosen.

Set this parameter to M_DEFAULT if not used.

See the Parameter associations section for possible values that can be specified.

Param2Ptr
Accepts the address of one of the following (see the Parameter associations section for specifics on which is expected):
  • array of type char [optionally, in C++: a reference to a constant std::vector<char> ]
  • array of type short [optionally, in C++: a reference to a constant std::vector<short> ]
  • char
  • short

Specifies the address of the value that will be used to edit the font. The value is dependent on the operation and mode chosen.

See the Parameter associations section for possible values that can be specified.

Param3Ptr
Accepts the address of one of the following (see the Parameter associations section for specifics on which is expected):
  • M_NULL
  • MIL_CONST_TEXT_PTR [optionally, in C++: a reference to a MIL_STRING]

Specifies the address of the value that will be used to edit the font. The value is dependent on the operation and mode chosen.

Set this parameter to M_NULL if not used.

See the Parameter associations section for possible values that can be specified.

The table below lists possible values for the Operation, OperationMode, Param1, Param2Ptr, and Param3Ptr parameters.

To specify the operation to perform, set the Operation, OperationMode, Param1, Param2Ptr, and Param3Ptr parameters to the following values:

function map For performing the operation
Click to summarize
Operation
Description
OperationMode
Param1
Param2Ptr
Param3Ptr
Click to summarize M_CHAR_ADD

Adds character(s) to the font.

(summarize)
Click to summarize M_SYSTEM_FONT +

Specifies that characters from a given system font (for example, TrueType and Postscript) will be added.

(summarize)
Click to summarize Param1

Specifies the size of the characters to add. INQ

(summarize)
Click to summarize Value > 6

Specifies the size, in points.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all of the characters to add.

Two characters in one font cannot have the same value. If you try to add a character with a value that already exists in a font, the existing character will be replaced by the newly added one, unless you use M_NO_OVERWRITE. For more information, see the combination constants tables below.

(summarize)
Click to summarize M_NULL

Specifies that the standard characters of the font will be added. That is, A to Z, a to z, and 0 to 9.

(summarize)
Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: address of a MIL_CONST_TEXT_PTR [optionally, in C++: MIL_STRING ]

Specifies the following.

(summarize)
Click to summarize MIL_TEXT("System font file name") 1

Specifies the string containing the font's file name (for example, "TrueType" and "Postscript"). This must be a null-terminated string.

(summarize)
Click to summarize M_USER_DEFINED +

Specifies that user-defined characters will be added from a given image to the specified font.

(summarize)
Click to summarize Param1

Specifies the identifier of the image containing the characters to add.

(summarize)
Click to summarize Image identifier

Specifies the image identifier. The characters to add in the image must all be approximately the same size. You cannot add a character that is smaller than 6x6 pixels. Note that the size of the characters is automatically determined from the image.

The characters in the image are taken from left to right and from top to bottom and are associated with the corresponding characters given in the character list. Each character in the image must be entirely connected (except for the accentuated characters) and should not be merged with other characters or other image objects.

It is best to provide a character definition image that is of good quality, and that ideally contains only the characters that you want to add to the font (though this is not mandatory). If all the characters in the string you want to add cannot be found in the image, an error is returned. Even if the operation succeeds, you should draw the characters of the font to ensure that every character is defined as expected, using MstrDraw().

The image must be of type 1-band, 8-bit, unsigned. 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.

(summarize)
Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies a string that identifies the character values to associate with the character representations in the image specified in the Param1 parameter. Unlike M_SYSTEM_FONT, this setting is not optional.

(summarize)
Click to summarize "String"

Specifies the string. This must be a null-terminated string.

Two characters in one font cannot have the same value. If you try to add a character with a value that already exists in a font, the existing character will be replaced by the newly added one, unless you use M_NO_OVERWRITE. For more information, see the combination constants tables below.

For a multi-string definition image, the space character (ASCII 32) must be inserted to separate the strings included in this null-terminated string. You should separate the string when one (or more) of the following situations is encountered: the characters are not all on the same line, the contrast is clearly different between characters, there is clearly a horizontal space between the characters (for example, ABC DEF).

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_USER_DEFINED + M_SINGLE +

Specifies that the whole image will be used to define a single user-defined character in the specified font. This allows you to define special characters, which are not necessarily connected. The image is associated with the character specified by the Param2Ptr parameter.

It is best to provide a character definition image that is of good quality. Note that if the character you want to add already exists in the font, the new character will replace the old one. You cannot add a character that is smaller than 6x6 pixels. By default, user-defined characters have no baseline.

(summarize)
Click to summarize Param1

Specifies the identifier of the image containing the characters to add.

The image must be of type 1-band, 8-bit, unsigned. 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.

(summarize)
Click to summarize Param2Ptr
Data type info: Data type: address of a char  |  address of a short MORE

Specifies the pointer of the character to add.

Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_CHAR_BASELINE

Sets the baseline of the characters in the font. INQ

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

By default, for system fonts (M_SYSTEM_FONT), the baseline will be taken from that font's file.

By default, for user-defined fonts (M_USER_DEFINED), the baseline will be set to M_AUTO_COMPUTE, which automatically computes the baseline to an appropriate value.

When using a font to read a string model, the baseline of all characters in the string model are expected to be aligned together within a certain degree of tolerance (set using MstrControl() with M_CHAR_MAX_BASELINE_DEVIATION), otherwise the string will not be read.

(summarize)
Click to summarize Param1

Specifies the baseline.

(summarize)
Click to summarize M_AUTO_COMPUTE

Specifies that the baseline will be automatically computed to an appropriate value.

Click to summarize M_NONE

Specifies no baseline.

Click to summarize -1000 <= Value <= 1000

Specifies the baseline value, as a percentage of the character's height.

The position of the baseline in a character is defined as a percentage of the height of the character. That is, 0 refers to the bottom of character, 100 refers to the top of the character, and 50 refers to the middle of character. For example, in "ABCD", you would typically set the baseline to 0 for all characters, while in "pobq", you would typically set the baseline to 0 for "ob" and approximately 25 for "pq". Note that you can set a baseline value that falls outside the limits of the character's height (Y-size).

(summarize)
Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters for which you want to set a baseline.

(summarize)
Click to summarize M_NULL

Specifies that the baseline will be set for all the characters in the font.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_CHAR_DELETE

Deletes characters from the font.

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

(summarize)
Click to summarize Param1

This parameter must be set to M_DEFAULT.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to delete.

(summarize)
Click to summarize M_NULL

Specifies to delete all the characters in the font.

Click to summarize "String"

Specifies the string of characters to delete. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_CHAR_NORMALIZE

Normalizes the characters of the font.

(summarize)
Click to summarize M_SIZE_X

Specifies that the characters of the font are normalized by taking the X-size as the reference. That is, all the specified characters will be uniformly scaled to a given X-size. Note that the characters' Y-size is adjusted to maintain the same aspect ratio.

(summarize)
Click to summarize Param1

Specifies the X-size. INQ

(summarize)
Click to summarize Value >= 8

Specifies the size, in pixels.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to normalize.

(summarize)
Click to summarize M_NULL

Specifies that all the characters in the font will be normalized a given X-size.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_SIZE_Y

Specifies that the characters of the font are normalized by taking the Y-size as the reference. That is, all the specified characters will be uniformly scaled to a given Y-size. Note that the characters' X-size is adjusted to maintain the same aspect ratio.

(summarize)
Click to summarize Param1

Specifies the Y-size. INQ

(summarize)
Click to summarize Value >= 8

Specifies the size, in pixels.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to normalize.

(summarize)
Click to summarize M_NULL

Specifies that all the characters in the font will be normalized a given Y-size.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_CHAR_SORT

Sorts the characters of the font.

(summarize)
Click to summarize M_ASCENDING

Specifies that the characters will be sorted, according to their character values, in ascending order.

(summarize)
Click to summarize Param1

This parameter must be set to M_DEFAULT.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to sort.

(summarize)
Click to summarize M_NULL

Specifies that all the characters in the font will be sorted in ascending order.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_DESCENDING

Specifies that the characters will be sorted, according to their character values, in descending order.

(summarize)
Click to summarize Param1

This parameter must be set to M_DEFAULT.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to sort.

(summarize)
Click to summarize M_NULL

Specifies that all the characters in the font will be sorted in descending order.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_CHAR_TYPE

Sets the type of the characters in the font.

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

(summarize)
Click to summarize Param1

Specifies the characters' type. INQ

(summarize)
Click to summarize M_AUTO_COMPUTE

Specifies that the characters' type will be computed automatically. The type will be set to either M_REGULAR or M_PUNCTUATION, based on the character's shape and numerical code.

(summarize)
Click to summarize M_PUNCTUATION

Specifies punctuation type characters. Punctuation characters can typically be categorized as characters that are neither letters nor numbers, such as the hyphen ('-'). Note that to be considered part of the string, a punctuation character must fall within the range of at least one regular character's Y-size.

(summarize)
Click to summarize M_REGULAR

Specifies regular type characters. Regular characters can typically be categorized as letters and numbers. Note that a string is formed by a linear sequence of regular characters.

(summarize)
Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters for which to set the type.

(summarize)
Click to summarize M_NULL

Specifies that the type will be set for all the characters in the font.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

Click to summarize M_THICKEN_CHAR

Thickens the characters of the font. The characters of the font should always be the thickened version, so use this Operation if the font has dotted characters. INQ

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

(summarize)
Click to summarize Param1

Specifies the number of character thickening iterations.

Each iteration enlarges the thickness of the target character of the font. This is useful for some types of fonts (for example, dotted characters). You should choose a value large enough for the intra character dots to connect.

(summarize)
Click to summarize 0 <= Value <= 100

Specifies the number of iterations.

Click to summarize Param2Ptr
Data type info: Data type: array of type char [optionally, in C++: a reference to a constant std::vector<char> ]  |  array of type short [optionally, in C++: a reference to a constant std::vector<short> ] MORE

Specifies an optional string containing all the characters to normalize.

(summarize)
Click to summarize M_NULL

Specifies to normalize all the characters of the font.

Click to summarize "String"

Specifies the string. This must be a null-terminated string.

(summarize)
Click to summarize Param3Ptr
Data type info: Data type: Set this parameter to M_NULL

This parameter must be set to M_NULL.

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

Combination values for M_USER_DEFINED (when Operation=M_CHAR_ADD); M_USER_DEFINED + M_SINGLE (when Operation=M_CHAR_ADD).

You can add one of the following values to the above-mentioned values to set the foreground of the characters in the definition image when adding user-defined characters to a font.

Note that when a font is defined, it has no foreground. When performing a read operation (MstrRead()), the foreground the font is read with is set using M_FOREGROUND_VALUE in MstrControl(). In this case (when adding user-defined characters to a font), you are setting the foreground for the font in the definition image.

function map For setting the foreground of the characters
Click to summarizeCombination value Description
Click to summarize M_FOREGROUND_BLACK

Specifies that black is the foreground color, for the definition image.

This is the default value.

(summarize)
Click to summarize M_FOREGROUND_WHITE

Specifies that white is the foreground color, for the definition image.

Combination value for M_SYSTEM_FONT (when Operation=M_CHAR_ADD); M_USER_DEFINED (when Operation=M_CHAR_ADD); M_USER_DEFINED + M_SINGLE (when Operation=M_CHAR_ADD).

You can add the following value to the above-mentioned values to specify that characters will not be added to the font if they already exist.

function map For not overwriting characters
Click to summarizeCombination value Description
Click to summarize M_NO_OVERWRITE

Specifies that the characters previously added to the font will not be overwritten.

This is the default value.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milstr.lib.
DLL Requires mil.dll; milstr.dll.
NUMBER OF FONTS CHAR ADD SYSTEM FONT NULL USER DEFINED UNSIGNED PROC NONE USER DEFINED M SINGLE UNSIGNED PROC NONE CHAR BASELINE DEFAULT AUTO COMPUTE NONE NULL CHAR DELETE DEFAULT NULL CHAR NORMALIZE SIZE X NULL SIZE Y NULL CHAR SORT ASCENDING NULL DESCENDING NULL CHAR TYPE DEFAULT AUTO COMPUTE PUNCTUATION REGULAR NULL THICKEN CHAR DEFAULT NULL FOREGROUND BLACK FOREGROUND WHITE NO OVERWRITE ASCII UNICODE