internal static double GetPointsFromPixels(SW.Controls.Control control) { Size pixelRatios = control.GetPixelRatios(); double dpi = (pixelRatios.Width * 96); // 96 DPI is WPF's unit return(GetPointsFromPixels(control.FontSize, dpi)); }
public static FontData FromControl(SW.Controls.Control control) { Size pixelRatios = control.GetPixelRatios(); var pixelSize = control.FontSize * pixelRatios.Width; return(new FontData(control.FontFamily, pixelSize, FontSizeUnit.Pixels) { Style = control.FontStyle, Stretch = control.FontStretch, Weight = control.FontWeight }); }
public double GetDeviceIndependentPixelSize(SW.Controls.Control control) { if (Unit == FontSizeUnit.Points) { return(FontBackendHandler.GetDeviceUnitsFromPoints(Size)); } else { Size pixelRatios = control.GetPixelRatios(); return(Size / pixelRatios.Width); } }