Example: Placing V2 Text

 

IN_OBJECT_HEADER sObjectHeader;

IN_V2_TEXT_OBJECT_PTR psTextObject;

IN_V2_TEXT_PARMS sTextParms;

IN_MEASUREMENT sMeasureHeight;

IN_MEASUREMENT sMeasureWidth;

IN_RGB lRGB = IN_ColorsToRGB( 255, 0, 255 ); //Magenta

int isize = sizeof(IN_V2_TEXT_OBJECT) + strlen("Place this text object"); /* Allocate space for text */

 

/* Allocate memory for the text object */

psTextObject = (IN_V2_TEXT_OBJECT_PTR)malloc(isize);

 

/* Define the text to be placed */

strcpy( psTextObject->str, "Place this text object" );

 

/* Define the object header for the text */

sObjectHeader.objectType = IN_OBJTYPE_TEXT;

sObjectHeader.version = 2;

sObjectHeader.size = isize;

sObjectHeader.flags = IN_OBJFLAG_NEW | IN_OBJFLAG_VISIBLE;

sObjectHeader.objectID = 0;

sObjectHeader.parentID = 0;

 

/* Define the measurement parameters for the text */

sMeasureHeight.value = 0.2;

sMeasureHeight.units = IN_UNITS_INCH;

sMeasureWidth.value = 0.07222;

sMeasureWidth.units = IN_UNITS_INCH;

 

/* Define object parameters for the text */

sTextParms.color = lRGB;

sTextParms.typeface = IN_TYPEFACE_NORMAL;

sTextParms.fontName = "Times New Roman"

sTextParms.height = sMeasureHeight;

sTextParms.width = sMeasureWidth;

sTextParms.rotation = 0;

sTextParms.justification = IN_JUST_LEFT | IN_JUST_TOP;

sTextParms.mirror = IN_MIRROR_NONE;

sTextParms.orientation = 0;

sTextParms.shear = 0;

sTextParms.lineStyle = IN_LINE_SOLID;

sTextParms.fillStyle = IN_FILL_OPAQUE;

sTextParms.fillColour = lRGBFill;

sTextParms.hatchStyle = IN_HATCH_45DEG;

sTextParms.outlineThickness = IN_MEASUREMENT;

 

 

/* Define the measurement parameter for the outlineThickness */

sMeasurement.value = .005;

sMeasurement.units = IN_UNITS_INCH;

 

 

/* Define the font */

strcpy(sTextParms.fontName, "Times New Roman" );

 

/* Define the text object itself. The text was defined earlier. */

psTextObject->header = sObjectHeader;

psTextObject->parms = sTextParms;

psTextObject->point.x = 0.1;

psTextObject->point.y = 1.4;

 

/* Place the text on edit layer 1028 */

if ( ( nError = IN_PlaceVectorObject( 1028, psTextObject, isize ) ) != IN_SUCCESS )

 {

  ErrorHandler( nError, "Error message:" );

 }

 

/*Free the memory set aside for the text object */

free(psTextObject);