提交 81941de0 编写于 作者: W WMJ

-更正代码中的拼写错误

上级 77b7072a
......@@ -449,7 +449,7 @@ namespace PDFPatcher
internal const string Name = "名称";
internal const string Size = "文本尺寸";
}
internal static class FontOccurance
internal static class FontOccurrence
{
internal const string Count = "出现次数";
internal const string FirstText = "首次出现文本";
......
......@@ -61,21 +61,21 @@ namespace PDFPatcher.Functions
}
else if (f.ParentNode?.Name == Constants.Font.ThisName) {
f.GetAttribute(Constants.Font.Size).TryParse(out float p);
var t = f.GetAttribute(Constants.FontOccurance.FirstText);
var t = f.GetAttribute(Constants.FontOccurrence.FirstText);
return String.Concat(p.ToText(), "(", t, ")");
}
return null;
};
_CountColumn.AspectGetter = (object o) => {
if (o is XmlElement f) {
f.GetAttribute(Constants.FontOccurance.Count).TryParse(out int p);
f.GetAttribute(Constants.FontOccurrence.Count).TryParse(out int p);
return p;
}
return null;
};
_FirstPageColumn.AspectGetter = (object o) => {
if (o is XmlElement f) {
f.GetAttribute(Constants.FontOccurance.FirstPage).TryParse(out int p);
f.GetAttribute(Constants.FontOccurrence.FirstPage).TryParse(out int p);
return p;
}
return null;
......
......@@ -44,7 +44,7 @@
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this._WritingDirectionBox = new System.Windows.Forms.ComboBox();
this._AutoHierarchicleArrangementBox = new System.Windows.Forms.CheckBox();
this._AutoHierarchicalArrangementBox = new System.Windows.Forms.CheckBox();
this.label11 = new System.Windows.Forms.Label();
this._MaxDistanceBetweenLinesBox = new System.Windows.Forms.NumericUpDown();
this._GoToPageTopLevelBox = new System.Windows.Forms.NumericUpDown();
......@@ -198,7 +198,7 @@
this.tabPage1.Controls.Add(this.label6);
this.tabPage1.Controls.Add(this.label5);
this.tabPage1.Controls.Add(this._WritingDirectionBox);
this.tabPage1.Controls.Add(this._AutoHierarchicleArrangementBox);
this.tabPage1.Controls.Add(this._AutoHierarchicalArrangementBox);
this.tabPage1.Controls.Add(this.label11);
this.tabPage1.Controls.Add(this._MaxDistanceBetweenLinesBox);
this.tabPage1.Controls.Add(this._GoToPageTopLevelBox);
......@@ -283,15 +283,15 @@
this._WritingDirectionBox.Size = new System.Drawing.Size(76, 20);
this._WritingDirectionBox.TabIndex = 9;
//
// _AutoHierarchicleArrangementBox
// _AutoHierarchicalArrangementBox
//
this._AutoHierarchicleArrangementBox.AutoSize = true;
this._AutoHierarchicleArrangementBox.Location = new System.Drawing.Point(6, 63);
this._AutoHierarchicleArrangementBox.Name = "_AutoHierarchicleArrangementBox";
this._AutoHierarchicleArrangementBox.Size = new System.Drawing.Size(120, 16);
this._AutoHierarchicleArrangementBox.TabIndex = 7;
this._AutoHierarchicleArrangementBox.Text = "自动组织标题层次";
this._AutoHierarchicleArrangementBox.UseVisualStyleBackColor = true;
this._AutoHierarchicalArrangementBox.AutoSize = true;
this._AutoHierarchicalArrangementBox.Location = new System.Drawing.Point(6, 63);
this._AutoHierarchicalArrangementBox.Name = "_AutoHierarchicalArrangementBox";
this._AutoHierarchicalArrangementBox.Size = new System.Drawing.Size(120, 16);
this._AutoHierarchicalArrangementBox.TabIndex = 7;
this._AutoHierarchicalArrangementBox.Text = "自动组织标题层次";
this._AutoHierarchicalArrangementBox.UseVisualStyleBackColor = true;
//
// label11
//
......@@ -817,7 +817,7 @@
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button _ClearTextFiltersButton;
private System.Windows.Forms.CheckBox _AutoHierarchicleArrangementBox;
private System.Windows.Forms.CheckBox _AutoHierarchicalArrangementBox;
private BrightIdeasSoftware.ObjectListView _LevelAdjustmentBox;
private BrightIdeasSoftware.OLVColumn _AdvancedFilterColumn;
private BrightIdeasSoftware.OLVColumn _AdjustmentLevelColumn;
......
......@@ -31,7 +31,7 @@ namespace PDFPatcher.Functions
AppContext.MainForm.SetTooltip(_BookmarkControl.FileList, "指定识别书签后生成的信息文件或简易文本书签文件路径");
AppContext.MainForm.SetTooltip(_ExportBookmarkButton, "点击此按钮识别 PDF 文件的标题为信息文件");
AppContext.MainForm.SetTooltip(_TitleSizeThresholdBox, "指定标题文本的最小尺寸,小于此尺寸的文本将被忽略");
AppContext.MainForm.SetTooltip(_AutoHierarchicleArrangementBox, "根据标题文本的尺寸级别生成多层次的书签");
AppContext.MainForm.SetTooltip(_AutoHierarchicalArrangementBox, "根据标题文本的尺寸级别生成多层次的书签");
AppContext.MainForm.SetTooltip(_YOffsetBox, "将标题的定位位置向上偏移的行距");
AppContext.MainForm.SetTooltip(_MergeAdjacentTitlesBox, "将连续出现的标题合并为一个标题");
AppContext.MainForm.SetTooltip(_MergeDifferentSizeTitlesBox, "合并不同尺寸的相邻标题");
......@@ -106,7 +106,7 @@ namespace PDFPatcher.Functions
_CreateBookmarkForFirstPageBox.Checked = _options.CreateBookmarkForFirstPage;
_MergeAdjacentTitlesBox.Checked = _options.MergeAdjacentTitles;
_MergeDifferentSizeTitlesBox.Checked = _options.MergeDifferentSizeTitles;
_AutoHierarchicleArrangementBox.Checked = _options.AutoHierarchicalArrangement;
_AutoHierarchicalArrangementBox.Checked = _options.AutoHierarchicalArrangement;
_IgnoreNumericTitleBox.Checked = _options.IgnoreNumericTitle;
_IgnoreOverlappedTextBox.Checked = _options.IgnoreOverlappedText;
_IgnoreSingleCharacterTitleBox.Checked = _options.IgnoreSingleCharacterTitle;
......@@ -174,7 +174,7 @@ namespace PDFPatcher.Functions
_options.YOffset = (float)_YOffsetBox.Value;
_options.ExportTextCoordinates = _ExportTextCoordinateBox.Checked;
_options.PageTopForLevel = (int)_GoToPageTopLevelBox.Value;
_options.AutoHierarchicalArrangement = _AutoHierarchicleArrangementBox.Checked;
_options.AutoHierarchicalArrangement = _AutoHierarchicalArrangementBox.Checked;
_options.DisplayFontStatistics = _DisplayFontStatisticsBox.Checked;
_options.DisplayAllFonts = _ShowAllFontsBox.Checked;
_options.WritingDirection = (WritingDirection)_WritingDirectionBox.SelectedIndex;
......
......@@ -24,14 +24,14 @@ namespace PDFPatcher.Processor
FirstInstance = instance.Length > 50 ? instance.Substring(0, 50) : instance;
}
}
sealed class FontOccurance
sealed class FontOccurrence
{
readonly Dictionary<string, List<SizeOccurrence>> oc = new Dictionary<string, List<SizeOccurrence>>();
internal List<SizeOccurrence> GetOccurance(string fontName) {
internal List<SizeOccurrence> GetOccurrence(string fontName) {
return oc.TryGetValue(fontName, out List<SizeOccurrence> s) ? s : null;
}
internal void AddOccurance(string fontName, float size, int page, string instance) {
internal void AddOccurrence(string fontName, float size, int page, string instance) {
if (oc.ContainsKey(fontName) == false) {
oc.Add(fontName, new List<SizeOccurrence>() { new SizeOccurrence(size, page, instance) });
}
......@@ -86,7 +86,7 @@ namespace PDFPatcher.Processor
int level = 0;
const string indentString = "          ";
List<MatchPattern.IMatcher> ig;
var fontOccurances = new FontOccurance();
var fontOccurrences = new FontOccurrence();
if (options.IgnorePatterns.Count == 0) {
ig = null;
}
......@@ -232,9 +232,8 @@ namespace PDFPatcher.Processor
be.SetAttribute(Constants.Font.Size, s.ToText());
if (f != null) {
be.SetAttribute(Constants.Font.ThisName, f.FontID.ToText());
//fontOccurances.AddOccurance (f.FontID, s, i, t);
}
CountFontOccuranceInRegion(fontOccurances, i, item);
CountFontOccurrenceInRegion(fontOccurrences, i, item);
#if DEBUG
Tracker.TraceMessage(String.Concat(item.Direction.ToString()[0], ':', level < 11 ? indentString.Substring(0, level) : indentString, t, " .... ", i.ToText()));
#else
......@@ -251,7 +250,7 @@ namespace PDFPatcher.Processor
writer = oldWriter;
}
WriteDocumentFontOccurances(writer, options, p, fontOccurances);
WriteDocumentFontOccurrences(writer, options, p, fontOccurrences);
SetGoToTop(options, doc);
writer.WriteStartElement(Constants.DocumentBookmark);
if (options.CreateBookmarkForFirstPage && String.IsNullOrEmpty(options.FirstPageTitle) == false) {
......@@ -274,13 +273,13 @@ namespace PDFPatcher.Processor
}
}
static void WriteDocumentFontOccurances(XmlWriter writer, AutoBookmarkOptions options, TextToBookmarkProcessor p, FontOccurance fontOccurances) {
static void WriteDocumentFontOccurrences(XmlWriter writer, AutoBookmarkOptions options, TextToBookmarkProcessor p, FontOccurrence fontOccurrences) {
writer.WriteStartElement(Constants.Font.DocumentFont);
Tracker.TraceMessage("\n文档所用的字体");
var dl = new List<String>();
foreach (var item in p.FontList) {
var fo = "0";
var sl = fontOccurances.GetOccurance(item.Value);
var sl = fontOccurrences.GetOccurrence(item.Value);
if (sl != null) {
if (dl.Contains(item.Value) == false) {
int o = 0;
......@@ -300,14 +299,14 @@ namespace PDFPatcher.Processor
writer.WriteStartElement(Constants.Font.ThisName);
writer.WriteAttributeString(Constants.Font.ID, item.Key.ToText());
writer.WriteAttributeString(Constants.Font.Name, item.Value);
writer.WriteAttributeString(Constants.FontOccurance.Count, fo);
writer.WriteAttributeString(Constants.FontOccurrence.Count, fo);
if (sl != null) {
foreach (var s in sl) {
writer.WriteStartElement(Constants.Font.Size);
writer.WriteAttributeString(Constants.Font.Size, s.Size.ToText());
writer.WriteAttributeString(Constants.FontOccurance.Count, s.Occurrence.ToText());
writer.WriteAttributeString(Constants.FontOccurance.FirstText, s.FirstInstance);
writer.WriteAttributeString(Constants.FontOccurance.FirstPage, s.FirstPage.ToText());
writer.WriteAttributeString(Constants.FontOccurrence.Count, s.Occurrence.ToText());
writer.WriteAttributeString(Constants.FontOccurrence.FirstText, s.FirstInstance);
writer.WriteAttributeString(Constants.FontOccurrence.FirstPage, s.FirstPage.ToText());
if (options.DisplayFontStatistics && (s.Occurrence > 0 || options.DisplayAllFonts)) {
Tracker.TraceMessage(String.Concat("\t尺寸:", s.Size.ToText(), "\t出现次数:", s.Occurrence.ToText(), "\t首次出现于第", s.FirstPage.ToText(), "页(", s.FirstInstance, ")"));
}
......@@ -319,12 +318,12 @@ namespace PDFPatcher.Processor
writer.WriteEndElement();
}
static void CountFontOccuranceInRegion(FontOccurance fontOccurances, int i, TextRegion item) {
static void CountFontOccurrenceInRegion(FontOccurrence fontOccurrences, int i, TextRegion item) {
FontInfo f = null;
foreach (var il in item.Lines) {
foreach (var ii in il.Texts) {
if (ii.Font != null && (f == null || ii.Font.FontID != f.FontID)) {
fontOccurances.AddOccurance(ii.Font.FontName, ii.Size, i, il.Text);
fontOccurrences.AddOccurrence(ii.Font.FontName, ii.Size, i, il.Text);
f = ii.Font;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册