/// <summary>
        /// 创建文本路径
        /// </summary>
        /// <param name="word">文本字符串</param>
        /// <param name="point">显示位置</param>
        /// <param name="typeface">字体信息</param>
        /// <param name="fontSize">字体大小</param>
        /// <returns></returns>
        public static Geometry CreateTextPath(string word, Point point, Typeface typeface, int fontSize)
        {
            FormattedText text = new FormattedText(word,
            new System.Globalization.CultureInfo("zh-cn"),
            FlowDirection.LeftToRight, typeface, fontSize,
            Brushes.Black);
            Geometry geo = text.BuildGeometry(point);
            PathGeometry path = geo.GetFlattenedPathGeometry();
            return path;
        }

使用:

 var pathgeometry = CreateTextPath("梦琪D路飞", new Point(0, 0), new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal), (int)fontsize);

 

相关文章:

  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-12-20
  • 2021-09-21
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-03
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2021-09-18
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案