1

i have a client server application. i want to load a font from file in my server part. here is my code to do that. but unfortunately it will hangs on new PrivateFontCollection(); line!!!! note that this part is running in another thread.

string fontAdd = @"C:\ETLEngine\Languages\Fonts\BNazanin.ttf";
System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
privateFonts.AddFontFile(fontAdd);
var mapFont = new Font(privateFonts.Families[0], 12, FontStyle.Bold);

please help me get out of this. is there any alternative way for loading font from files?

Actualy I did write a console application which just do the code above, and everything works completely fine!! i got this sample code from msdn and stackoverflow, but i don't know why it doesn't work in my server side application!!! it doesn't produce an error, i set a break point on that line, and hit F10 or F11 and then its going to execute that line but never comes back to execute next line! and the thread still is in running state, not terminated or something else...! that's it!!!

Mohy66
  • 390
  • 2
  • 12
  • make your life easier by looking into your problem a bit more: write a single file executable that literally does only what you're showing here, to see what it *actually* does. "It hangs" is not detailed enough information to ask a question with, you need to find out what this code actually does. If it produces an error, you have important information to add to your question that is currently missing. And, if it turns out it works just fine as its own dedicated code: you now have very important information about your code to add to your question. – Mike 'Pomax' Kamermans May 04 '15 at 16:00
  • tnx Mike, Actualy I did write a console application which just do the code above, and everything works completely fine!! i got this sample code from msdn and stackoverflow, but i don't know why it doesn't work in my server side application!!! it doesn't produce an error, i set a break point on that line, and hit F10 or F11 and then its going to execute that line but never comes back to execute next line! and the thread still is in running state, not terminated or something else...! that's it!!! – Mohy66 May 05 '15 at 06:03
  • worth updating your question with, so others can easily see that information, too – Mike 'Pomax' Kamermans May 05 '15 at 06:08

0 Answers0