Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
This is my Error

Only TrueType fonts are supported. This is not a TrueType font.


and all I am using is

C#
if (fontDialog1.ShowDialog() == DialogResult.OK)
         {
           richtextbox1.font = fontDialog1.Font;
         }


I want to know if i can have these options

op1= Get rid of the non-truetype fonts thats are in that font dialog
op2= show an error message that will tell me to pick another font and wont crash the program

so yeh I was wondering if some one can help me with the truetype font thing please
Posted
Comments
CodingLover 12-Jul-12 5:17am    
How did you define the font type in the font dialog? Using properties window or what?
[no name] 12-Jul-12 5:40am    
I just draged and droped the dialog in

1 solution

This is a problem which has been around since VS2005, AFAIK there is no solution to this, and the exception is not a catchable one. http://c-madeeasy.blogspot.co.uk/2011/11/unsolved-this-is-not-true-type-font.html[^]

However, you don't have to use the MS FontDialog. Have a look at this: ColorPicker, FontPicker...[^] - I haven't tried it, but it may solve your problem. Alternatively, your own font picker wouldn't be too hard to produce.
 
Share this answer
 
Comments
[no name] 12-Jul-12 6:53am    
so your saying I can't even show an error box so it wont crash my program?
OriginalGriff 12-Jul-12 6:57am    
That's about the size of it, yes.
The problem is that the fault isn't inside .NET - it's in the code that .NET calls. And when it fails, it knows nothing about >NET exceptions so it doesn't throw one - it just fails and .NET try...catch can't detect it.
[no name] 12-Jul-12 7:14am    
then how did adobe fix it?
OriginalGriff 12-Jul-12 7:26am    
They probably don't use the standard .NET font picker! :laugh:
[no name] 12-Jul-12 8:11am    
dam those pros! XD

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