Пример #1
0
        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));
        }
Пример #2
0
        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
            });
        }
Пример #3
0
 public double GetDeviceIndependentPixelSize(SW.Controls.Control control)
 {
     if (Unit == FontSizeUnit.Points)
     {
         return(FontBackendHandler.GetDeviceUnitsFromPoints(Size));
     }
     else
     {
         Size pixelRatios = control.GetPixelRatios();
         return(Size / pixelRatios.Width);
     }
 }