MathGroup Archive 2008

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

Search the Archive

Re: Text XY-size control in 2D graphics?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85125] Re: Text XY-size control in 2D graphics?
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Wed, 30 Jan 2008 05:56:01 -0500 (EST)
  • Organization: University of Bergen
  • References: <fnk3p2$l14$1@smc.vnet.net>

Gordon Robertson wrote:
> 
> Can anyone help by showing how to control Text character width and  
> height independently?

Hi,

This is not the nicest solution, but it is flexible, and it works.  So 
if you don't get better suggestions, do the following:

We only need four different letters, so we can try getting their 
outlines, and using Scale[] to distort them.

How do we get the outline?  One way is to export to PDF, and re-import.

Export["a.pdf", Graphics@Text["A"]]
Import["a.pdf"]

 From the imported data we can get a nice Times A as a polygon:

letterA =
   Polygon[{{150.83911149576562, 149.06640625}, {148.54296875,
      149.06640625}, {148.12109375, 148.1171875}, {148.05572527367892,
      147.95050450886217}, {148.00903350487812,
      147.8064120973049}, {147.9716800898375,
      147.58599901293204}, {148.10131859407187,
      147.3404545877203}, {148.3062135214008,
      147.2531131533961}, {148.46510330238615,
      147.223449916582}, {148.66162129491875,
      147.203125}, {148.66162129491875, 147.0625}, {146.78900152351798,
       147.0625}, {146.78900152351798,
      147.203125}, {147.09661897924298,
      147.2816775059367}, {147.27240036335547,
      147.38110354915312}, {147.38748202892538,
      147.51860436500414}, {147.5086062671664,
      147.7124787655213}, {147.6357730780785,
      147.96272675070455}, {147.70162244828623,
      148.10899083754595}, {147.76898246166172,
      148.2693483205539}, {149.95361334830625,
      153.1796875}, {150.1134647158961, 153.1796875}, {152.09375,
      148.20068379491875}, {152.21611026930682,
      147.92183719145186}, {152.33270272892108,
      147.6966862143082}, {152.44352737884276,
      147.5252308634878}, {152.54858421907187,
      147.40747113899062}, {152.7930300617633,
      147.26547269290742}, {152.9453279620533,
      147.22434250230674}, {153.11767584830625,
      147.203125}, {153.11767584830625, 147.0625}, {150.75286911335547,
       147.0625}, {150.75286911335547,
      147.203125}, {151.05114791356718,
      147.24260731682023}, {151.23407011758985,
      147.3247988312543}, {151.35931402351798,
      147.57666049153124}, {151.31536871101798,
      147.8322298259041}, {151.26043707039298,
      148.00296422146803}, {151.18353277351798,
      148.2023317692836}, {150.83911149576562,
      149.06640625}, {150.71331826504922,
      149.3828125}, {149.755859643225,
      151.791015893225}, {148.68359375,
      149.3828125}, {150.71331826504922,
      149.3828125}, {150.71331826504922, 149.3828125}}];

Let us show it on the screen:

Graphics[letterA]

It's a bit angled, but probably good enough for the purpose.  And now 
distort it:

Graphics[Scale[letterA, {3, 1}]]

I hope this helps,

Szabolcs


  • Prev by Date: Re: Import , MatrixPlot
  • Next by Date: Re: Mathematica notebooks Windows Desktop Search
  • Previous by thread: Re: Text XY-size control in 2D graphics?
  • Next by thread: Re: Text XY-size control in 2D graphics?