Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hi friends, I have downloaded some .ttf files. I intend to use these files in getting the C# application(word processor) display these symbols. The problem I'm facing now is how to get the C# application to use the font files(.ttf) i have. Any help on this will be greatly appreciated. Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Apr-11 23:21pm    
Good question, a 5.
--SA

Depends on if your C# application is a WinForms application or a WPF application:

WinForms custom TTF[^]

WPF custom TTF[^]

These solutions would not require a custom installer to install the fonts on the client machine. These methods will embed the font into your application.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 27-Apr-11 23:20pm    
Interesting information, my 5.
--SA
If I understand your question properly, all you have to do is install the font files on the machine and use them. On your Windows development machine, just install them like you normally would any other font, through the windows font manager. On machines you are installing your application on, use an install application (I use Inno Setup Compiler myself) that will install fonts.

I don't know the specifics of your application to guide you through using the fonts while developing. Is the control you are trying to set the font on a RichTextBox? For this use the myRichTextBox.SelectionFont property to change the font. Without specifics it's hard to help.
 
Share this answer
 
Comments
smilerP 28-Apr-11 5:46am    
Thanks Greg for the quick reply. My application will be installed on several client machines later which ofcourse may not have the fonts i have installed on the development machine. I guess setup compiler might help.
simply create the new fontfamily object from local url

new FontFamily(new Url("<path-of-local-ttfFile>",.#<fontname-without-extension>))


note: url should ends with \\ or /
 
Share this answer
 
v2

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