RatedBinary
RatedBinary

Reputation: 43

Urdu in WPF Application

I am developing a WPF desktop application in urdu language.

I have mutiple ext blocks with urdu text in them. I require using some custom urdu fonts in my application. One way to do so is to intall the required font on the desktop machine but I want to avoid that.

So the question is that is there a way to use custom urdu font without having the need to install the font.

Upvotes: 4

Views: 112

Answers (1)

Tayyab
Tayyab

Reputation: 1217

I believe you just need to follow the following steps in your application:

  1. Add your font file say hisham-lt-regular-1.ttf as resource in your project.
  2. Next you need to define a style say in a ResourceDictionary targeting the required element say TextBlock:

Note here #Hisham LT is the font name (# not included) which you can see when you open the font file.

enter image description here

Last you need to add this style to the required TextBlock Element:

<TextBlock Text="آپ کا آپریٹر منتخب کریں" FontSize="38" Style="{StaticResource Urdu}"></TextBlock>

Upvotes: 1

Related Questions