How To Predict Absolute Width of Text String?
- To: mathgroup at smc.vnet.net
- Subject: [mg30351] How To Predict Absolute Width of Text String?
- From: rml27 at cornell.edu (Ronnen Levinson)
- Date: Sat, 11 Aug 2001 03:40:16 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi. Is there any easy way in Mathematica 4 to determine the absolute width (in, say, points) of a text string in a given variable-width font and point size? In other words, I'd like to know the dimensions of the text's bounding box. The idea here is that I have some frame labels that need to be no longer than, say, 3", and I'd like to automatically adjust the point size to make them fit. I don't have enough space to use a mono-width font like Courier. I can make a rough guess that the width of the bounding box is a * p * n, where p = point size, n = StringLength, and 0< a < 1, but I don't know how to calculate a without working out the width of each character in the string, which is more work than I'd looking for. Yours truly, Ronnen Levinson.