Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 27-Apr-11 6:25am
smilerP577
Comments
SAKryukov at 27-Apr-11 23:21pm
   
Good question, a 5.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Comments
SAKryukov at 27-Apr-11 23:20pm
   
Interesting information, my 5.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
smilerP at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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 /
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 853
1 OriginalGriff 410
2 CPallini 275
3 George Jonsson 166
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,482
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 13 Jan 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100