user1534477
user1534477

Reputation: 51

How to use custom font in visual studio 2008 for C#.net window application?

I want to use Indian Font (Hindi) in Windows apps.When i used Mangal font for Hindi text ,then text visible but in block format.

so any one can help me for this.

enter image description here

Upvotes: 2

Views: 3087

Answers (3)

RollingCog
RollingCog

Reputation: 304

Make sure the font you are using supports the Unicode characters in controls. You can find this out using windows utility Character Map.

Some older fonts have characters for a certain code page but not for Unicode characters. For example windows font Marlett have only a few Unicode chars defined, the rest will appear as the boxes in your screen shot. If that is the case your best bet is to find a newer Unicode version of the font. Although in theory you can use font editing software to create a new version yourself (the glyphs are already in there) but it won't be easy. Best of luck :)

Upvotes: 0

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28970

You can use this code:

YourMainForm.YourTextBox.Font = new Font("Your name of indian font", 
                                         YourMainForm.YourTextBox.Font.Size);

Upvotes: 0

Roshana
Roshana

Reputation: 428

Create New windows forms project and in Form.OnLoad handler, add the following lines:

PrivateFontCollection pfc = new PrivateFontCollection();
string fontFilePath = "C:\\Fonts\\PALETX3.ttf"
pfc.AddFontFile(fontFilePath);
label1.Font = new Font(pfc.Families[0], 16, FontStyle.Regular);

You can find more information from http://msdn.microsoft.com/en-us/library/ms533820(VS.85).aspx

Upvotes: 1

Related Questions