|
@@ -7,6 +7,7 @@ using Prism.Mvvm;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
+using System.Diagnostics;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
@@ -45,13 +46,13 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
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>();
|
|
|
|
|
|
-
|
|
|
#endregion 变量
|
|
|
|
|
|
#region 初始化下拉框或列表默认的数据
|
|
@@ -63,6 +64,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
InitBase_FontStyles();
|
|
|
InitBase_FontSize();
|
|
|
}
|
|
|
+
|
|
|
//预设字体大小
|
|
|
private void InitBase_FontSize()
|
|
|
{
|
|
@@ -84,7 +86,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
|
|
|
//字体
|
|
|
public void InitBase_FontFamilys()
|
|
|
- {
|
|
|
+ {
|
|
|
FontFamilyItems = TextFont.GetFamilyEdit();
|
|
|
}
|
|
|
|
|
@@ -111,7 +113,6 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
/// 预设样式
|
|
|
/// </summary>
|
|
|
|
|
|
-
|
|
|
private int presetFontSelectedIndex;
|
|
|
|
|
|
public int PresetFontSelectedIndex
|
|
@@ -122,7 +123,8 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
SetProperty(ref presetFontSelectedIndex, value);
|
|
|
}
|
|
|
}
|
|
|
- private ComboDataItem _currentPresetFont=new ComboDataItem("Custom", "Custom");
|
|
|
+
|
|
|
+ private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
|
|
|
|
|
|
public ComboDataItem CurrentPresetFont
|
|
|
{
|
|
@@ -187,28 +189,27 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
SetProperty(ref _currentFontFamily, value);
|
|
|
if (isChange)
|
|
|
{
|
|
|
- string str= _currentFontFamily.Content;
|
|
|
- if (_currentFontFamily.Content== "Times New Roman")
|
|
|
+ string str = _currentFontFamily.Content;
|
|
|
+ if (_currentFontFamily.Content == "Times New Roman")
|
|
|
{
|
|
|
str = "Times-Roman";
|
|
|
}
|
|
|
ChangedValue?.Invoke(str, FontSetModeType.FontFamilys);
|
|
|
-
|
|
|
}
|
|
|
SetProperty(ref _currentFontFamily, value);
|
|
|
if (value.Content != null)
|
|
|
{
|
|
|
- FontFamilySelectedIndex=FontFamilyItems.IndexOf(value);
|
|
|
+ int index = FontFamilyItems.FindIndex(item => item.Content == value.Content);
|
|
|
+ FontFamilySelectedIndex = index;
|
|
|
+ Trace.WriteLine(index);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
FontFamilySelectedIndex = 0;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private int fontFamilySelectedIndex = -1;
|
|
|
|
|
|
public int FontFamilySelectedIndex
|
|
@@ -217,9 +218,9 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
set
|
|
|
{
|
|
|
SetProperty(ref fontFamilySelectedIndex, value);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
#endregion 字体样式
|
|
|
|
|
|
#region 字体大小
|
|
@@ -234,6 +235,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
SetProperty(ref fontSizeSelectedIndex, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//下拉框列表:字体大小
|
|
|
private ComboDataItem _currentFontSize = new ComboDataItem(6);
|
|
|
|
|
@@ -319,11 +321,8 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
//FontSizeSelectedIndex = 0;
|
|
|
//FontSizeSelectedIndex = -1;
|
|
|
break;
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#endregion 字体大小
|
|
@@ -356,12 +355,13 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
SetProperty(ref fontStyleSelectedIndex, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
|
|
|
+
|
|
|
public ComboDataItem CurrrentFontWeightStyle
|
|
|
{
|
|
|
get { return _currrentFontWeightStyle; }
|
|
|
|
|
|
-
|
|
|
set
|
|
|
{
|
|
|
bool isChange = IsEqualStrComboData(_currrentFontWeightStyle, value);
|
|
@@ -389,11 +389,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
FontStyleSelectedIndex = 3;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
protected void UpdateFontWeight_Style()
|
|
@@ -539,6 +535,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
uiStr = "Times New Roman";
|
|
|
}
|
|
|
//WPF的UI字体不包含Helvetica
|
|
|
+
|
|
|
if (fontFamily == "Helvetica")
|
|
|
{
|
|
|
fontFamily = "Arial";
|
|
@@ -550,8 +547,6 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
#endregion 列表选中赋值
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//设置字体大小、字体内容排版、字体颜色、字体样式、字重
|
|
|
public class FontBoardVm : BindableBase
|
|
|
{
|
|
@@ -699,6 +694,7 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
case "Times New Roman":
|
|
|
FontFamilySelectedIndex = 2;
|
|
|
break;
|
|
|
+
|
|
|
case "Adobe Devanagari":
|
|
|
FontFamilySelectedIndex = 3;
|
|
|
break;
|
|
@@ -1013,9 +1009,9 @@ namespace PDF_Master.Model.AnnotPanel
|
|
|
//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 == "Arial")
|
|
|
- )
|
|
|
+ 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")
|
|
|
{
|