Converting between WPF font size and "standard" font size Converting between WPF font size and "standard" font size wpf wpf

Converting between WPF font size and "standard" font size


WPF uses pixels as its default unit for font size. The mapping between points (probably what you mean when you say "standard" font size) and pixels is: 1 pt = (96/72) px

This gives us a simple conversion function:

public static double PointsToPixels(double points){    return points*(96.0/72.0);}

See this question for more details.


Another method for conversion if you're going from point to WPF double is to use the System.Windows.FontSizeConverter class:

double sizeForWpf = (double) new FontSizeConverter().ConvertFrom("10pt");