This function retrieves the height and width of the text from the text information.

[C++Builder]     BOOL IKGetTextExtent(HDC hDC, LPLONG Width, LPLONG Height, PTR_IKPRINT_TEXTINFO TextInfo, LPCTSTR Text, BYTE UnitMode);
[Delphi]         function IKGetTextExtent(hDC: HDC; var Width, Height: Longint; var TextInfo: IKPRINT_TEXTINFO; Text: PChar; UnitMode: Byte): LongBool;

Parameters

Name Explanation
hDC The device context
Width Retrieves the width of the text
Height Retrieves the height of the text
TextInfo Structure whose members set the drawing information
Text The string parameter containing the text
UnitMode The units of measure of the retrieved values (0: pixels, 1: 0.1mm)

Return Value

Returns True (nonzero) if successful. Returns False (0) if unsuccessful.

Explanation

The IKGetTextExtent function retrieves the height and width of the text from the text information (single line only).

To execute this function the CharSet, FontName, FontSize, Direction, CharAngle, and RotateString member variables of the TextInfo structure should be set. If the CharExtra value is 1 or more, the values returned in the Width and Height parameters will reflect the additional space between characters. When the RotateString value is False, regardless of the direction of the text or the rotation of the characters, the Width parameter refers to the horizontal size of the text and the Height parameter refers to the vertical size of the text. When the RotateString value is True, the Width parameter refers to the size of the text in the direction that it is drawn and the Height parameter refers to the size of the text in the vertical direction. When the RotateString is False, CharAngle is enabled only for values of 0, 90, 180, and 270 degrees.

If the UnitMode parameter is 0 then the Width and Height parameters will be in pixel units. If the UnitMode parameter is 1 then the Width and Height parameters will be in 0.1mm units.

The differences from the ImageKit5

Name Explanation
IK5GetTextExtent(A): hDC, Width, Height, PrintInfo
IKGetTextExtent: hDC, Width, Height, TextInfo, Text, UnitMode

PrintInfo and TextInfo structures are different, however the member variables in PrintInfo are used in the same way in TextInfo.

IK5PRINT_DATA --> IKPRINT_TEXTINFO
CharExtra, CharSet, RotateString, Alpha1, Alpha2, and HotkeyPrefix have been added. The Text structure has been deleted.
TextForeColor and TextBackColor have been renamed to TextColor1 and TextColor2.
IK5PRINT_DATA_A --> IKPRINT_TEXTINFO
CharSet, RotateString, Alpha1, Alpha2, and HotkeyPrefix have been added. The Text structure has been deleted.
TextForeColor and TextBackColor have been renamed to TextColor1 and TextColor2.

If PrintInfo.Text is set into the Text parameter, IK5SetDeviceMode value is set into the UnitMode parameter and the TextInfo structure members CharSet is set to -1 and RotateString set to 0, then this function will execute nearly the same as in the ImageKit5.PrintInfo.

The differences from the ImageKit6

Alpha1, Alpha2, and HotkeyPrefix have been added. TextForeColor and TextBackColor have been renamed.

 

The ImageKit10 VCL is a product created by Newtone Corporation