MathGroup Archive 2005

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

Search the Archive

Re: Packages--JLink graphic string width and height in pixels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62955] Re: [mg62911] Packages--JLink graphic string width and height in pixels
  • From: pantagruel123 at aol.com
  • Date: Fri, 9 Dec 2005 05:10:36 -0500 (EST)
  • References: <200512080505.AAA11753@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Not exactly sure what you're wanting to do, but if you want to frame a box of
text with a precise width in mathematica graphics, it isn't too difficult
to do in mathematica.  Consider this example:

myWidth=200
p=1.00

myMessage="A moment of planetary concordance occurs when the Kepler harmonies
fit closely into a known musical scale. Here, the scale used is the equal
tempered chromatic, typical of Western music."

desc=Graphics[Text[DisplayForm[FrameBox[Cell[myMessage,"Text",PageWidth=myWidth*p,TextJustification=1,FontFamily->"Times"]]],Scaled[{0.5,0.5}],{0,0}]];
myDisplay[x_]:=Display[$Display,x,ImageSize=myWidth{1,1}];
Show[desc,DisplayFunction=myDisplay,Frame=True,FrameTicks=None]

where myWidth*p sets the width of the myMessage and the width of the overall
 image.  Smaller widths don't result in smaller text, but at least the text
will wordwrap within the box.  By adjusting the the Scaled[] coordinates and
 the p=percent of image width you can format fairly neatly. 

Chris


-----Original Message-----
From: lucb at ea.com
To: mathgroup at smc.vnet.net
Subject: [mg62955] [mg62911] Packages--JLink graphic string width and height in pixels


has anyone used JLink to calculate the width and height (in pixels) of a string
to be used in a mathematica 2D graphics?
Thanks
Luc

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=6748#p6748
Posted through http://www.mathematica-users.org [[postId=6748]]



  • Prev by Date: Re: Getting good results with NDSolve?
  • Next by Date: UML-like diagrams for Mathematica
  • Previous by thread: Packages--JLink graphic string width and height in pixels
  • Next by thread: How to hide a cell?