5

3

I'm trying to programmatically get the width of a character in Mathematica's default fixed-width font, Courier. I believe `CurrentValue`

holds the answer but I'm having trouble understanding correct usage.

Four examples:

```
In[1]:= CurrentValue[$FrontEnd, FontFamily]
Out[1]= "Times"
```

Example 1: Expected Courier, since input is typed in Courier.

```
In[2]:= s = Style["Confusion", FontFamily -> "Times"]; CurrentValue[s, FontFamily]
Out[2]= "Courier"
```

Example 2: Expected Times, since I specifically chose that font family for `s`

.

```
In[3]:= CurrentValue[s, "FontMWidth"] / CurrentValue[s, "FontNWidth"]
Out[3]= 2.
```

Example 3: Expected exactly 1, since since all letters should be equally wide in Courier.

```
In[4]:= CurrentValue[$FrontEnd, "FontMWidth"] / CurrentValue[$FrontEnd, "FontNWidth"]
Out[4]= 2.
```

Example 4: Expected about 1.2, based on a quick measurement of the width ratio of Times' M to N.

A prior question about fonts and CurrentValue has an example of using `DynamicWrapper`

to get information out of dynamic objects, but I'm still curious how to use `CurrentValue`

correctly in non-dynamic settings, and why the ratio of `FontMWidth/FontNWidth`

is always 2.

I'm on Mac OS X 10.8.5 and Mathematica 9.0.1.0.

discussion here may be relevant: http://mathematica.stackexchange.com/questions/17795/grid-layout-problems-different-sizes-when-rendering-on-mac-and-windows

– Mike Honeychurch – 2013-11-04T03:54:32.117@Mike Thanks, right on. – duozmo – 2013-11-06T02:34:47.560