public int GetFontSize(AdaptiveFontStyle fontStyle, AdaptiveTextSize requestedSize) { return(FontStyles.GetFontStyle(fontStyle).FontSizes.GetFontSize(requestedSize) ?? FontStyles.Default.FontSizes.GetFontSize(requestedSize) ?? FontSizes.GetFontSize(requestedSize) ?? FontSizesConfig.GetDefaultFontSize(requestedSize)); }
public int GetFontWeight(AdaptiveFontStyle fontStyle, AdaptiveTextWeight requestedWeight) { return(FontStyles.GetFontStyle(fontStyle).FontWeights.GetFontWeight(requestedWeight) ?? FontStyles.Default.FontWeights.GetFontWeight(requestedWeight) ?? FontWeights.GetFontWeight(requestedWeight) ?? FontWeightsConfig.GetDefaultFontWeight(requestedWeight)); }
// Handles inheritance behavior for retrieving the name of the font family given the desired AdaptiveFontStyle public string GetFontFamily(AdaptiveFontStyle fontStyle) { // Value saved in FontStyles.<desiredStyle> string fontFamilyValue = FontStyles.GetFontStyle(fontStyle).FontFamily; if (string.IsNullOrEmpty(fontFamilyValue)) { if (fontStyle == AdaptiveFontStyle.Monospace) { fontFamilyValue = GetDefaultFontFamily(fontStyle); } else { // Fallback to default fontStyle value fontFamilyValue = FontStyles.Default.FontFamily; if (string.IsNullOrEmpty(fontFamilyValue)) { // Fallback to deprecated fontFamily value fontFamilyValue = FontFamily; if (string.IsNullOrEmpty(fontFamilyValue)) { // Fallback to predefined system default value fontFamilyValue = GetDefaultFontFamily(fontStyle); } } } } return(fontFamilyValue); }
public FontStyleConfig GetFontStyle(AdaptiveFontStyle fontStyle) { switch (fontStyle) { case AdaptiveFontStyle.Monospace: return(Monospace); case AdaptiveFontStyle.Default: default: return(Default); } }
private string GetDefaultFontFamily(AdaptiveFontStyle fontStyle) { switch (fontStyle) { case AdaptiveFontStyle.Monospace: return("Courier New"); case AdaptiveFontStyle.Default: default: // Leave it up to the platform. // Renderer default is usually "Segoe UI" return(""); } }