Returns the size that text would take up if it was drawn.

 

   
Syntax
 
     

[VBScript]
outVals = Canvas.TextArea(inText, inParams, outW, outH, outLH)

 

   
Params
 
     
Name   Type   Description
inText String The text to be drawn.
inParams String A parameter string containing Override parameters, Positioning parameters and Transform parameters.
outW String On return set to the width of the text.
outH String On return set to the height of the text.
outLH String On return set to the height of one line of text.
outVals String The three values outW, outH and outLH in a comma delimited string. This value is needed when coding in JScript as values are not passed back by reference in JScript.

 

   
Notes
 
     

This method takes the same arguments as the DrawText method. However it measures the area the text would cover rather than doing any drawing.

TextArea starts by extending a rectangle to the right until the width of the supplied rectangle has been reached. After this it extends the rectangle down, line by line until the end of the text.

 

   
See Also
 
     

Canvas DrawText function.
Canvas TextLength function.

 

   
Example
 
     

[VBScript]
Set mycanvas = Server.CreateObject("ImageGlue7.Canvas")
mytext = "In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with..."
myparams = "Rect=10,10,290,290"
mycanvas.Color = "cyan"
mycanvas.Width = 300
mycanvas.Height = 300
mycanvas.TextFont = "Franklin Gothic, Verdana, Arial"
mycanvas.TextSize = 18
mycanvas.DrawText mytext, myparams
mycanvas.TextArea mytext, myparams, mywidth, myheight, mylineheight
mycanvas.DrawShape "rect", "Operation=draw Pos=10,10 Size=" & mywidth & "," & myheight
mycanvas.DrawShape "rect", "Operation=draw Pos=10,10 Size=" & mywidth & "," & mylineheight
mycanvas.SaveAs Server.MapPath("textarea.jpg"), "Quality=high"

The code above draws out a short piece of text onto a canvas. After it has drawn it it measures the length of the text and draws a box round it and around the first line. The image that is saved is shown below.

textarea.jpg