Exemplo n.º 1
0
 public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture)
 {
   SourcedFontFamilyItem sourcedFontFamilyItem = o as SourcedFontFamilyItem;
   if (sourcedFontFamilyItem == null)
     return o;
   o = this.ViewModel.DefaultView.ConvertFromWpfValue((object) sourcedFontFamilyItem.SerializeFontFamily);
   return o;
 }
Exemplo n.º 2
0
        private void InsertFontItem(SourcedFontFamilyItem item)
        {
            int index = this.fontFamilyEditor.FontFamilies.BinarySearch(item, (IComparer <SourcedFontFamilyItem>) new FontFamilyValueEditor.FontFamilyComparer());

            if (index < 0)
            {
                index = ~index;
            }
            this.fontFamilyEditor.FontFamilies.Insert(index, item);
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            SourcedFontFamilyItem sourcedFontFamilyItem = obj as SourcedFontFamilyItem;

            if (sourcedFontFamilyItem == null || !(this.FamilyName == sourcedFontFamilyItem.FamilyName))
            {
                return(false);
            }
            return(FontEmbedder.AreFontsEqual(this.FontFamilySource, sourcedFontFamilyItem.FontFamilySource, this.DocumentContext));
        }
Exemplo n.º 4
0
            public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
            {
                SourcedFontFamilyItem sourcedFontFamilyItem = values[0] as SourcedFontFamilyItem;
                IList list = values[1] as IList;

                if (sourcedFontFamilyItem == null || list == null)
                {
                    return(values[0]);
                }
                int index = list.IndexOf((object)sourcedFontFamilyItem);

                if (index == -1)
                {
                    return((object)sourcedFontFamilyItem);
                }
                return((object)(SourcedFontFamilyItem)list[index]);
            }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            SourcedFontFamilyItem sourcedFontFamilyItem = item as SourcedFontFamilyItem;
            FrameworkElement      frameworkElement      = container as FrameworkElement;

            if (frameworkElement == null)
            {
                return((DataTemplate)null);
            }
            if (sourcedFontFamilyItem != null)
            {
                if (!sourcedFontFamilyItem.IsFontReadable)
                {
                    return(frameworkElement.TryFindResource((object)"UnreadableFontFamilyDataTemplate") as DataTemplate);
                }
                if (sourcedFontFamilyItem.IsFontDamaged)
                {
                    return(frameworkElement.TryFindResource((object)"DamagedFontFamilyDataTemplate") as DataTemplate);
                }
            }
            return(frameworkElement.TryFindResource((object)"ReadableFontFamilyDataTemplate") as DataTemplate);
        }
Exemplo n.º 6
0
 protected SourcedFontFamilyItem(FontFamily fontFamily, string category, SceneNodeObjectSet sceneNodeObjectSet)
     : base(FontFamilyItem.EnsureFamilyName(FontEmbedder.GetFontNameFromSource(fontFamily)), category, SourcedFontFamilyItem.DefaultPreviewFontFamilyName, SourcedFontFamilyItem.ConvertToWpfFontFamily(fontFamily, sceneNodeObjectSet.DocumentContext))
 {
     this.sceneNodeObjectSet = sceneNodeObjectSet;
 }
Exemplo n.º 7
0
 protected SourcedFontFamilyItem(FontFamily fontFamily, string category, IDocumentContext documentContext)
     : base(FontFamilyItem.EnsureFamilyName(FontEmbedder.GetFontNameFromSource(fontFamily)), category, SourcedFontFamilyItem.DefaultPreviewFontFamilyName, SourcedFontFamilyItem.ConvertToWpfFontFamily(fontFamily, documentContext))
 {
     this.documentContext = documentContext;
 }