فهرست منبع

ComPDFKit.Tool(Win) - 表单List,ComboBox,Text,PushButton和FreeText字体名称设置改为新版本

liyuxuan 6 ماه پیش
والد
کامیت
4cbdc45bfc

+ 5 - 25
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.DataMethod.cs

@@ -1018,11 +1018,7 @@ namespace ComPDFKit.Tool
             CTextAttribute textAttr = new CTextAttribute();
             textAttr.FontColor = pushButtonParam.FontColor;
             textAttr.FontSize = (float)pushButtonParam.FontSize;
-            FontType checkFontType = CFontNameHelper.GetFontType(pushButtonParam.FontName);
-            textAttr.FontName = CFontNameHelper.ObtainFontName(
-                checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
-                pushButtonParam.IsBold,
-                 pushButtonParam.IsItalic);
+            textAttr.FontName = pushButtonParam.FontName;
             widget.SetTextAttribute(textAttr);
 
             if (!string.IsNullOrEmpty(pushButtonParam.FieldName))
@@ -1175,11 +1171,7 @@ namespace ComPDFKit.Tool
             CTextAttribute textAttr = new CTextAttribute();
             textAttr.FontColor = textBoxParam.FontColor;
             textAttr.FontSize = (float)textBoxParam.FontSize;
-            FontType checkFontType = CFontNameHelper.GetFontType(textBoxParam.FontName);
-            textAttr.FontName = CFontNameHelper.ObtainFontName(
-                checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
-                textBoxParam.IsBold,
-                 textBoxParam.IsItalic);
+            textAttr.FontName = textBoxParam.FontName;
             widget.SetTextAttribute(textAttr);
 
             if (!string.IsNullOrEmpty(textBoxParam.FieldName))
@@ -1224,11 +1216,7 @@ namespace ComPDFKit.Tool
             CTextAttribute textAttr = new CTextAttribute();
             textAttr.FontColor = comboBoxParam.FontColor;
             textAttr.FontSize = (float)comboBoxParam.FontSize;
-            FontType checkFontType = CFontNameHelper.GetFontType(comboBoxParam.FontName);
-            textAttr.FontName = CFontNameHelper.ObtainFontName(
-                checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
-                comboBoxParam.IsBold,
-                 comboBoxParam.IsItalic);
+            textAttr.FontName = comboBoxParam.FontName;
             widget.SetTextAttribute(textAttr);
 
             if (!string.IsNullOrEmpty(comboBoxParam.FieldName))
@@ -1279,11 +1267,7 @@ namespace ComPDFKit.Tool
             CTextAttribute textAttr = new CTextAttribute();
             textAttr.FontColor = listBoxParam.FontColor;
             textAttr.FontSize = (float)listBoxParam.FontSize;
-            FontType checkFontType = CFontNameHelper.GetFontType(listBoxParam.FontName);
-            textAttr.FontName = CFontNameHelper.ObtainFontName(
-                checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
-                listBoxParam.IsBold,
-                 listBoxParam.IsItalic);
+            textAttr.FontName = listBoxParam.FontName;
             widget.SetTextAttribute(textAttr);
 
             if (!string.IsNullOrEmpty(listBoxParam.FieldName))
@@ -1335,11 +1319,7 @@ namespace ComPDFKit.Tool
             textAttr.FontSize = (float)signatureParam.FontSize;
             bool isBold = IsBold(textAttr.FontName);
             bool isItalic = IsItalic(textAttr.FontName);
-            FontType checkFontType = CFontNameHelper.GetFontType(signatureParam.FontName);
-            textAttr.FontName = CFontNameHelper.ObtainFontName(
-                checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
-                isBold,
-                 isItalic);
+            textAttr.FontName = signatureParam.FontName;
             widget.SetTextAttribute(textAttr);
 
             if (!string.IsNullOrEmpty(signatureParam.FieldName))

+ 2 - 26
Demo/Examples/ComPDFKit.Tool/UndoManger/AnnotHistory/FreeTextAnnotHistory.cs

@@ -81,10 +81,7 @@ namespace ComPDFKit.Tool.UndoManger
                 }
                 textAttr.FontColor = fontColor;
                 textAttr.FontSize = (float)currentParam.FontSize;
-                textAttr.FontName = ObtainFontName(
-					GetFontType(currentParam.FontName),
-                    currentParam.IsBold,
-                    currentParam.IsItalic);
+                textAttr.FontName = currentParam.FontName;
 
                 textAnnot.SetFreetextDa(textAttr);
 
@@ -183,10 +180,7 @@ namespace ComPDFKit.Tool.UndoManger
                 if(updateParam.FontName != checkParam.FontName)
                 {
                     CTextAttribute textAttr = textAnnot.FreeTextDa;
-                    bool isBold = IsBold(textAttr.FontName);
-                    bool isItalic = IsItalic(textAttr.FontName);
-                    FontType fontType = GetFontType(updateParam.FontName);
-                    textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
+                    textAttr.FontName = updateParam.FontName;
                     textAnnot.SetFreetextDa(textAttr);
                 }
 
@@ -206,24 +200,6 @@ namespace ComPDFKit.Tool.UndoManger
                         textAnnot.SetFreetextDa(textAttr);
                     }
                 }
-               
-                if(updateParam.IsBold != checkParam.IsBold)
-                {
-                    CTextAttribute textAttr = textAnnot.FreeTextDa;
-                    bool isItalic = IsItalic(textAttr.FontName);
-                    FontType fontType = GetFontType(textAttr.FontName);
-                    textAttr.FontName = ObtainFontName(fontType, updateParam.IsBold, isItalic);
-                    textAnnot.SetFreetextDa(textAttr);
-                }
-
-                if(updateParam.IsItalic != checkParam.IsItalic)
-                {
-                    CTextAttribute textAttr = textAnnot.FreeTextDa;
-                    bool isBold = IsBold(textAttr.FontName);
-                    FontType fontType = GetFontType(textAttr.FontName);
-                    textAttr.FontName = ObtainFontName(fontType, isBold, updateParam.IsItalic);
-                    textAnnot.SetFreetextDa(textAttr);
-                }
 
                 if (!updateParam.ClientRect.Equals(checkParam.ClientRect))
                 {

+ 4 - 28
Demo/Examples/ComPDFKit.Tool/UndoManger/FormHistory/ComboBoxHistory.cs

@@ -84,12 +84,9 @@ namespace ComPDFKit.Tool.UndoManger
                 }
                 textAttr.FontColor = fontColor;
 				textAttr.FontSize = (float)currentParam.FontSize;
-				textAttr.FontName = ObtainFontName(
-					GetFontType(currentParam.FontName),
-					currentParam.IsBold,
-					currentParam.IsItalic);
+				textAttr.FontName = currentParam.FontName;
 
-				comboboxWidget.SetTextAttribute(textAttr);
+                comboboxWidget.SetTextAttribute(textAttr);
 
 				if(currentParam.OptionItems!=null && currentParam.OptionItems.Count > 0)
 				{
@@ -198,11 +195,8 @@ namespace ComPDFKit.Tool.UndoManger
 				if (updateParam.FontName != checkParam.FontName)
 				{
 					CTextAttribute textAttr = comboboxWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(updateParam.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
-					comboboxWidget.SetTextAttribute(textAttr);
+					textAttr.FontName = updateParam.FontName;
+                    comboboxWidget.SetTextAttribute(textAttr);
 				}
 
 				if (updateParam.FontSize != checkParam.FontSize)
@@ -222,24 +216,6 @@ namespace ComPDFKit.Tool.UndoManger
                     }
 				}
 
-				if (updateParam.IsBold != checkParam.IsBold)
-				{
-					CTextAttribute textAttr = comboboxWidget.GetTextAttribute();
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, updateParam.IsBold, isItalic);
-					comboboxWidget.SetTextAttribute(textAttr);
-				}
-
-				if (updateParam.IsItalic != checkParam.IsItalic)
-				{
-					CTextAttribute textAttr = comboboxWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, updateParam.IsItalic);
-					comboboxWidget.SetTextAttribute(textAttr);
-				}
-
 				if (updateParam.OptionItems != null)
 				{
 					int optionsCount = comboboxWidget.GetItemsCount();

+ 4 - 29
Demo/Examples/ComPDFKit.Tool/UndoManger/FormHistory/ListBoxHistory.cs

@@ -84,12 +84,9 @@ namespace ComPDFKit.Tool.UndoManger
                 }
                 textAttr.FontColor = fontColor;
 				textAttr.FontSize = (float)currentParam.FontSize;
-				textAttr.FontName = ObtainFontName(
-					GetFontType(currentParam.FontName),
-					currentParam.IsBold,
-					currentParam.IsItalic);
+				textAttr.FontName = currentParam.FontName;
 
-				listboxWidget.SetTextAttribute(textAttr);
+                listboxWidget.SetTextAttribute(textAttr);
 
 				if (currentParam.OptionItems != null && currentParam.OptionItems.Count > 0)
 				{
@@ -198,11 +195,8 @@ namespace ComPDFKit.Tool.UndoManger
 				if (updateParam.FontName != checkParam.FontName)
 				{
 					CTextAttribute textAttr = listboxWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(updateParam.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
-					listboxWidget.SetTextAttribute(textAttr);
+					textAttr.FontName = updateParam.FontName;
+                    listboxWidget.SetTextAttribute(textAttr);
 				}
 
 				if (updateParam.FontSize != checkParam.FontSize)
@@ -222,25 +216,6 @@ namespace ComPDFKit.Tool.UndoManger
                     }
                 }
 
-
-                if (updateParam.IsBold != checkParam.IsBold)
-				{
-					CTextAttribute textAttr = listboxWidget.GetTextAttribute();
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, updateParam.IsBold, isItalic);
-					listboxWidget.SetTextAttribute(textAttr);
-				}
-
-				if (updateParam.IsItalic != checkParam.IsItalic)
-				{
-					CTextAttribute textAttr = listboxWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, updateParam.IsItalic);
-					listboxWidget.SetTextAttribute(textAttr);
-				}
-
 				if (updateParam.OptionItems != null)
 				{
 					int optionsCount = listboxWidget.GetItemsCount();

+ 4 - 28
Demo/Examples/ComPDFKit.Tool/UndoManger/FormHistory/PushButtonHistory.cs

@@ -92,12 +92,9 @@ namespace ComPDFKit.Tool.UndoManger
                 }
 				textAttr.FontColor = fontColor;
 				textAttr.FontSize = (float)currentParam.FontSize;
-				textAttr.FontName = ObtainFontName(
-					GetFontType(currentParam.FontName),
-					currentParam.IsBold,
-					currentParam.IsItalic);
+				textAttr.FontName = currentParam.FontName;
 
-				pushbuttonWidget.SetTextAttribute(textAttr);
+                pushbuttonWidget.SetTextAttribute(textAttr);
 
 				switch (currentParam.Action)
 				{
@@ -215,11 +212,8 @@ namespace ComPDFKit.Tool.UndoManger
 				if (updateParam.FontName != checkParam.FontName)
 				{
 					CTextAttribute textAttr = pushbutton.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(updateParam.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
-					pushbutton.SetTextAttribute(textAttr);
+					textAttr.FontName = updateParam.FontName;
+                    pushbutton.SetTextAttribute(textAttr);
 				}
 
 				if (updateParam.FontSize != checkParam.FontSize)
@@ -239,24 +233,6 @@ namespace ComPDFKit.Tool.UndoManger
                     }
                 }
 
-                if (updateParam.IsBold != checkParam.IsBold)
-				{
-					CTextAttribute textAttr = pushbutton.GetTextAttribute();
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, updateParam.IsBold, isItalic);
-					pushbutton.SetTextAttribute(textAttr);
-				}
-
-				if (updateParam.IsItalic != checkParam.IsItalic)
-				{
-					CTextAttribute textAttr = pushbutton.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, updateParam.IsItalic);
-					pushbutton.SetTextAttribute(textAttr);
-				}
-
 				switch (updateParam.Action)
 				{
 					case C_ACTION_TYPE.ACTION_TYPE_GOTO:

+ 4 - 28
Demo/Examples/ComPDFKit.Tool/UndoManger/FormHistory/TextBoxHistory.cs

@@ -86,12 +86,9 @@ namespace ComPDFKit.Tool.UndoManger
                 }
 				textAttr.FontColor = fontColor;
 				textAttr.FontSize = (float)currentParam.FontSize;
-				textAttr.FontName = ObtainFontName(
-					GetFontType(currentParam.FontName),
-					currentParam.IsBold,
-					currentParam.IsItalic);
+				textAttr.FontName = currentParam.FontName;
 
-				textWidget.SetTextAttribute(textAttr);
+                textWidget.SetTextAttribute(textAttr);
                 textWidget.SetJustification(currentParam.Alignment);
 
 				textWidget.SetBorderWidth((float)currentParam.LineWidth);
@@ -185,11 +182,8 @@ namespace ComPDFKit.Tool.UndoManger
 				if (updateParam.FontName != checkParam.FontName)
 				{
 					CTextAttribute textAttr = textWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(updateParam.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
-					textWidget.SetTextAttribute(textAttr);
+					textAttr.FontName = updateParam.FontName;
+                    textWidget.SetTextAttribute(textAttr);
 				}
 
 				if (updateParam.FontSize != checkParam.FontSize)
@@ -209,24 +203,6 @@ namespace ComPDFKit.Tool.UndoManger
                     }
 				}
 
-				if (updateParam.IsBold != checkParam.IsBold)
-				{
-					CTextAttribute textAttr = textWidget.GetTextAttribute();
-					bool isItalic = IsItalic(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, updateParam.IsBold, isItalic);
-					textWidget.SetTextAttribute(textAttr);
-				}
-
-				if (updateParam.IsItalic != checkParam.IsItalic)
-				{
-					CTextAttribute textAttr = textWidget.GetTextAttribute();
-					bool isBold = IsBold(textAttr.FontName);
-					FontType fontType = GetFontType(textAttr.FontName);
-					textAttr.FontName = ObtainFontName(fontType, isBold, updateParam.IsItalic);
-					textWidget.SetTextAttribute(textAttr);
-				}
-
 				if (updateParam.Alignment != checkParam.Alignment)
 				{
                     textWidget.SetJustification(updateParam.Alignment);