MathGroup Archive 2010

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

Search the Archive

Re: how to scale text to a bounding rectangle?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110406] Re: how to scale text to a bounding rectangle?
  • From: Helen Read <hpr at together.net>
  • Date: Wed, 16 Jun 2010 05:42:18 -0400 (EDT)
  • References: <hv76jr$k2j$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

On 6/15/2010 2:29 AM, Michael wrote:
> How can I automatically scale Text[] to fit into a bounding rectangle of
> a size that I specify?
>
> For instance, I can get a pretty close result here, but it is not
> perfect (the text doesn't touch the bottom edge of the rectangle), and
> "36", {0,0}, and {-1,-1} are all numbers I had to find through trial and
> error:
>
> Graphics[{
>     FaceForm[], EdgeForm[Black],
>     Rectangle[{0, 0}, {100, 10}],
>     Text[Style["Hello", 36], {0, 0}, {-1, -1}]
>     }
>    ]


Framed[Text[Style["Hello"]]]

If you want the 36 point font, that's fine too.

Framed[Text[Style["Hello", 36]]]

You can set FrameMargins on any or all sides.

Framed[Text[Style["Hello", 36]], FrameMargins -> {{10, 200}, {0, 0}}]

Framed[Text[Style["Hello", 36]], FrameMargins -> 20]



-- 
Helen Read
University of Vermont


  • Prev by Date: Re: DiscretePlot
  • Next by Date: Normal with GeometricTransformation
  • Previous by thread: how to scale text to a bounding rectangle?
  • Next by thread: Re: how to scale text to a bounding rectangle?