text bounding box size
- To: mathgroup at smc.vnet.net
- Subject: [mg64305] text bounding box size
- From: Fred Soo <fsoo at u.washington.edu>
- Date: Fri, 10 Feb 2006 02:13:46 -0500 (EST)
- Organization: University of Washington
- Sender: owner-wri-mathgroup at wolfram.com
hi, I know this has been asked before, but I haven't seen any response. Has anyone found an easy way to get the bounding box size (height, width) of a Text expression for a given DisplayFunction? Or for that matter, the size of any Graphics object being displayed? I've tried a few things, but this is way too difficult, and there aren't even any kludgy workarounds. For instance, to get text height, I tried to pull the FontSize->x out of any Text expression. This is ok, but of course, doesn't work if no FontSize is specified. As for reading the default TextStyle, there doesn't seem to be a way unless you use $TextStyle. In addition, if you use Show[expr, DefaultFont:>x] to change all of the fonts in a graphic, it doesn't appear to modify $TextStyle or pass DefaultFont->x, so there is no way to tell what font x is. Text width is kind of hopeless, as there doesn't seem (unless somebody knows, please let me know) a way of getting a font metric. I've looked at the PostScript output from DisplayString, and can find some bits and pieces which make some sense, but not being a PostScript expert, this would take a lot of time to figure out. Any suggestions? Thanks! Fred Department of Physiology and Biophysics University of Washington Seattle, WA 98199 (206) 616-2510