C# - Read & Preview Font

后端 未结 2 1377
春和景丽
春和景丽 2021-01-03 04:45

Can I read and preview fonts (mainly ttf and otf) in C#? What other languages can/should I use?

Read:

  • Info like font family, font name

2条回答
  •  情歌与酒
    2021-01-03 05:30

    To preview a font you can render it out to a form like this:

    public partial class MyForm: Form
    {
       .
       .
       .
       public void ShowMyFont()
       {
          Graphics graphics = this.CreateGraphics();
          graphics.DrawString("Hello world!", new Font("Arial", 12), Brushes.Black, 0, 0);
       }
    }
    

提交回复
热议问题