MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Determining the size of text in graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38438] Determining the size of text in graphics
  • From: JunkDickZach at aol.com
  • Date: Sun, 15 Dec 2002 02:10:08 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

For Mathematica users who plot data for presentation to others, the 
difficulty of controlling the details of graph layout is a recurring 
annoyance. It has been noted before in this forum that long labels, for 
example, can play hob with graph formatting and alignment.

process of keeping the formatting consistent, but I have always been stopped 
by a significant omission from Mathematica's graphics capabilities:  There 
seems to be no way to determine the size of a graphical text element. I'm 
sure this has been pointed out to WR many times (twice by me), but apparently 
providing a way to determine the size of graphics text has a low development 
priority, because it hasn't happened yet.

Here's an example of how the ability to determine text size could be helpful. 
Suppose that we want to keep the size and aspect ratio of the plot area from 
changing if we specify a long plot label.  We might allocate a rectangle of a 
certain size for the label, then make sure that the label fits inside it.  If 
it doesn't, we could programmatically reduce the font size until the 
formatted label is small enough to fit. But even such a simple scheme as this 
is unavailable to us, because we have no way to test whether the text fits 
inside a rectangle without plotting it and looking at it.

Given the power of Mathematica, it would seem to be relatively simple for 
someone with knowledge of a few basics -- for example, font metrics and how 
PostScript formats text -- to write a function that would return the size of 
the bounding box for a piece of formatted text. Unfortunately, I'm not that 
someone; but I am wondering if one of you MathGroupies has either solved this 
problem or knows roughly how to do it. Or maybe you can point out something 
simple that I have been overlooking.

Regards,
Dick Zacher

To reply directly, please remove the four-letter prefix "Junk" from my return 
email address.


  • Prev by Date: Re: Why can't Mathematica find this root?
  • Next by Date: Re: More about ellipse and circle intersection
  • Previous by thread: Re: Speed Comparison
  • Next by thread: JLink problem