diff --git a/App/Common/FontHelper.cs b/App/Common/FontHelper.cs index eba7534..e283909 100644 --- a/App/Common/FontHelper.cs +++ b/App/Common/FontHelper.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using iTextSharp.text.pdf; +using Microsoft.Win32; using CharSet = System.Runtime.InteropServices.CharSet; using DllImport = System.Runtime.InteropServices.DllImportAttribute; -using Microsoft.Win32; namespace PDFPatcher.Common { @@ -49,7 +49,6 @@ namespace PDFPatcher.Common } else if (fp.HasExtension(Constants.FileExtensions.Ttc)) { var nl = BaseFont.EnumerateTTCNames(p).Length; - //Tracker.DebugMessage (p); for (int i = 0; i < nl; i++) { AddFontNames(d, p + "," + i.ToText(), includeFamilyName); } @@ -68,9 +67,8 @@ namespace PDFPatcher.Common static void AddFontNames(Dictionary fontNames, string fontPath, bool includeFamilyName) { var nl = BaseFont.GetAllFontNames(fontPath, "Cp936", null); - //Tracker.DebugMessage (fontPath); if (includeFamilyName) { - fontNames[nl[0] as string] = fontPath; + AddFontName(fontNames, nl[0] as string, fontPath); } var ffn = nl[2] as string[][]; string n = null; @@ -90,13 +88,14 @@ namespace PDFPatcher.Common } } if (n != null) { - //Tracker.DebugMessage (cn ?? nn ?? n); - fontNames[cn ?? nn ?? n] = fontPath; + AddFontName(fontNames, cn ?? nn ?? n, fontPath); + } + } + + static void AddFontName(Dictionary fontNames, string name, string path) { + if (!String.IsNullOrEmpty(name)) { + fontNames[name] = path; } - //foreach (string[] item in nl[1] as string[][]) { - // fontNames[item] = fontPath; - // Tracker.DebugMessage (item); - //} } static class NativeMethods diff --git a/更新历史.txt b/更新历史.txt index e2b85fc..b01db21 100644 --- a/更新历史.txt +++ b/更新历史.txt @@ -22,6 +22,7 @@ 在“关于程序”页面无法打开文档。 自动生成书签功能可能生成空白的书签。 自动生成书签列表框导入之前保存的条件后,插入新书签将清空规则列表。 + 列出系统安装字体时,对于异常的字体不要抛出异常。 1.0.4.4512 2024年9月30日 新增功能: