123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032 |
- using ComPDFKit.PDFAnnotation;
- 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
- {
- //属性触发事件的标识
- public enum FontSetModeType
- {
- PresetFontStyes,
- FontFamilys,
- FontSizes,
- FontWeight_Style,
- FontColor,
- TextAlignment
- }
- //设置字体大小、字体内容排版、字体颜色、字体样式、字重
- public class FontBoard : BindableBase
- {
- #region 变量
- protected event EventHandler<FontSetModeType> ChangedValue;
- protected bool IsCanSave = false;
- 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>();
- #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 属性
- //文字内容对齐
- private string _strtextAlign;
- public string StrTextAlign
- {
- get { return _strtextAlign; }
- set { SetProperty(ref _strtextAlign, value); }
- }
- /// <summary>
- /// 预设样式
- /// </summary>
- private int presetFontSelectedIndex;
- public int PresetFontSelectedIndex
- {
- get { return presetFontSelectedIndex; }
- set
- {
- SetProperty(ref presetFontSelectedIndex, value);
- }
- }
- private ComboDataItem _currentPresetFont=new ComboDataItem("Custom", "Custom");
- public ComboDataItem CurrentPresetFont
- {
- get { return _currentPresetFont; }
- set
- {
- bool isChange = IsEqualStrComboData(_currentPresetFont, value);
- SetProperty(ref _currentPresetFont, value);
- if (isChange)
- {
- ChangedValue?.Invoke(_currentPresetFont.ValueStr, FontSetModeType.PresetFontStyes);
- }
- 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;
- }
- }
- }
- #region 字体样式
- //下拉框列表
- private ComboDataItem _currentFontFamily = new ComboDataItem("Helvetica", "Helvetica");
- public ComboDataItem CurrentFontFamily
- {
- get { return _currentFontFamily; }
- set
- {
- bool isChange = IsEqualStrComboData(_currentFontFamily, value);
- SetProperty(ref _currentFontFamily, value);
- if (isChange)
- {
- string str= _currentFontFamily.ValueStr;
- if (_currentFontFamily.ValueStr== "Times")
- {
- str = "Times-Roman";
- }
- else if(_currentFontFamily.ValueStr== "Courier")
- {
- str = "Courier New";
- }
-
- ChangedValue?.Invoke(str, FontSetModeType.FontFamilys);
- }
- SetProperty(ref _currentFontFamily, value);
- if (value.Content != null)
- {
- switch (value.Content.ToString())
- {
- case "Courier New":
- FontFamilySelectedIndex = 0;
- break;
- case "Helvetica":
- case "Arial":
- FontFamilySelectedIndex = 1;
- break;
- case "Times New Roman":
- FontFamilySelectedIndex = 2;
- break;
- default:
- FontFamilySelectedIndex = -1;
- break;
- }
- }
- else
- {
- FontFamilySelectedIndex = 0;
- }
-
- }
- }
- private int fontFamilySelectedIndex = -1;
- 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
- {
- bool isChange = IsEqualComboData(_currentFontSize, value);
- SetProperty(ref _currentFontSize, value);
- if (isChange && value.Value > 0)
- {
- ChangedValue?.Invoke(_currentFontSize.Value, FontSetModeType.FontSizes);
- }
- 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 _fontStyle;
- public FontStyle FontStyleItem
- {
- get { return _fontStyle; }
- set { SetProperty(ref _fontStyle, value); }
- }
- private FontWeight _fontWeight;
- public FontWeight FontWeightItem
- {
- get { return _fontWeight; }
- set { SetProperty(ref _fontWeight, value); }
- }
- private int fontStyleSelectedIndex = 0;
- 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
- {
- bool isChange = IsEqualStrComboData(_currrentFontWeightStyle, value);
- SetProperty(ref _currrentFontWeightStyle, value);
- if (isChange)
- {
- ChangedValue?.Invoke(_currrentFontWeightStyle, FontSetModeType.FontWeight_Style);
- }
- 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;
- }
- }
- }
- protected 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 C_TEXT_ALIGNMENT _textAlignment;
- public C_TEXT_ALIGNMENT TextAlignmentItem
- {
- get { return _textAlignment; }
- set { SetProperty(ref _textAlignment, value); }
- }
- //颜色
- private Brush selectColor = new SolidColorBrush(Colors.Black);
- public Brush SelectColor
- {
- get { return selectColor; }
- set
- {
- SetProperty(ref selectColor, value);
- if (IsCanSave)
- {
- ChangedValue?.Invoke((selectColor as SolidColorBrush).Color, FontSetModeType.FontColor);
- }
- else
- {
- CurrentFontColor = selectColor;
- }
- }
- }
- private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
- public Brush CurrentFontColor
- {
- get { return _currentFontColor; }
- set
- {
- SetProperty(ref _currentFontColor, value);
- }
- }
- private bool IsEqualComboData(ComboDataItem oldValue, ComboDataItem newValue)
- {
- if (newValue == null || IsCanSave == false)
- return false;
- if (oldValue != null && newValue != null)
- {
- if (oldValue.Value != newValue.Value)
- return true;
- }
- return false;
- }
- private bool IsEqualStrComboData(ComboDataItem oldValue, ComboDataItem newValue)
- {
- if (newValue == null || string.IsNullOrEmpty(newValue.ValueStr) == true || IsCanSave == false)
- return false;
- if (oldValue != null && newValue != null)
- {
- if (oldValue.ValueStr != newValue.ValueStr)
- return true;
- }
- return false;
- }
- #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();
- }
- protected void GetCurrentFontSize(int size)
- {
- CurrentFontSize = new ComboDataItem(size);
- }
- protected void GetCurrentFontFamily(string fontFamily, string uiStr)
- {
- if (fontFamily == "Arial")
- {
- fontFamily = "Helvetica";
- uiStr = "Helvetica";
- }
- if(fontFamily == "Times-Roman"|| fontFamily == "Times")
- {
- uiStr = "Times New Roman";
- }
- if(fontFamily == "Courier")
- {
- uiStr = "Courier New";
- }
- CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
- }
- #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("Helvetica", "Helvetica");
- public ComboDataItem CurrentFontFamily
- {
- get { return _currentFontFamily; }
- set
- {
- SetProperty(ref _currentFontFamily, value);
- switch (value.Content.ToString())
- {
- case "Courier New":
- FontFamilySelectedIndex = 0;
- break;
- case "Helvetica":
- case "Arial":
- FontFamilySelectedIndex = 1;
- break;
- case "Times New Roman":
- FontFamilySelectedIndex = 2;
- 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 == "Arial")
- {
- fontFamily = "Helvetica";
- uiStr = "Helvetica";
- }
- 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 列表选中赋值
- }
- }
|