views:

448

answers:

4

What is the WPF analogy for the CSS em unit?

A: 

AFAIK, there isn't one right now. But you can make your desire for this known here.

One alternative (and I don't know if this is possible either) would be to measure how big the desired font is, then take that as your "ems" unit, then scale using those "units" instead.

John Feminella
+1  A: 
<ScaleTransform ScaleX="1.2" ScaleY="1.2"></ScaleTransform>

seems to be more or less the 1.2em alternative.

alex2k8
A: 

Unfortunately, there is no equivalent in WPF of the em unit. All your font sizes, etc are always set in Pixels.

Fortes
+2  A: 

em size is the width of the uppercase letter M in the current font, there is no font-dependent sizing method in Wpf

Btw, WPF uses "device independent pixels" that are always 1/96 of an inch (because that's one pixels on today's monitors) so:

  • 1 pixel is 1/96 inches
  • 96 pixels in an inch
  • 1.33333 pixels is a point
  • 3.779 pixels is a mm

Those are extremely inaccurate on monitors because almost all monitors report a 96DPI resolution and ignore the real pixel size, but are very useful when printing.

Nir