Quellcode durchsuchen

编辑-字体列表跟随SDK支持的系统字体变化

lvle vor 1 Jahr
Ursprung
Commit
8da4930710

+ 1 - 1
PDF Office/App.xaml.cs

@@ -135,7 +135,7 @@ namespace PDF_Master
         public static bool IsFirstOpen = true;
 
         /// <summary>
-        /// 是否获取了SDK支持的系统样式
+        /// 是否获取了SDK支持的系统字体
         /// </summary>
         public static bool IsGetTextFamily = false;
 

+ 127 - 0
PDF Office/Helper/EditHelper.cs

@@ -0,0 +1,127 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.Helper
+{
+    public static class EditHelper
+    {
+        public static List<string> FontFamily { get; set; } = new List<string>
+{
+    "Adobe Devanagari",
+    "Arial",
+    "Arial Black",
+    "Arvo",
+    "Bahnschrift",
+    "Bahnschrift Condensed",
+    "Bahnschrift Light Condensed",
+    "Bahnschrift Light SemiCondensed",
+    "Bahnschrift SemiBold Condensed",
+    "Bahnschrift SemiCondensed",
+    "Bahnschrift SemiLight",
+    "Bahnschrift SemiLight Condensed",
+    "Calibri",
+    "Cambria",
+    "Cambria Math",
+    "Candara",
+    "Cascadia Code",
+    "Cascadia Code SemiLight",
+    "Cascadia Mono",
+    "Cascadia Mono SemiLight",
+    "Comic Sans MS",
+    "Consolas",
+    "Constantia",
+    "Corbel",
+    "Courier New",
+    "DejaVu Math TeX Gyre",
+    "Droid Serif",
+    "Ebrima",
+    "Franklin Gothic",
+    "Gabriola",
+    "Gadugi",
+    "Georgia",
+    "HoloLens MDL2 Assets",
+    "Impact",
+    "Indie Flower",
+    "Ink Free",
+    "Javanese Text",
+    "Leelawadee UI",
+    "Leelawadee UI Semilight",
+    "Lobster",
+    "Lucida Console",
+    "Lucida Sans Unicode",
+    "MS Gothic",
+    "MS PGothic",
+    "MS UI Gothic",
+    "MT Extra",
+    "MV Boli",
+    "Malgun Gothic",
+    "Malgun Gothic Semilight",
+    "Marlett",
+    "Microsoft Himalaya",
+    "Microsoft JhengHei",
+    "Microsoft JhengHei UI",
+    "Microsoft New Tai Lue",
+    "Microsoft PhagsPa",
+    "Microsoft Sans Serif",
+    "Microsoft Tai Le",
+    "Microsoft YaHei UI",
+    "Microsoft Yi Baiti",
+    "MingLiU-ExtB",
+    "MingLiU_HKSCS-ExtB",
+    "Mongolian Baiti",
+    "Myanmar Text",
+    "Nirmala UI",
+    "Nirmala UI Semilight",
+    "Open Sans",
+    "PMingLiU-ExtB",
+    "Palatino Linotype",
+    "Poiret One",
+    "Raleway",
+    "Roboto",
+    "Roboto Condensed",
+    "Roboto Slab",
+    "Sans Serif Collection",
+    "Segoe Fluent Icons",
+    "Segoe MDL2 Assets",
+    "Segoe Print",
+    "Segoe Script",
+    "Segoe UI",
+    "Segoe UI Black",
+    "Segoe UI Emoji",
+    "Segoe UI Historic",
+    "Segoe UI Semilight",
+    "Segoe UI Symbol",
+    "Segoe UI Variable Display",
+    "Segoe UI Variable Small",
+    "Segoe UI Variable Text",
+    "SimSun-ExtB",
+    "Sitka Banner",
+    "Sitka Display",
+    "Sitka Heading",
+    "Sitka Small",
+    "Sitka Subheading",
+    "Sitka Text",
+    "Sylfaen",
+    "Symbol",
+    "Tahoma",
+    "Times New",
+    "Trebuchet MS",
+    "Verdana",
+    "Webdings",
+    "Wingdings",
+    "Yu Gothic",
+    "Yu Gothic UI",
+    "Yu Gothic UI Semilight",
+    "ZWAdobeF",
+    "等线",
+    "仿宋",
+    "黑体",
+    "楷体",
+    "宋体",
+    "微软雅黑"
+};
+    }
+}

+ 13 - 117
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -6,6 +6,7 @@ using PDFSettings;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -33,128 +34,23 @@ namespace PDF_Master.Model.AnnotPanel
         protected event EventHandler<FontSetModeType> ChangedValue;
 
         protected bool IsCanSave = false;
-        public List<ComboDataItem> FontFamilyItems { get; protected set; }
+
+        private List<ComboDataItem> _fontFamilyItems;
+
+        public List<ComboDataItem> FontFamilyItems
+        {
+            get { return _fontFamilyItems; }
+            set
+            {
+                SetProperty(ref _fontFamilyItems, value);
+            }
+        }
         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 List<string> FontFamily { get;  set; } = new List<string>
-{
-    "Adobe Devanagari",
-    "Arial",
-    "Arial Black",
-    "Arvo",
-    "Bahnschrift",
-    "Bahnschrift Condensed",
-    "Bahnschrift Light Condensed",
-    "Bahnschrift Light SemiCondensed",
-    "Bahnschrift SemiBold Condensed",
-    "Bahnschrift SemiCondensed",
-    "Bahnschrift SemiLight",
-    "Bahnschrift SemiLight Condensed",
-    "Calibri",
-    "Cambria",
-    "Cambria Math",
-    "Candara",
-    "Cascadia Code",
-    "Cascadia Code SemiLight",
-    "Cascadia Mono",
-    "Cascadia Mono SemiLight",
-    "Comic Sans MS",
-    "Consolas",
-    "Constantia",
-    "Corbel",
-    "Courier New",
-    "DejaVu Math TeX Gyre",
-    "Droid Serif",
-    "Ebrima",
-    "Franklin Gothic",
-    "Gabriola",
-    "Gadugi",
-    "Georgia",
-    "HoloLens MDL2 Assets",
-    "Impact",
-    "Indie Flower",
-    "Ink Free",
-    "Javanese Text",
-    "Leelawadee UI",
-    "Leelawadee UI Semilight",
-    "Lobster",
-    "Lucida Console",
-    "Lucida Sans Unicode",
-    "MS Gothic",
-    "MS PGothic",
-    "MS UI Gothic",
-    "MT Extra",
-    "MV Boli",
-    "Malgun Gothic",
-    "Malgun Gothic Semilight",
-    "Marlett",
-    "Microsoft Himalaya",
-    "Microsoft JhengHei",
-    "Microsoft JhengHei UI",
-    "Microsoft New Tai Lue",
-    "Microsoft PhagsPa",
-    "Microsoft Sans Serif",
-    "Microsoft Tai Le",
-    "Microsoft YaHei UI",
-    "Microsoft Yi Baiti",
-    "MingLiU-ExtB",
-    "MingLiU_HKSCS-ExtB",
-    "Mongolian Baiti",
-    "Myanmar Text",
-    "Nirmala UI",
-    "Nirmala UI Semilight",
-    "Open Sans",
-    "PMingLiU-ExtB",
-    "Palatino Linotype",
-    "Poiret One",
-    "Raleway",
-    "Roboto",
-    "Roboto Condensed",
-    "Roboto Slab",
-    "Sans Serif Collection",
-    "Segoe Fluent Icons",
-    "Segoe MDL2 Assets",
-    "Segoe Print",
-    "Segoe Script",
-    "Segoe UI",
-    "Segoe UI Black",
-    "Segoe UI Emoji",
-    "Segoe UI Historic",
-    "Segoe UI Semilight",
-    "Segoe UI Symbol",
-    "Segoe UI Variable Display",
-    "Segoe UI Variable Small",
-    "Segoe UI Variable Text",
-    "SimSun-ExtB",
-    "Sitka Banner",
-    "Sitka Display",
-    "Sitka Heading",
-    "Sitka Small",
-    "Sitka Subheading",
-    "Sitka Text",
-    "Sylfaen",
-    "Symbol",
-    "Tahoma",
-    "Times New",
-    "Trebuchet MS",
-    "Verdana",
-    "Webdings",
-    "Wingdings",
-    "Yu Gothic",
-    "Yu Gothic UI",
-    "Yu Gothic UI Semilight",
-    "ZWAdobeF",
-    "等线",
-    "仿宋",
-    "黑体",
-    "楷体",
-    "宋体",
-    "微软雅黑"
-};
 
         #endregion 变量
 
@@ -188,7 +84,7 @@ namespace PDF_Master.Model.AnnotPanel
 
         //字体
         public void InitBase_FontFamilys()
-        {
+        { 
             FontFamilyItems = TextFont.GetFamilyEdit();
         }
 

+ 2 - 2
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -1,4 +1,5 @@
 using PDF_Master.CustomControl.CompositeControl;
+using PDF_Master.Helper;
 using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
 using PDFSettings;
@@ -353,8 +354,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();
             var FontFamilyItems = new List<ComboDataItem>();
             ComboDataItem item;
-            FontBoard fontBoard = new FontBoard();
-            foreach (var itemFam in fontBoard.FontFamily)
+            foreach (var itemFam in EditHelper.FontFamily)
             {
                 item = new ComboDataItem(DeleteCharacters(itemFam),itemFam);
                 FontFamilyItems.Add(item);

+ 1 - 0
PDF Office/PDF Master.csproj

@@ -398,6 +398,7 @@
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\CropPageUndoManager.cs" />
     <Compile Include="Helper\DataTrackingHelper.cs" />
+    <Compile Include="Helper\EditHelper.cs" />
     <Compile Include="Helper\ErrorCodeHelper.cs" />
     <Compile Include="Helper\FileComparisonHelper.cs" />
     <Compile Include="Helper\GlobalCommands.cs" />

+ 6 - 1
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -816,10 +816,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         //获取文本参数
         private void GetPDFEdit()
         {
+            if (!App.IsGetTextFamily)
+            {
 
+                EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
+                InitBase_FontFamilys();
+                App.IsGetTextFamily = true;
+            }
             SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
             CurrentFontSize =new ComboDataItem(TextEditEvent.FontSize);
-            
             CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
             FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
             FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;

+ 2 - 8
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -699,16 +699,10 @@ namespace PDF_Master.ViewModels.Tools
                     if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
                         isText = true;
-                        if(!App.IsGetTextFamily)
-                        {
-                            FontBoard fontBoard = new FontBoard();
-                            fontBoard.FontFamily = e[0].SystemFontNameList;
-                            fontBoard.InitBase_FontFamilys();
-                            App.IsGetTextFamily = true;
-                        }
                     }
                 }
-
+               
+              
 
                 if (isText == true && isImg == false)
                 {