在C#中嵌入字体 [英] Embedded fonts in c#

查看:190
本文介绍了在C#中嵌入字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了很多在C#中的一个WPF应用程序嵌入字体。字体的名称是'的Roboto。如果这是使用的文件名roboto.ttf。我确信
它的编译程序集。 ?因此,如何在例如一个TextBlock应用字体

I've tried a lot with embedding a font in a wpf app in c#. The font's name is 'Roboto'. The filename is roboto.ttf if that's of use. I've made sure it's compiled in the assembly. So how to apply the font in a TextBlock for example?

推荐答案

您可以将您的字体在这样一个元素:

You can apply your font in an element like this:

<TextBlock FontFamily="./#Roboto" ... />



或者你可以指定喜欢这个字体的文件名;

Or you can specify the font's filename like this;

<TextBlock FontFamily="./roboto.ttf" ... />

您也可以指定./#Roboto灯,例如,如果你想要的光的字体,如果是嵌入了。

You can also specify "./#Roboto Light" for example if you want the light font if it's embedded too.

这篇关于在C#中嵌入字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆