Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have a c# project , but in this project i don't have any permission for access to windows control panel..
now i want install a font with my application...
how can embed a font to my c# application?
plz help...
Posted

1 solution

Have a look at Embedding Font To Resources[^]
or
Add custom font to your application[^]

Ideas for packaging it with the application ... Packaging fonts with Applications[^]

and lots more ideas[^]
 
Share this answer
 
v2
Comments
Ehsanf3 12-Apr-14 8:01am    
this ways just add a font to resources in my project..
but i don't want show .ttf file in project bin.
is there a way to embed .ttf file to .dll files or .exe file?
CHill60 12-Apr-14 8:30am    
Why don't you want the ttf file in project\bin ... it's not like your going to release everything that's in there. Resources are compiled into the binary at compile time see Microsoft reference[^]
Ehsanf3 13-Apr-14 1:43am    
hi again
i use this code to add .ttf file in .resx file in my project

System.Drawing.Text.PrivateFontCollection pFCollection = new System.Drawing.Text.PrivateFontCollection();
pFCollection.AddFontFile(@"..\arial.ttf");

ResXResourceWriter rsxw = new ResXResourceWriter("arial.resx");
rsxw.AddResource("arial.ttf", pFCollection.Families[0]);
rsxw.Close();

but in "AddAddResource" has an error :
Item named 'arial.ttf' of type 'System.Drawing.FontFamily' cannot be added to the resource file because it is not serializable.

what is this for?
CHill60 13-Apr-14 4:53am    
Not something I've experienced ... have a look here[^] and if that doesn't help it's probably worth posting a new question - if you do then make sure you post the code as you have on this comment
Ehsanf3 20-Apr-14 15:32pm    
tnx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900