Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this questionthis question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the font, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the font, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the font, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

edited title
Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k

How can I make `CurrentValue`CurrentValue for font characteristics pick up the font of the output not the input cell?

Tweeted twitter.com/#!/StackMma/status/168937324565106688
because "fotn" is not a word
Source Link
Verbeia
  • 34.5k
  • 10
  • 111
  • 234

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the fotnfont, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the fotn, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as n-width and m-width. This has obvious applications in determining appropriate sizes of objects so that the text contained within them fits.

However it is not obvious how to pick up the characteristics of the font of styled output. For example, the following uses the width of the font in the input cell, not the selected style in the code (example adopted from this question).

 Framed @ Graphics[Text[ Style["how quickly daft jumping zebras vex", FontFamily -> "Verdana", FontSize -> 20]], ImageSize -> CurrentValue["FontNWidth"]*35] 

enter image description here

If I select the whole input cell (by its bracket, not just the text) and change the font, it works better, although of course "FontNWidth" is not a perfect indicator of actual width of characters:

enter image description here

How can I concisely get the CurrentValue dimensions from an arbitrarily chosen font?

Source Link
Verbeia
  • 34.5k
  • 10
  • 111
  • 234
Loading