# What are the UnitConvert units for ItemSize and FieldSize?

I have discovered the unit for ImageSize is "DesktopPublishingPoints" as setting

ImageSize -> {
QuantityMagnitude@ UnitConvert[Quantity[10, "Centimeters"], "DesktopPublishingPoints"],
Automatic}


produces an image that is 10cm wide. This agrees with the toolbar ruler and printing.

However, the same conversion does not work with either ItemSize nor FieldSize. The results are too wide (confirmed by toolbar ruler) but they are of equal width which indicates they are of the same unit.

What UnitConvert unit should be use for ItemSize and FieldSize options to produce output of a specified size?

Mma 11.0.1 on Win 7 Pro

This produces a Panel that is 10cm wide by toolbar ruler and when printed.

Panel["Select something", Background -> LightBlue,
ImageSize -> {
QuantityMagnitude@UnitConvert[Quantity[10, "Centimeters"], "DesktopPublishingPoints"],
Automatic}]


These produce outputs that are much too wide.

Grid[{{Null}},
ItemSize ->
QuantityMagnitude@UnitConvert[Quantity[10, "Centimeters"],"DesktopPublishingPoints"],
Background -> LightBlue]

InputField[Null,
FieldSize ->
QuantityMagnitude@UnitConvert[Quantity[10, "Centimeters"],"DesktopPublishingPoints"],
Background -> LightBlue]


UnitConvert will not be of much help to you, since ItemSize and FieldSize are dependent on the metrics of the current font.
You will have to do the work yourself, using CurrentValue["FontLineHeight"] and CurrentValue["FontMWidth"].
• here is a curious thing ... UnitConvert[Quantity[1., "ems"], "DesktopPublishingPoints"] (*1. pt*) – george2079 Jan 31 '17 at 15:45
• I think ItemSize->QuantityMagnitude@ UnitConvert[Quantity[10, "Centimeters"], "DesktopPublishingPoints"] / CurrentValue["FontMWidth"]does the trick. – Edmund Jan 31 '17 at 16:02
• @ihojnicki FieldSize does not fully cooperate with the above but it is very close. Any idea why it is a little wider for FieldSize but exact for ItemSize? – Edmund Jan 31 '17 at 16:12
• Best guess without looking at the code... The InputField is using a different font. So you would have to spec it using Dynamic or RuleDelayed. – ihojnicki Jan 31 '17 at 16:17