ソースを参照

综合-将文本注释、编辑文本 预设保存到本地区分开,整理代码

OYXH\oyxh 1 年間 前
コミット
d9fddb7df0

+ 1 - 0
PDF Office/Helper/PDFEditHelper.cs

@@ -74,6 +74,7 @@ namespace PDF_Master.Helper
             defaultEdit.ReplaceImagePath = null;
             defaultEdit.Rotate = 0;
             defaultEdit.Transparency = 255;
+            defaultEdit.SystemFontNameList = new List<string>();
             SettingHelper.SetPDFEditProperty(defaultEdit);
             Settings.Default.Save();
             return defaultEdit;

+ 4 - 483
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -27,7 +27,9 @@ namespace PDF_Master.Model.AnnotPanel
         TextAlignment
     }
 
-    //设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// <summary>
+    ///  编辑-文本 设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// </summary>
     public class FontBoard : BindableBase
     {
         #region 变量
@@ -75,7 +77,7 @@ namespace PDF_Master.Model.AnnotPanel
         private void InitBase_PresetFontStyles()
         {
             PresetFontItems = new List<ComboDataItem>();
-            PresetFontList = TextFont.GetCachePresetFontList();
+            PresetFontList = TextFont.GetCachePresetEditFontList();
 
             foreach (var item in PresetFontList)
             {
@@ -546,485 +548,4 @@ namespace PDF_Master.Model.AnnotPanel
 
         #endregion 列表选中赋值
     }
-
-    //设置字体大小、字体内容排版、字体颜色、字体样式、字重
-    public class FontBoardVm : BindableBase
-    {
-        #region 变量
-
-        public List<ComboDataItem> FontFamilyItems { get; protected set; }
-        public List<ComboDataItem> FontStyleItems { get; protected set; }
-        public List<ComboDataItem> FontSizeItems { get; protected set; }
-        public List<ComboDataItem> PresetFontItems { get; protected set; }
-
-        public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
-
-        public FontBoardVm(bool isInitdata)
-        {
-            if (isInitdata)
-                InitBaseVariable();
-        }
-
-        #endregion 变量
-
-        #region 初始化下拉框或列表默认的数据
-
-        protected void InitBaseVariable()
-        {
-            InitBase_PresetFontStyles();
-            InitBase_FontFamilys();
-            InitBase_FontStyles();
-            InitBase_FontSize();
-        }
-
-        private void InitBase_FontSize()
-        {
-            FontSizeItems = TextFont.GetFontSize();
-        }
-
-        //预设字体样式
-        private void InitBase_PresetFontStyles()
-        {
-            PresetFontItems = new List<ComboDataItem>();
-            PresetFontList = TextFont.GetCachePresetFontList();
-
-            foreach (var item in PresetFontList)
-            {
-                ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
-                PresetFontItems.Add(itemData);
-            }
-        }
-
-        //字体
-        private void InitBase_FontFamilys()
-        {
-            FontFamilyItems = TextFont.GetFamily();
-        }
-
-        //字重
-        private void InitBase_FontStyles()
-        {
-            FontStyleItems = TextFont.GetFontStyle();
-        }
-
-        #endregion 初始化下拉框或列表默认的数据
-
-        #region 属性
-
-        /// <summary>
-        /// 预设样式
-        /// </summary>
-        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
-
-        public ComboDataItem CurrentPresetFont
-        {
-            get { return _currentPresetFont; }
-            set
-            {
-                SetProperty(ref _currentPresetFont, value);
-                switch (value.ValueStr.ToString())
-                {
-                    case "Custom":
-                        PresetFontSelectedIndex = 0;
-                        break;
-
-                    case "H1":
-                        PresetFontSelectedIndex = 1;
-                        break;
-
-                    case "H2":
-                        PresetFontSelectedIndex = 2;
-                        break;
-
-                    case "H3":
-                        PresetFontSelectedIndex = 3;
-                        break;
-
-                    case "B1":
-                        PresetFontSelectedIndex = 4;
-                        break;
-
-                    case "B2":
-                        PresetFontSelectedIndex = 5;
-                        break;
-
-                    case "B3":
-                        PresetFontSelectedIndex = 6;
-                        break;
-
-                    default:
-                        PresetFontSelectedIndex = 0;
-                        break;
-                }
-            }
-        }
-
-        private int presetFontSelectedIndex;
-
-        public int PresetFontSelectedIndex
-        {
-            get { return presetFontSelectedIndex; }
-            set
-            {
-                SetProperty(ref presetFontSelectedIndex, value);
-            }
-        }
-
-        #region 字体样式
-
-        //下拉框列表
-        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Arial");
-
-        public ComboDataItem CurrentFontFamily
-        {
-            get { return _currentFontFamily; }
-            set
-            {
-                SetProperty(ref _currentFontFamily, value);
-                switch (value.Content.ToString())
-                {
-                    case "Courier New":
-                        FontFamilySelectedIndex = 0;
-                        break;
-
-                    case "Arial":
-                        FontFamilySelectedIndex = 1;
-                        break;
-
-                    case "Times New Roman":
-                        FontFamilySelectedIndex = 2;
-                        break;
-
-                    case "Adobe Devanagari":
-                        FontFamilySelectedIndex = 3;
-                        break;
-                }
-            }
-        }
-
-        private int fontFamilySelectedIndex;
-
-        public int FontFamilySelectedIndex
-        {
-            get { return fontFamilySelectedIndex; }
-            set
-            {
-                SetProperty(ref fontFamilySelectedIndex, value);
-            }
-        }
-
-        #endregion 字体样式
-
-        #region 字体大小
-
-        private int fontSizeSelectedIndex;
-
-        public int FontSizeSelectedIndex
-        {
-            get { return fontSizeSelectedIndex; }
-            set
-            {
-                SetProperty(ref fontSizeSelectedIndex, value);
-            }
-        }
-
-        //下拉框列表:字体大小
-        private ComboDataItem _currentFontSize = new ComboDataItem(6);
-
-        public ComboDataItem CurrentFontSize
-        {
-            get { return _currentFontSize; }
-            set
-            {
-                SetProperty(ref _currentFontSize, value);
-                switch (value.Value)
-                {
-                    case 8:
-                        FontSizeSelectedIndex = 0;
-                        break;
-
-                    case 9:
-                        FontSizeSelectedIndex = 1;
-                        break;
-
-                    case 10:
-                        FontSizeSelectedIndex = 2;
-                        break;
-
-                    case 11:
-                        FontSizeSelectedIndex = 3;
-                        break;
-
-                    case 12:
-                        FontSizeSelectedIndex = 4;
-                        break;
-
-                    case 14:
-                        FontSizeSelectedIndex = 5;
-                        break;
-
-                    case 16:
-                        FontSizeSelectedIndex = 6;
-                        break;
-
-                    case 18:
-                        FontSizeSelectedIndex = 7;
-                        break;
-
-                    case 20:
-                        FontSizeSelectedIndex = 8;
-                        break;
-
-                    case 22:
-                        FontSizeSelectedIndex = 9;
-                        break;
-
-                    case 24:
-                        FontSizeSelectedIndex = 10;
-                        break;
-
-                    case 26:
-                        FontSizeSelectedIndex = 11;
-                        break;
-
-                    case 28:
-                        FontSizeSelectedIndex = 12;
-                        break;
-
-                    case 36:
-                        FontSizeSelectedIndex = 13;
-                        break;
-
-                    case 48:
-                        FontSizeSelectedIndex = 14;
-                        break;
-
-                    case 72:
-                        FontSizeSelectedIndex = 15;
-                        break;
-
-                    default:
-                        //FontSizeSelectedIndex = 0;
-                        //FontSizeSelectedIndex = -1;
-                        break;
-                }
-            }
-        }
-
-        #endregion 字体大小
-
-        //FontStyle & FontWeight
-
-        private FontStyle _fontStyleItem;
-
-        public FontStyle FontStyleItem
-        {
-            get { return _fontStyleItem; }
-            set { SetProperty(ref _fontStyleItem, value); }
-        }
-
-        private FontWeight _fontWeight;
-
-        public FontWeight FontWeightItem
-        {
-            get { return _fontWeight; }
-            set { SetProperty(ref _fontWeight, value); }
-        }
-
-        private int fontStyleSelectedIndex;
-
-        public int FontStyleSelectedIndex
-        {
-            get { return fontStyleSelectedIndex; }
-            set
-            {
-                SetProperty(ref fontStyleSelectedIndex, value);
-            }
-        }
-
-        private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
-
-        public ComboDataItem CurrrentFontWeightStyle
-        {
-            get { return _currrentFontWeightStyle; }
-            set
-            {
-                SetProperty(ref _currrentFontWeightStyle, value);
-                switch (value.Content.ToString())
-                {
-                    case "Regular":
-                        FontStyleSelectedIndex = 0;
-                        break;
-
-                    case "Bold":
-                        FontStyleSelectedIndex = 1;
-                        break;
-
-                    case "Italic":
-                        FontStyleSelectedIndex = 2;
-                        break;
-
-                    case "Bold Italic":
-                        FontStyleSelectedIndex = 3;
-                        break;
-                }
-            }
-        }
-
-        public void UpdateFontWeight_Style()
-        {
-            switch (CurrrentFontWeightStyle.ValueStr)
-            {
-                case "Regular":
-                    FontStyleItem = FontStyles.Normal;
-                    FontWeightItem = FontWeights.Normal;
-                    break;
-
-                case "Bold":
-                    FontStyleItem = FontStyles.Normal;
-                    FontWeightItem = FontWeights.Bold;
-                    break;
-
-                case "Italic":
-                    FontStyleItem = FontStyles.Italic;
-                    FontWeightItem = FontWeights.Normal;
-                    break;
-
-                case "Bold Italic":
-                    FontStyleItem = FontStyles.Italic;
-                    FontWeightItem = FontWeights.Bold;
-                    break;
-            }
-        }
-
-        //文字内容对齐
-        private string _strtextAlign;
-
-        public string StrTextAlign
-        {
-            get { return _strtextAlign; }
-            set { SetProperty(ref _strtextAlign, value); }
-        }
-
-        //颜色
-        private Brush _fontColor = new SolidColorBrush(Colors.Black);
-
-        public Brush FontColor
-        {
-            get { return _fontColor; }
-            set { SetProperty(ref _fontColor, value); CurrentFontColor = _fontColor; }
-        }
-
-        private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
-
-        public Brush CurrentFontColor
-        {
-            get { return _currentFontColor; }
-            set => SetProperty(ref _currentFontColor, value);
-        }
-
-        //外部UI引用,判断是否选中左对齐、居中对齐、右对齐,或都不选中
-        public string strAglinState { get; private set; }
-
-        //VM赋值
-        public void SetStrAglinState(string str)
-        {
-            strAglinState = str;
-        }
-
-        #endregion 属性
-
-        #region 列表选中赋值
-
-        public void GetFontWeights_Style(FontStyle fontStyle, FontWeight fontWeights)
-        {
-            string strValue = "";
-            string strContent = "";
-            if (fontStyle == FontStyles.Normal)
-            {
-                if (fontWeights == FontWeights.Normal)
-                {
-                    strValue = "Regular";
-                    strContent = "Regular";
-                }
-                else
-                {
-                    strValue = "Bold";
-                    strContent = "Bold";
-                }
-            }
-            else
-            {
-                if (fontWeights == FontWeights.Normal)
-                {
-                    strValue = "Italic";
-                    strContent = "Italic";
-                }
-                else
-                {
-                    strValue = "Bold Italic";
-                    strContent = "Bold Italic";
-                }
-            }
-
-            CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
-            UpdateFontWeight_Style();
-        }
-
-        public void GetCurrentFontSize(int size)
-        {
-            CurrentFontSize = new ComboDataItem(size);
-        }
-
-        public void GetCurrentFontFamily(string fontFamily, string uiStr)
-        {
-            if (fontFamily == "Helvetica")
-            {
-                fontFamily = "Arial";
-                uiStr = "Arial";
-            }
-            if (fontFamily == "Times-Roman")
-            {
-                uiStr = "Times New Roman";
-            }
-            if (fontFamily == "CourierNew")
-            {
-                uiStr = "Courier New";
-            }
-            if (fontFamily == "AdobeDevanagari")
-            {
-                uiStr = "Adobe Devanagari";
-            }
-            CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
-        }
-
-        public void GetCurrentPresetFont(string presetFont, string uiStr)
-        {
-            CurrentPresetFont = new ComboDataItem(presetFont, uiStr);
-        }
-
-        internal bool GetCurrentPresetFont(FreeTextAnnotArgs annot)
-        {
-            bool isExist = false;
-            //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
-            foreach (var item in PresetFontList)
-            {
-                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight == FontWeights.Bold) && annot.IsItalic == (item.mFontStyle == FontStyles.Italic)
-                && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
-                )
-                {
-                    if (item.mTag != "Custom")
-                    {
-                        CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
-                        isExist = true;
-                    }
-
-                    break;
-                }
-            }
-            return isExist;
-        }
-
-        #endregion 列表选中赋值
-    }
 }

+ 499 - 0
PDF Office/Model/AnnotPanel/FontBoardVm.cs

@@ -0,0 +1,499 @@
+using ComPDFKitViewer.AnnotEvent;
+using PDF_Master.CustomControl.CompositeControl;
+using PDF_Master.Model.PropertyPanel.AnnotPanel;
+using PDFSettings;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace PDF_Master.Model.AnnotPanel
+{
+    /// <summary>
+    /// 注释-文本
+    /// 设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// </summary>
+    public class FontBoardVm : BindableBase
+    {
+        #region 变量
+
+        public List<ComboDataItem> FontFamilyItems { get; protected set; }
+        public List<ComboDataItem> FontStyleItems { get; protected set; }
+        public List<ComboDataItem> FontSizeItems { get; protected set; }
+        public List<ComboDataItem> PresetFontItems { get; protected set; }
+
+        public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
+
+        public FontBoardVm(bool isInitdata)
+        {
+            if (isInitdata)
+                InitBaseVariable();
+        }
+
+        #endregion 变量
+
+        #region 初始化下拉框或列表默认的数据
+
+        protected void InitBaseVariable()
+        {
+            InitBase_PresetFontStyles();
+            InitBase_FontFamilys();
+            InitBase_FontStyles();
+            InitBase_FontSize();
+        }
+
+        private void InitBase_FontSize()
+        {
+            FontSizeItems = TextFont.GetFontSize();
+        }
+
+        //预设字体样式
+        private void InitBase_PresetFontStyles()
+        {
+            PresetFontItems = new List<ComboDataItem>();
+            PresetFontList = TextFont.GetCachePresetFontList();
+
+            foreach (var item in PresetFontList)
+            {
+                ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
+                PresetFontItems.Add(itemData);
+            }
+        }
+
+        //字体
+        private void InitBase_FontFamilys()
+        {
+            FontFamilyItems = TextFont.GetFamily();
+        }
+
+        //字重
+        private void InitBase_FontStyles()
+        {
+            FontStyleItems = TextFont.GetFontStyle();
+        }
+
+        #endregion 初始化下拉框或列表默认的数据
+
+        #region 属性
+
+        /// <summary>
+        /// 预设样式
+        /// </summary>
+        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
+
+        public ComboDataItem CurrentPresetFont
+        {
+            get { return _currentPresetFont; }
+            set
+            {
+                SetProperty(ref _currentPresetFont, value);
+                switch (value.ValueStr.ToString())
+                {
+                    case "Custom":
+                        PresetFontSelectedIndex = 0;
+                        break;
+
+                    case "H1":
+                        PresetFontSelectedIndex = 1;
+                        break;
+
+                    case "H2":
+                        PresetFontSelectedIndex = 2;
+                        break;
+
+                    case "H3":
+                        PresetFontSelectedIndex = 3;
+                        break;
+
+                    case "B1":
+                        PresetFontSelectedIndex = 4;
+                        break;
+
+                    case "B2":
+                        PresetFontSelectedIndex = 5;
+                        break;
+
+                    case "B3":
+                        PresetFontSelectedIndex = 6;
+                        break;
+
+                    default:
+                        PresetFontSelectedIndex = 0;
+                        break;
+                }
+            }
+        }
+
+        private int presetFontSelectedIndex;
+
+        public int PresetFontSelectedIndex
+        {
+            get { return presetFontSelectedIndex; }
+            set
+            {
+                SetProperty(ref presetFontSelectedIndex, value);
+            }
+        }
+
+        #region 字体样式
+
+        //下拉框列表
+        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Arial");
+
+        public ComboDataItem CurrentFontFamily
+        {
+            get { return _currentFontFamily; }
+            set
+            {
+                SetProperty(ref _currentFontFamily, value);
+                switch (value.Content.ToString())
+                {
+                    case "Courier New":
+                        FontFamilySelectedIndex = 0;
+                        break;
+
+                    case "Arial":
+                        FontFamilySelectedIndex = 1;
+                        break;
+
+                    case "Times New Roman":
+                        FontFamilySelectedIndex = 2;
+                        break;
+
+                    case "Adobe Devanagari":
+                        FontFamilySelectedIndex = 3;
+                        break;
+                }
+            }
+        }
+
+        private int fontFamilySelectedIndex;
+
+        public int FontFamilySelectedIndex
+        {
+            get { return fontFamilySelectedIndex; }
+            set
+            {
+                SetProperty(ref fontFamilySelectedIndex, value);
+            }
+        }
+
+        #endregion 字体样式
+
+        #region 字体大小
+
+        private int fontSizeSelectedIndex;
+
+        public int FontSizeSelectedIndex
+        {
+            get { return fontSizeSelectedIndex; }
+            set
+            {
+                SetProperty(ref fontSizeSelectedIndex, value);
+            }
+        }
+
+        //下拉框列表:字体大小
+        private ComboDataItem _currentFontSize = new ComboDataItem(6);
+
+        public ComboDataItem CurrentFontSize
+        {
+            get { return _currentFontSize; }
+            set
+            {
+                SetProperty(ref _currentFontSize, value);
+                switch (value.Value)
+                {
+                    case 8:
+                        FontSizeSelectedIndex = 0;
+                        break;
+
+                    case 9:
+                        FontSizeSelectedIndex = 1;
+                        break;
+
+                    case 10:
+                        FontSizeSelectedIndex = 2;
+                        break;
+
+                    case 11:
+                        FontSizeSelectedIndex = 3;
+                        break;
+
+                    case 12:
+                        FontSizeSelectedIndex = 4;
+                        break;
+
+                    case 14:
+                        FontSizeSelectedIndex = 5;
+                        break;
+
+                    case 16:
+                        FontSizeSelectedIndex = 6;
+                        break;
+
+                    case 18:
+                        FontSizeSelectedIndex = 7;
+                        break;
+
+                    case 20:
+                        FontSizeSelectedIndex = 8;
+                        break;
+
+                    case 22:
+                        FontSizeSelectedIndex = 9;
+                        break;
+
+                    case 24:
+                        FontSizeSelectedIndex = 10;
+                        break;
+
+                    case 26:
+                        FontSizeSelectedIndex = 11;
+                        break;
+
+                    case 28:
+                        FontSizeSelectedIndex = 12;
+                        break;
+
+                    case 36:
+                        FontSizeSelectedIndex = 13;
+                        break;
+
+                    case 48:
+                        FontSizeSelectedIndex = 14;
+                        break;
+
+                    case 72:
+                        FontSizeSelectedIndex = 15;
+                        break;
+
+                    default:
+                        //FontSizeSelectedIndex = 0;
+                        //FontSizeSelectedIndex = -1;
+                        break;
+                }
+            }
+        }
+
+        #endregion 字体大小
+
+        //FontStyle & FontWeight
+
+        private FontStyle _fontStyleItem;
+
+        public FontStyle FontStyleItem
+        {
+            get { return _fontStyleItem; }
+            set { SetProperty(ref _fontStyleItem, value); }
+        }
+
+        private FontWeight _fontWeight;
+
+        public FontWeight FontWeightItem
+        {
+            get { return _fontWeight; }
+            set { SetProperty(ref _fontWeight, value); }
+        }
+
+        private int fontStyleSelectedIndex;
+
+        public int FontStyleSelectedIndex
+        {
+            get { return fontStyleSelectedIndex; }
+            set
+            {
+                SetProperty(ref fontStyleSelectedIndex, value);
+            }
+        }
+
+        private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
+
+        public ComboDataItem CurrrentFontWeightStyle
+        {
+            get { return _currrentFontWeightStyle; }
+            set
+            {
+                SetProperty(ref _currrentFontWeightStyle, value);
+                switch (value.Content.ToString())
+                {
+                    case "Regular":
+                        FontStyleSelectedIndex = 0;
+                        break;
+
+                    case "Bold":
+                        FontStyleSelectedIndex = 1;
+                        break;
+
+                    case "Italic":
+                        FontStyleSelectedIndex = 2;
+                        break;
+
+                    case "Bold Italic":
+                        FontStyleSelectedIndex = 3;
+                        break;
+                }
+            }
+        }
+
+        public void UpdateFontWeight_Style()
+        {
+            switch (CurrrentFontWeightStyle.ValueStr)
+            {
+                case "Regular":
+                    FontStyleItem = FontStyles.Normal;
+                    FontWeightItem = FontWeights.Normal;
+                    break;
+
+                case "Bold":
+                    FontStyleItem = FontStyles.Normal;
+                    FontWeightItem = FontWeights.Bold;
+                    break;
+
+                case "Italic":
+                    FontStyleItem = FontStyles.Italic;
+                    FontWeightItem = FontWeights.Normal;
+                    break;
+
+                case "Bold Italic":
+                    FontStyleItem = FontStyles.Italic;
+                    FontWeightItem = FontWeights.Bold;
+                    break;
+            }
+        }
+
+        //文字内容对齐
+        private string _strtextAlign;
+
+        public string StrTextAlign
+        {
+            get { return _strtextAlign; }
+            set { SetProperty(ref _strtextAlign, value); }
+        }
+
+        //颜色
+        private Brush _fontColor = new SolidColorBrush(Colors.Black);
+
+        public Brush FontColor
+        {
+            get { return _fontColor; }
+            set { SetProperty(ref _fontColor, value); CurrentFontColor = _fontColor; }
+        }
+
+        private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
+
+        public Brush CurrentFontColor
+        {
+            get { return _currentFontColor; }
+            set => SetProperty(ref _currentFontColor, value);
+        }
+
+        //外部UI引用,判断是否选中左对齐、居中对齐、右对齐,或都不选中
+        public string strAglinState { get; private set; }
+
+        //VM赋值
+        public void SetStrAglinState(string str)
+        {
+            strAglinState = str;
+        }
+
+        #endregion 属性
+
+        #region 列表选中赋值
+
+        public void GetFontWeights_Style(FontStyle fontStyle, FontWeight fontWeights)
+        {
+            string strValue = "";
+            string strContent = "";
+            if (fontStyle == FontStyles.Normal)
+            {
+                if (fontWeights == FontWeights.Normal)
+                {
+                    strValue = "Regular";
+                    strContent = "Regular";
+                }
+                else
+                {
+                    strValue = "Bold";
+                    strContent = "Bold";
+                }
+            }
+            else
+            {
+                if (fontWeights == FontWeights.Normal)
+                {
+                    strValue = "Italic";
+                    strContent = "Italic";
+                }
+                else
+                {
+                    strValue = "Bold Italic";
+                    strContent = "Bold Italic";
+                }
+            }
+
+            CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
+            UpdateFontWeight_Style();
+        }
+
+        public void GetCurrentFontSize(int size)
+        {
+            CurrentFontSize = new ComboDataItem(size);
+        }
+
+        public void GetCurrentFontFamily(string fontFamily, string uiStr)
+        {
+            if (fontFamily == "Helvetica")
+            {
+                fontFamily = "Arial";
+                uiStr = "Arial";
+            }
+            if (fontFamily == "Times-Roman")
+            {
+                uiStr = "Times New Roman";
+            }
+            if (fontFamily == "CourierNew")
+            {
+                uiStr = "Courier New";
+            }
+            if (fontFamily == "AdobeDevanagari")
+            {
+                uiStr = "Adobe Devanagari";
+            }
+            CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
+        }
+
+        public void GetCurrentPresetFont(string presetFont, string uiStr)
+        {
+            CurrentPresetFont = new ComboDataItem(presetFont, uiStr);
+        }
+
+        internal bool GetCurrentPresetFont(FreeTextAnnotArgs annot)
+        {
+            bool isExist = false;
+            //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
+            foreach (var item in PresetFontList)
+            {
+                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight == FontWeights.Bold) && annot.IsItalic == (item.mFontStyle == FontStyles.Italic)
+                && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
+                )
+                {
+                    if (item.mTag != "Custom")
+                    {
+                        CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
+                        isExist = true;
+                    }
+
+                    break;
+                }
+            }
+            return isExist;
+        }
+
+        #endregion 列表选中赋值
+    }
+}

+ 303 - 149
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -1,17 +1,17 @@
-using ImTools;
+using ImTools;
 using PDF_Master.CustomControl.CompositeControl;
-using PDF_Master.Helper;
-using PDF_Master.Model.AnnotPanel;
+using PDF_Master.Helper;
+using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
 using PDFSettings;
 using System;
 using System.Collections.Generic;
-using System.Globalization;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
-using System.Windows.Controls;
+using System.Windows.Controls;
 using System.Windows.Media;
 
 namespace PDF_Master.Model.PropertyPanel.AnnotPanel
@@ -24,9 +24,9 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             List<PresetFontItem> cacheTempList = new List<PresetFontItem>();
 
             if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PresetFontList();
-
-            if (Settings.Default.PreinstallFontList == null)
+                Settings.Default.PresetFontList = new PresetFontList();
+
+            if (Settings.Default.PreinstallFontList == null)
                 Settings.Default.PreinstallFontList = new PreinstallFontList();
 
             if (Settings.Default.PreinstallFontList.Count == 0/*Settings.Default.PresetFontList.Count == 0*/ )
@@ -44,7 +44,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                     Settings.Default.PresetFontList.Add(newItem);
 
                     //复杂数据类型 , 不可本地缓存到配置文件,需要转换一下(先 string保存,再根据类型缓存)
-                    var newItem1 = new PreinstallItem();
+                    var newItem1 = new PreinstallItem();
                     newItem1.mTag = cacheItem.mTag;
                     newItem1.mTagContent = cacheItem.mTagContent;
                     newItem1.mFontStyle = cacheItem.mFontStyle.ToString();
@@ -59,39 +59,129 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             else
             {
                 //根据 对应的字段 内容 ,对照相对应的类型
-                foreach (var item in Settings.Default.PreinstallFontList)
-                {
+                foreach (var item in Settings.Default.PreinstallFontList)
+                {
+                    var newItem = new PresetFontItem();
+                    newItem.mTag = item.mTag;
+                    newItem.mTagContent = item.mTagContent;
+                    switch (item.mFontStyle)
+                    {
+                        case "Normal":
+                            newItem.mFontStyle = FontStyles.Normal;
+                            break;
+
+                        case "Italic":
+                            newItem.mFontStyle = FontStyles.Italic;
+                            break;
+
+                        case "Oblique":
+                            newItem.mFontStyle = FontStyles.Oblique;
+                            break;
+                    }
+                    switch (item.mFontWeight)
+                    {
+                        case "Bold":
+                            newItem.mFontWeight = FontWeights.Bold;
+                            break;
+
+                        case "Normal":
+                            newItem.mFontWeight = FontWeights.Normal;
+                            break;
+                    }
+                    newItem.mFontSize = item.mFontSize;
+                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
+
+                    cacheTempList.Add(newItem);
+                }
+                //foreach (var item in Settings.Default.PresetFontList)
+                //{
+                //    var newItem = new PresetFontItem();
+                //    newItem.mTag = item.mTag;
+                //    newItem.mTagContent = item.mTagContent;
+                //    newItem.mFontStyle = item.mFontStyle;
+                //    newItem.mFontWeight = item.mFontWeight;
+                //    newItem.mFontSize = item.mFontSize;
+                //    newItem.mFontFamily = item.mFontFamily;
+                //    cacheTempList.Add(newItem);
+                //}
+            }
+
+            return cacheTempList;
+        }
+
+        public static List<PresetFontItem> GetCachePresetEditFontList()
+        {
+            List<PresetFontItem> cacheTempList = new List<PresetFontItem>();
+
+            if (Settings.Default.PresetEditFontList == null)
+                Settings.Default.PresetEditFontList = new PresetEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList == null)
+                Settings.Default.PreinstallEditFontList = new PreinstallEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList.Count == 0/*Settings.Default.PresetFontList.Count == 0*/ )
+            {
+                cacheTempList = GetPresetFontStyle();
+                foreach (var cacheItem in cacheTempList)
+                {
+                    var newItem = new PresetFontItem();
+                    newItem.mTag = cacheItem.mTag;
+                    newItem.mTagContent = cacheItem.mTagContent;
+                    newItem.mFontStyle = cacheItem.mFontStyle;
+                    newItem.mFontWeight = cacheItem.mFontWeight;
+                    newItem.mFontSize = cacheItem.mFontSize;
+                    newItem.mFontFamily = cacheItem.mFontFamily;
+                    Settings.Default.PresetEditFontList.Add(newItem);
+
+                    //复杂数据类型 , 不可本地缓存到配置文件,需要转换一下(先 string保存,再根据类型缓存)
+                    var newItem1 = new PreinstallItem();
+                    newItem1.mTag = cacheItem.mTag;
+                    newItem1.mTagContent = cacheItem.mTagContent;
+                    newItem1.mFontStyle = cacheItem.mFontStyle.ToString();
+                    newItem1.mFontWeight = cacheItem.mFontWeight.ToString();
+                    newItem1.mFontSize = cacheItem.mFontSize;
+                    newItem1.mFontFamily = cacheItem.mFontFamily.Source;
+                    Settings.Default.PreinstallEditFontList.Add(newItem1);
+                }
+
+                Settings.Default.Save();
+            }
+            else
+            {
+                //根据 对应的字段 内容 ,对照相对应的类型
+                foreach (var item in Settings.Default.PreinstallEditFontList)
+                {
                     var newItem = new PresetFontItem();
                     newItem.mTag = item.mTag;
                     newItem.mTagContent = item.mTagContent;
-                    switch (item.mFontStyle)
-                    {
-                        case "Normal":
-                            newItem.mFontStyle = FontStyles.Normal;
-                            break;
-
-                        case "Italic":
-                            newItem.mFontStyle = FontStyles.Italic;
-                            break;
-
-                        case "Oblique":
-                            newItem.mFontStyle = FontStyles.Oblique;
-                            break;
+                    switch (item.mFontStyle)
+                    {
+                        case "Normal":
+                            newItem.mFontStyle = FontStyles.Normal;
+                            break;
+
+                        case "Italic":
+                            newItem.mFontStyle = FontStyles.Italic;
+                            break;
+
+                        case "Oblique":
+                            newItem.mFontStyle = FontStyles.Oblique;
+                            break;
                     }
-                    switch (item.mFontWeight)
-                    {
-                        case "Bold":
-                            newItem.mFontWeight = FontWeights.Bold;
-                            break;
-
-                        case "Normal":
-                            newItem.mFontWeight = FontWeights.Normal;
-                            break;
+                    switch (item.mFontWeight)
+                    {
+                        case "Bold":
+                            newItem.mFontWeight = FontWeights.Bold;
+                            break;
+
+                        case "Normal":
+                            newItem.mFontWeight = FontWeights.Normal;
+                            break;
                     }
                     newItem.mFontSize = item.mFontSize;
-                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
-
-                    cacheTempList.Add(newItem);
+                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
+
+                    cacheTempList.Add(newItem);
                 }
                 //foreach (var item in Settings.Default.PresetFontList)
                 //{
@@ -115,11 +205,11 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             if (list == null) return;
 
             if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PresetFontList();
-
-            if (Settings.Default.PreinstallFontList == null)
-                Settings.Default.PreinstallFontList = new PreinstallFontList();
-
+                Settings.Default.PresetFontList = new PresetFontList();
+
+            if (Settings.Default.PreinstallFontList == null)
+                Settings.Default.PreinstallFontList = new PreinstallFontList();
+
             bool isCanSave = false;
             List<PresetFontItem> TempLists = new List<PresetFontItem>();
 
@@ -138,26 +228,90 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                     {
                         isCanSave = true;
                         var index = Settings.Default.PreinstallFontList.FindIndex(temp => temp.mTag == cacheItem.mTag);
-                        if (index != -1)
-                        {
-                            Settings.Default.PreinstallFontList.Remove(cacheItem);
-
-                            var newItem1 = new PreinstallItem();
-                            newItem1.mTag = item.mTag;
-                            newItem1.mTagContent = item.mTagContent;
-                            newItem1.mFontStyle = item.mFontStyle.ToString();
-                            newItem1.mFontWeight = item.mFontWeight.ToString();
-                            newItem1.mFontSize = item.mFontSize;
-                            newItem1.mFontFamily = item.mFontFamily.Source;
-                            Settings.Default.PreinstallFontList.Insert(index, newItem1);
+                        if (index != -1)
+                        {
+                            Settings.Default.PreinstallFontList.Remove(cacheItem);
+
+                            var newItem1 = new PreinstallItem();
+                            newItem1.mTag = item.mTag;
+                            newItem1.mTagContent = item.mTagContent;
+                            newItem1.mFontStyle = item.mFontStyle.ToString();
+                            newItem1.mFontWeight = item.mFontWeight.ToString();
+                            newItem1.mFontSize = item.mFontSize;
+                            newItem1.mFontFamily = item.mFontFamily.Source;
+                            Settings.Default.PreinstallFontList.Insert(index, newItem1);
+                        }
+                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
+                        //cacheItem.mFontSize = item.mFontSize;
+                        //cacheItem.mFontStyle = item.mFontStyle;
+                        //cacheItem.mFontWeight = item.mFontWeight;
+
+                        break;
+                    }
+                }
+                //else
+                //{
+                //    TempLists.Add(item);
+                //}
+            }
+
+            //foreach (var itemTemp in TempLists)
+            //{
+            //    Settings.Default.PresetFontList.Add(itemTemp);
+            //}
+
+            if (isCanSave)
+                Settings.Default.Save();
+        }
+
+        public static void SavePresetEditFontList(List<PresetFontItem> list)
+        {
+            if (list == null) return;
+
+            if (Settings.Default.PresetEditFontList == null)
+                Settings.Default.PresetEditFontList = new PresetEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList == null)
+                Settings.Default.PreinstallEditFontList = new PreinstallEditFontList();
+
+            bool isCanSave = false;
+            List<PresetFontItem> TempLists = new List<PresetFontItem>();
+
+            foreach (var item in list)
+            {
+                //根据预设标题 ,找到 相对应数据
+                var cacheItem = Settings.Default.PreinstallEditFontList.FirstOrDefault(temp => temp.mTag == item.mTag);
+                if (cacheItem != null)
+                {
+                    //比对数据,如果不一样 ,更新数据
+                    if (cacheItem.mFontFamily != item.mFontFamily.Source ||
+                       cacheItem.mFontSize != item.mFontSize ||
+                       cacheItem.mFontStyle != item.mFontStyle.ToString() ||
+                       cacheItem.mFontWeight != item.mFontWeight.ToString()
+                        )
+                    {
+                        isCanSave = true;
+                        var index = Settings.Default.PreinstallEditFontList.FindIndex(temp => temp.mTag == cacheItem.mTag);
+                        if (index != -1)
+                        {
+                            Settings.Default.PreinstallEditFontList.Remove(cacheItem);
+
+                            var newItem1 = new PreinstallItem();
+                            newItem1.mTag = item.mTag;
+                            newItem1.mTagContent = item.mTagContent;
+                            newItem1.mFontStyle = item.mFontStyle.ToString();
+                            newItem1.mFontWeight = item.mFontWeight.ToString();
+                            newItem1.mFontSize = item.mFontSize;
+                            newItem1.mFontFamily = item.mFontFamily.Source;
+                            Settings.Default.PreinstallEditFontList.Insert(index, newItem1);
                         }
-                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
-                        //cacheItem.mFontSize = item.mFontSize;
-                        //cacheItem.mFontStyle = item.mFontStyle;
-                        //cacheItem.mFontWeight = item.mFontWeight;
-
+                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
+                        //cacheItem.mFontSize = item.mFontSize;
+                        //cacheItem.mFontStyle = item.mFontStyle;
+                        //cacheItem.mFontWeight = item.mFontWeight;
+
                         break;
-                    }
+                    }
                 }
                 //else
                 //{
@@ -171,7 +325,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             //}
 
             if (isCanSave)
-                Settings.Default.Save();
+                Settings.Default.Save();
         }
 
         public static void BackDefaultPresetFontStyle(string tag)
@@ -222,8 +376,8 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
 
             PresetFontItem h1 = new PresetFontItem();
             h1.mTag = "H1";
-            h1.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H1Title");
-
+            h1.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H1Title");
+
             h1.mFontSize = 36;
             h1.mFontFamily = new FontFamily("Arial");
             h1.mFontStyle = FontStyles.Normal;
@@ -231,8 +385,8 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
 
             PresetFontItem h2 = new PresetFontItem();
             h2.mTag = "H2";
-            h2.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H2Title");
-
+            h2.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H2Title");
+
             h2.mFontSize = 24;
             h2.mFontFamily = new FontFamily("Arial");
             h2.mFontStyle = FontStyles.Normal;
@@ -298,97 +452,97 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             FontStyleItems.Add(item);
 
             return FontStyleItems;
-        }
-
-        internal static List<ComboDataItem> GetFontSize()
-        {
-            var FontSizeItems = new List<ComboDataItem>();
-            ComboDataItem item = new ComboDataItem(8);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(9);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(10);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(11);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(12);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(14);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(16);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(18);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(20);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(22);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(24);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(26);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(28);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(36);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(48);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(72);
-            FontSizeItems.Add(item);
-            return FontSizeItems;
-        }
-
+        }
+
+        internal static List<ComboDataItem> GetFontSize()
+        {
+            var FontSizeItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem(8);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(9);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(10);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(11);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(12);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(14);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(16);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(18);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(20);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(22);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(24);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(26);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(28);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(36);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(48);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(72);
+            FontSizeItems.Add(item);
+            return FontSizeItems;
+        }
+
         public static List<ComboDataItem> GetFamily()
-        {
-            var FontFamilyItems = new List<ComboDataItem>();
-            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
-            FontFamilyItems.Add(item);
-            item = new ComboDataItem("Arial", "Arial");
-            FontFamilyItems.Add(item);
-            item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
+        {
+            var FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Arial", "Arial");
             FontFamilyItems.Add(item);
-            return FontFamilyItems;
+            item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
+            FontFamilyItems.Add(item);
+            return FontFamilyItems;
         }
 
         public static List<ComboDataItem> GetFamilyEdit()
-        {
-            System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();
+        {
+            System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();
             var FontFamilyItems = new List<ComboDataItem>();
-            ComboDataItem item;
-
-            foreach (var itemFam in EditHelper.GetFontFamily())
-            {
-                string content = itemFam;
-                if (itemFam.Equals("Informal"))
-                {
-                    content = "Informal Roman";
-                }
-                //屏蔽 SDK暂时无效的字体
-                if (itemFam.Equals("Marlett") || itemFam.Equals("MT Extra")
-                 || itemFam.Equals("Symbol") || itemFam.Equals("HoloLens MDL2 Assets")
-                 || itemFam.Equals("Wingdings") || itemFam.Equals("Wingdings 2")
-                 || itemFam.Equals("Wingdings 3") || itemFam.Equals("Webdings")
-                 || itemFam.Equals("ZWAdobeF") || itemFam.Equals("Algerian")
-                 || itemFam.Equals("Bookshelf Symbol 7") || itemFam.Equals("Castellar")
-                 || itemFam.Equals("MS Outlook") || itemFam.Equals("MS Reference Specialty")
-                 || itemFam.Equals("Segoe Fluent Icons") || itemFam.Equals("Segoe MDL2 Assets")
-                 || itemFam.Equals("Stencil"))
-                {
-                    continue;
-                }
-                item = new ComboDataItem(DeleteCharacters(itemFam), content);
-                item.FontFamily = new FontFamily(content);
-                FontFamilyItems.Add(item);
+            ComboDataItem item;
+
+            foreach (var itemFam in EditHelper.GetFontFamily())
+            {
+                string content = itemFam;
+                if (itemFam.Equals("Informal"))
+                {
+                    content = "Informal Roman";
+                }
+                //屏蔽 SDK暂时无效的字体
+                if (itemFam.Equals("Marlett") || itemFam.Equals("MT Extra")
+                 || itemFam.Equals("Symbol") || itemFam.Equals("HoloLens MDL2 Assets")
+                 || itemFam.Equals("Wingdings") || itemFam.Equals("Wingdings 2")
+                 || itemFam.Equals("Wingdings 3") || itemFam.Equals("Webdings")
+                 || itemFam.Equals("ZWAdobeF") || itemFam.Equals("Algerian")
+                 || itemFam.Equals("Bookshelf Symbol 7") || itemFam.Equals("Castellar")
+                 || itemFam.Equals("MS Outlook") || itemFam.Equals("MS Reference Specialty")
+                 || itemFam.Equals("Segoe Fluent Icons") || itemFam.Equals("Segoe MDL2 Assets")
+                 || itemFam.Equals("Stencil"))
+                {
+                    continue;
+                }
+                item = new ComboDataItem(DeleteCharacters(itemFam), content);
+                item.FontFamily = new FontFamily(content);
+                FontFamilyItems.Add(item);
             }
-            return FontFamilyItems;
-        }
-
-        public static string DeleteCharacters(string str)
-        {
-            str = str.Replace(" ", string.Empty);
-            str = str.Replace("-", string.Empty);
-            str = str.Replace("_", string.Empty);
-            return str;
+            return FontFamilyItems;
+        }
+
+        public static string DeleteCharacters(string str)
+        {
+            str = str.Replace(" ", string.Empty);
+            str = str.Replace("-", string.Empty);
+            str = str.Replace("_", string.Empty);
+            return str;
         }
 
         public static List<ComboDataItem> GetDateFormats()
@@ -434,6 +588,6 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             TimesItems.Add("yy-MM-dd");
             TimesItems.Add("yyyy-MM-dd");
             return TimesItems;
-        }
+        }
     }
 }

+ 2 - 1
PDF Office/PDF Master.csproj

@@ -426,6 +426,7 @@
     <Compile Include="Model\AnnotPanel\AnnotColorList.cs" />
     <Compile Include="Model\AnnotPanel\AnnotCommon.cs" />
     <Compile Include="Model\AnnotPanel\FontBoard.cs" />
+    <Compile Include="Model\AnnotPanel\FontBoardVm.cs" />
     <Compile Include="Model\AnnotPanel\Signature.cs" />
     <Compile Include="Model\BOTA\AnnotationHandlerEventArgs.cs" />
     <Compile Include="Model\AnnotPanel\Stamp.cs" />
@@ -490,7 +491,7 @@
     <Compile Include="Model\PageEdit\PageSizeInfo.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\PDFTool\ToolItem.cs" />
-    <Compile Include="Model\PropertyPanel\AnnotPanel\FontStyleItem.cs" />
+    <Compile Include="Model\PropertyPanel\AnnotPanel\TextFont.cs" />
     <Compile Include="Model\RegionNames.cs" />
     <Compile Include="CustomControl\SystemControl\TabablzRegionBehavior.cs" />
     <Compile Include="DataConvert\BoolToVisible.cs" />

+ 22 - 0
PDF Office/Properties/Settings.Designer.cs

@@ -327,5 +327,27 @@ namespace PDF_Master.Properties {
                 this["DefaultEditProperties"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.PresetEditFontList PresetEditFontList {
+            get {
+                return ((global::PDFSettings.PresetEditFontList)(this["PresetEditFontList"]));
+            }
+            set {
+                this["PresetEditFontList"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.PreinstallEditFontList PreinstallEditFontList {
+            get {
+                return ((global::PDFSettings.PreinstallEditFontList)(this["PreinstallEditFontList"]));
+            }
+            set {
+                this["PreinstallEditFontList"] = value;
+            }
+        }
     }
 }

+ 6 - 0
PDF Office/Properties/Settings.settings

@@ -83,5 +83,11 @@
     <Setting Name="DefaultEditProperties" Type="PDFSettings.DefaultEditProperties" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="PresetEditFontList" Type="PDFSettings.PresetEditFontList" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+    <Setting Name="PreinstallEditFontList" Type="PDFSettings.PreinstallEditFontList" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

+ 9 - 7
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -404,7 +404,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
             //SelectedPresetFont();
             //更改后 保存到本地缓存
-            TextFont.SavePresetFontList(PresetFontList);
+            TextFont.SavePresetEditFontList(PresetFontList);
         }
 
         //重置定义
@@ -433,7 +433,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
                         CurrentPresetFont = new ComboDataItem(defaulItem.mTag, defaulItem.mTagContent);
                         SelectedPresetFont();
-                        TextFont.SavePresetFontList(PresetFontList);
+                        TextFont.SavePresetEditFontList(PresetFontList);
                     }
                 }
             }
@@ -892,16 +892,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 if (TextEditEvent.SystemFontNameList.Count > 0)
                 {
                     EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
-
-                    if (defaultEdit != null)
+                    App.IsGetTextFamily = true;
+                }
+                InitBase_FontFamilys();
+                if (defaultEdit != null)
+                {
+                    if (defaultEdit.SystemFontNameList.Count < EditHelper.FontFamily.Count)
                     {
-                        defaultEdit.SystemFontNameList = TextEditEvent.SystemFontNameList;
+                        defaultEdit.SystemFontNameList = EditHelper.FontFamily;
                         SettingHelper.SetPDFEditProperty(defaultEdit);
                         Settings.Default.Save();
                     }
-                    App.IsGetTextFamily = true;
                 }
-                InitBase_FontFamilys();
             }
 
             SelectColor = new SolidColorBrush(TextEditEvent.FontColor);

+ 1 - 0
PDFSettings/PDFSettings.csproj

@@ -100,6 +100,7 @@
     <Compile Include="BackgroundTemplateList.cs" />
     <Compile Include="PDFEditList.cs" />
     <Compile Include="PDFToolsList.cs" />
+    <Compile Include="PresetEditFontList.cs" />
     <Compile Include="PresetFontList.cs" />
     <Compile Include="ProductActiveInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 16 - 0
PDFSettings/PresetEditFontList.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+    public class PresetEditFontList : List<PresetFontItem>
+    {
+    }
+
+    public class PreinstallEditFontList : List<PreinstallItem>
+    {
+    }
+}