Ejemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is FontFamily font)
            {
                var name = I18NUtil.CurrentLanguage;
                if (string.IsNullOrWhiteSpace(name))
                {
                    name = I18NUtil.GetCurrentLanguage();
                }
                var names = new[] { name, I18NUtil.GetLanguage() };
                foreach (var s in names)
                {
                    if (font.FamilyNames.TryGetValue(XmlLanguage.GetLanguage(s), out var localizedName))
                    {
                        if (!string.IsNullOrEmpty(localizedName))
                        {
                            return(localizedName);
                        }
                    }
                }

                return(font.Source);
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 2
0
 public ColorFontDialog(bool previewFontInFontList = true, bool allowArbitraryFontSizes = true, bool showColorPicker = true)
 {
     InitializeComponent();
     I18NUtil.SetLanguage(Resources);
     this.colorFontChooser.PreviewFontInFontList   = previewFontInFontList;
     this.colorFontChooser.AllowArbitraryFontSizes = allowArbitraryFontSizes;
     this.colorFontChooser.ShowColorPicker         = showColorPicker;
 }