12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034 |
- 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.ComponentModel;
- 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;
- 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>();
- #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);
- }
- }
- //字体
- public void InitBase_FontFamilys()
- {
- FontFamilyItems = TextFont.GetFamilyEdit();
- }
- //字重
- 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("Arial", "Arial");
- public ComboDataItem CurrentFontFamily
- {
- get { return _currentFontFamily; }
- set
- {
- bool isChange = IsEqualStrComboData(_currentFontFamily, value);
- SetProperty(ref _currentFontFamily, value);
- if (isChange)
- {
- 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);
- }
- 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)
- {
- //SDK捕获到的字体会是Times-Roman
- if (fontFamily == "Times-Roman")
- {
- uiStr = "Times New Roman";
- }
- //WPF的UI字体不包含Helvetica
- if (fontFamily == "Helvetica")
- {
- fontFamily = "Arial";
- uiStr = "Arial";
- }
- 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("Arial", "Arial");
- public ComboDataItem CurrentFontFamily
- {
- get { return _currentFontFamily; }
- set
- {
- SetProperty(ref _currentFontFamily, value);
- switch (value.Content.ToString())
- {
- case "Courier New":
- FontFamilySelectedIndex = 0;
- break;
- case "Arial":
- FontFamilySelectedIndex = 1;
- break;
- case "Times New Roman":
- FontFamilySelectedIndex = 2;
- break;
- case "Adobe Devanagari":
- FontFamilySelectedIndex = 3;
- 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 == "Helvetica")
- {
- fontFamily = "Arial";
- uiStr = "Arial";
- }
- if (fontFamily == "Times-Roman")
- {
- uiStr = "Times New Roman";
- }
- if (fontFamily == "CourierNew")
- {
- uiStr = "Courier New";
- }
- if (fontFamily == "AdobeDevanagari")
- {
- uiStr = "Adobe Devanagari";
- }
- 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 == "Arial")
- )
- {
- if (item.mTag != "Custom")
- {
- CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
- isExist = true;
- }
- break;
- }
- }
- return isExist;
- }
- #endregion 列表选中赋值
- }
- }
|