Jelajahi Sumber

ComPDFKit.Tool(Win) - 修改弹出输入框时部分字体出现输入方块乱码问题

liyuxuan 2 bulan lalu
induk
melakukan
4bd055d5da

+ 4 - 5
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.Annot.cs

@@ -695,11 +695,10 @@ namespace ComPDFKit.Tool
                         dashBorder?.DrawDashBorder(true, drawWidth, rawWidth, dashCollection);
                     }
 
-                    string fontName = string.Empty;
-                    string fontFamily = string.Empty;
-                    CPDFFont.GetFamilyStyleName(textWidget.FreeTextDa.FontName, ref fontFamily, ref fontName);
-                    textui.FontFamily = new FontFamily(fontFamily);
-
+                    //string fontName = string.Empty;
+                    //string fontFamily = string.Empty;
+                    //CPDFFont.GetFamilyStyleName(textWidget.FreeTextDa.FontName, ref fontFamily, ref fontName);
+                    textui.FontFamily = new FontFamily(textWidget.FreeTextDa.FontName + ",Microsoft YaHei");
                     textui.AcceptsReturn = true;
                     textui.TextWrapping = TextWrapping.Wrap;
                     textui.TextAlignment = TextAlignment.Left;

+ 8 - 8
Demo/Examples/ComPDFKit.Tool/DrawTool/CreateAnnotTool.cs

@@ -1522,10 +1522,10 @@ namespace ComPDFKit.Tool.DrawTool
                     textui.BorderThickness = new Thickness(0);
                     textui.Text = annotFreeText.Content;
 
-                    string fontName = string.Empty;
-                    string fontFamily = string.Empty;
-                    CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
-                    textui.FontFamily = new FontFamily(fontFamily);
+                    //string fontName = string.Empty;
+                    //string fontFamily = string.Empty;
+                    //CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
+                    textui.FontFamily = new FontFamily(annotFreeText.FreeTextDa.FontName + ",Microsoft YaHei");
 
                     textui.AcceptsReturn = true;
                     textui.TextWrapping = TextWrapping.Wrap;
@@ -1762,10 +1762,10 @@ namespace ComPDFKit.Tool.DrawTool
                         dashBorder.DrawDashBorder(true, drawWidth,rawWidth, dashCollection);
                     }
 
-                    string fontName = string.Empty;
-                    string fontFamily = string.Empty;
-                    CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
-                    lastTextui.FontFamily = new FontFamily(fontFamily);
+                    //string fontName = string.Empty;
+                    //string fontFamily = string.Empty;
+                    //CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
+                    lastTextui.FontFamily = new FontFamily(annotFreeText.FreeTextDa.FontName + ",Microsoft YaHei");
 
                     lastTextui.FontWeight = IsBold(textAttribute.FontName) ? FontWeights.Bold : FontWeights.Normal;
                     lastTextui.FontStyle = IsItalic(textAttribute.FontName) ? FontStyles.Italic : FontStyles.Normal;