Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • $\begingroup$ Neat! Someday, I should start looking into Dynamic*... $\endgroup$ Commented Feb 13, 2012 at 10:11
  • $\begingroup$ I don;t see a need for a dynamic wrapper @Heike. As per my answer you can just make the current value Dynamic directly. $\endgroup$ Commented Feb 13, 2012 at 21:10
  • $\begingroup$ @MikeHoneychurch That doesn't work on my system. If I run your edited code I always get a value of 7.02114 for CurrentValue["FontNWidth"] independent of FontSize and FontFamily. $\endgroup$ Commented Feb 13, 2012 at 21:24
  • $\begingroup$ @MikeHoneychurch but it seems to be the difference that makes it work. Consider Manipulate[{Framed@ Graphics[ Text[Style[ DynamicWrapper["how quickly daft jumping zebras vex", p = CurrentValue["FontNWidth"]], FontFamily -> "Verdana", FontSize -> i]], ImageSize -> Dynamic[p]*46], Dynamic[p]}, {i, 10, 40}] $\endgroup$ Commented Feb 13, 2012 at 21:26
  • $\begingroup$ @Heike what are you using? I wrote my answer with 8.0.4 on OS X 10.6.8 and it works fine -- as per screen grabs. $\endgroup$ Commented Feb 13, 2012 at 21:36