Txt-Write scaled text

From Vectorlab
Jump to: navigation, search


Function to create a scaled text object. Returns a handle to the text object created. Load the routines T_WriteText and T_TxtObj before using this. By Orso B. Schmid


{ Orso ******************************************** }
{ the same but also with style, scaling and rotation }
{ for plugins with pref 800 you can pass -1 to tStyle }
{ tStyle is only interesting for commands }
FUNCTION T_WriteScaledText(theText: DYNARRAY[] OF CHAR; tx, ty, maxTWidth, tRot, tSizeScale: REAL; tJust, tAlign, tStyle: INTEGER): HANDLE;
	VAR
		objTxtSize 	: REAL;
		txtLength	: INTEGER;
		tObj 	: HANDLE;
		temp_b : BOOLEAN;
		
	BEGIN
		TextRotate(tRot);
		tObj := T_TxtObj(theText, tx, ty, maxTWidth, tJust, tAlign);
		
		objTxtSize := GetTextSize(tObj, 0);
		txtLength := Len(getText(tObj));
		
		SetTextSize(tObj, 0, txtLength, Round(objTxtSize * tSizeScale));
		
		IF tStyle > -1 THEN
			SetTextStyle(tObj, 0, txtLength, tStyle);
		
		T_WriteScaledText := tObj;
	END; { T_WriteScaledText }