Попробуй так
Function TextInRect(x,y,mes$,xs)
Local det_byte$=Chr$(32)
Local ptr=1
info_str=0
While True
d_len=0
bool=0
For i=ptr To Len(mes$)
d_len=d_len+StringWidth(Mid(mes$,i,1))
If d_len>xs bool=1:Exit
Next
tex$=Mid(mes$,ptr,i-ptr)
If bool
For i2=Len(tex$) To 1 Step -1
If Mid$(tex$,i2,1)=det_byte$ Exit
Next
ptr=ptr+i2
If i2
tex$=Left(tex$,i2-1)
EndIf
EndIf
For ii=1 To Len(tex$)
If info_al>.3 Text x+StringWidth(Left(tex$,ii-1)),y,Mid(tex$,ii,1)
Next
y=y+32*fxa;StringHeight(tex$)
info_str=info_str+1
If bool=0 Exit
Wend
Return it
End Function
и подруби инклюды из аттача
ftext.rar