Bounding Boxes of Multiline Strings

DESCRIPTION:
Return the number of characters high and wide strings with "\n"s in it would be if they were broken into lines at the "\n".

USAGE:
string.bounding.box(s)

REQUIRED ARGUMENTS:
s:
any S-PLUS object (it will be converted to a vector of character strings)

VALUE:
A list with components "columns" and "rows". The i'th elements of these components give the dimensions of the smallest box enclosing the i'th string in the input after it has been broken up into lines by the "\n" characters in it. i.e., "rows" gives the number of lines and "columns" gives the maximum of the number of characters in all the lines from a single string.

NOTE:
This is useful for formatting text written in constant width fonts, as are common in text windows. However most graphics text is written in variable width fonts so the widths in the "columns" component can only approximate the amount of space required to show the string on a plot.

SEE ALSO:
nchar , string.break.line .

EXAMPLES:
string.bounding.box(c("Two\nLines", "One Line"))

# gives the following output: $columns: [1] 5 8

$rows: [1] 2 1