示例#1
0
        public static FontWeight ToXwtFontWeight(this SW.FontWeight value)
        {
            // No, SW.FontWeights is not an enum
            if (value == SW.FontWeights.UltraLight)
            {
                return(FontWeight.Ultralight);
            }
            if (value == SW.FontWeights.Light)
            {
                return(FontWeight.Light);
            }
            if (value == SW.FontWeights.SemiBold)
            {
                return(FontWeight.Semibold);
            }
            if (value == SW.FontWeights.Bold)
            {
                return(FontWeight.Bold);
            }
            if (value == SW.FontWeights.UltraBold)
            {
                return(FontWeight.Ultrabold);
            }
            if (value == SW.FontWeights.Black)
            {
                return(FontWeight.Heavy);
            }

            return(FontWeight.Normal);
        }
示例#2
0
        public static FontWeight ToXwtFontWeight(this SW.FontWeight value)
        {
            // No, SW.FontWeights is not an enum
            // Extra/Ultra and Demi/Semi are equal
            // see: http://msdn.microsoft.com/en-us/library/system.windows.fontweights
            if (value == SW.FontWeights.Thin)
            {
                return(FontWeight.Thin);
            }
            if (value == SW.FontWeights.ExtraLight)
            {
                return(FontWeight.Ultralight);
            }
            if (value == SW.FontWeights.UltraLight)
            {
                return(FontWeight.Ultralight);
            }
            if (value == SW.FontWeights.Light)
            {
                return(FontWeight.Light);
            }
            if (value == SW.FontWeights.Medium)
            {
                return(FontWeight.Medium);
            }
            if (value == SW.FontWeights.DemiBold)
            {
                return(FontWeight.Semibold);
            }
            if (value == SW.FontWeights.SemiBold)
            {
                return(FontWeight.Semibold);
            }
            if (value == SW.FontWeights.Bold)
            {
                return(FontWeight.Bold);
            }
            if (value == SW.FontWeights.ExtraBold)
            {
                return(FontWeight.Ultrabold);
            }
            if (value == SW.FontWeights.UltraBold)
            {
                return(FontWeight.Ultrabold);
            }
            if (value == SW.FontWeights.Black)
            {
                return(FontWeight.Heavy);
            }
            if (value == SW.FontWeights.Heavy)
            {
                return(FontWeight.Heavy);
            }
            if (value == SW.FontWeights.ExtraBlack)
            {
                return(FontWeight.Ultraheavy);
            }
            if (value == SW.FontWeights.UltraBlack)
            {
                return(FontWeight.Ultraheavy);
            }

            return(FontWeight.Normal);
        }