alin alin - 2 years ago 112
C# Question

Embedded fonts in c#

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

for example?

Answer Source

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" ... />

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download