<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

ToBeReviewed/STRING/

str_size.pro

topSTR_SIZE

result = STR_SIZE(string, targetWidth, INITSIZE=INITSIZE, STEP=STEP)

NAME: STR_SIZE PURPOSE: The purpose of this function is to return the proper character size to make a specified string a specifed width in a window. The width is specified in normalized coordinates. The function is extremely useful for sizing strings and labels in resizeable graphics windows. CATEGORY: Graphics Programs, Widgets. CALLING SEQUENCE: thisCharSize = STR_SIZE(thisSting, targetWidth) INPUTS: thisString: This is the string that you want to make a specifed target size or width. OPTIONAL INPUTS: targetWidth: This is the target width of the string in normalized coordinates in the current graphics window. The character size of the string (returned as thisCharSize) will be calculated to get the string width as close as possible to the target width. The default is 0.25. KEYWORD PARAMETERS: INITSIZE: This is the initial size of the string. Default is 1.0. STEP: This is the amount the string size will change in each step of the interative process of calculating the string size. The default value is 0.05. OUTPUTS: thisCharSize: This is the size the specified string should be set to if you want to produce output of the specified target width. The value is in standard character size units where 1.0 is the standard character size. EXAMPLE: To make the string "Happy Holidays" take up 30% of the width of the current graphics window, type this: XYOUTS, 0.5, 0.5, ALIGN=0.5, "Happy Holidays", $ CHARSIZE=STR_SIZE("Happy Holidays", 0.3) MODIFICATION HISTORY: Written by: David Fanning, 17 DEC 96. Added a scaling factor to take into account the aspect ratio of the window in determing the character size. 28 Oct 97. DWF

Parameters

string       

targetWidth       

Keywords

INITSIZE       

STEP       

Produced by IDLdoc 2.0.