Ejemplo n.º 1
0
 public int GetFontWeight(AdaptiveFontType fontType, AdaptiveTextWeight requestedWeight)
 {
     return(FontTypes.GetFontType(fontType).FontWeights.GetFontWeight(requestedWeight)
            ?? FontTypes.Default.FontWeights.GetFontWeight(requestedWeight)
            ?? FontWeights.GetFontWeight(requestedWeight)
            ?? FontWeightsConfig.GetDefaultFontWeight(requestedWeight));
 }
Ejemplo n.º 2
0
 public int GetFontSize(AdaptiveFontType fontType, AdaptiveTextSize requestedSize)
 {
     return(FontTypes.GetFontType(fontType).FontSizes.GetFontSize(requestedSize)
            ?? FontTypes.Default.FontSizes.GetFontSize(requestedSize)
            ?? FontSizes.GetFontSize(requestedSize)
            ?? FontSizesConfig.GetDefaultFontSize(requestedSize));
 }
Ejemplo n.º 3
0
// Ignore deprecation warnings for Font[Family|Weights|Sizes]
#pragma warning disable 0618
        // Handles inheritance behavior for retrieving the name of the font family given the desired AdaptiveFontType
        public string GetFontFamily(AdaptiveFontType fontType)
        {
            // Value saved in FontTypes.<desiredStyle>
            string fontFamilyValue = FontTypes.GetFontType(fontType).FontFamily;

            if (string.IsNullOrWhiteSpace(fontFamilyValue))
            {
                if (fontType == AdaptiveFontType.Monospace)
                {
                    fontFamilyValue = GetDefaultFontFamily(fontType);
                }
                else
                {
                    // Fallback to deprecated fontFamily value
                    fontFamilyValue = FontFamily;
                    if (string.IsNullOrEmpty(fontFamilyValue))
                    {
                        // Fallback to predefined system default value
                        fontFamilyValue = GetDefaultFontFamily(fontType);
                    }
                }
            }
            return(fontFamilyValue);
        }