Txt-Write text

From Vectorlab
Jump to: navigation, search


Procedure to write text on drawing at given coordinates. Sets for maximal text width, justification and alignment. By Orso B. Schmid


{ Orso *********************************************** }
{ writes a string of text on drawing }
{ pass maxTWidth -1 if setting width is not interesting }
{ THIS HANDLES DYNARRAY[] OF CHAR NOW, SO CHECK FOR TROUBLES }
PROCEDURE T_WriteText(theText: DYNARRAY[] OF CHAR; tx, ty, maxTWidth: REAL; tJust, tAlign: INTEGER);
	VAR
		tObj : HANDLE;
		objTxtSize : REAL;
		initDynText : DYNARRAY[] OF CHAR;
		
	BEGIN
		initDynText := '';
		initDynText := Concat(initDynText, theText);
		
		TextOrigin(tx, ty);
		CreateText(initDynText);
		
		tObj := LNewObj;
		SetTextJust(tObj, tJust);
		SetTextVerticalAlign(tObj, tAlign);
		
		IF maxTWidth > 0 THEN
			SetTextWidth(tObj, maxTWidth);
	END;