Almost all Forums have a Discussion relating to 'Only true type fonts are Supported.This is not a true Type Font' Exception thrown in C#/.NET when a non true type font or a true type font with invalid metadata is selected from a Font Dialog.
This exception occurs because GDI+ Only supports True Type fonts. Modern/open type fonts are not Supported by C#.Open Type fonts has been created by merging the old True Type and PostScript Fonts, as the result the Open type font may have a true type or postscript specification.
Although the Font Dialog control was designed to filter out these Non True Type fonts by using ChooseFont() API call with the CF_TTONLY option ,some Fonts may represent or call themselves as true type fonts.These are the Fonts with bad/Invalid MetaData that causes the Exception.
The Solution???
Unfortunately there is NO SOLUTION,I have found articles on the web giving the following solutions these include
These don't solve the Problem,A person had reported this bug to MicroSoft and here is their Reply:This exception occurs because GDI+ Only supports True Type fonts. Modern/open type fonts are not Supported by C#.Open Type fonts has been created by merging the old True Type and PostScript Fonts, as the result the Open type font may have a true type or postscript specification.
Although the Font Dialog control was designed to filter out these Non True Type fonts by using ChooseFont() API call with the CF_TTONLY option ,some Fonts may represent or call themselves as true type fonts.These are the Fonts with bad/Invalid MetaData that causes the Exception.
The Solution???
Unfortunately there is NO SOLUTION,I have found articles on the web giving the following solutions these include
- Setting FontDialog.AllowSimulations property to false.
- Setting FontDialog.AllowScriptChange property to false
Posted by Microsoft
This is a GDI+ issue and no changes are planned to that code base, therefore we cannot fix this bug.
Posted by Microsoft
The Microsoft Sub-status is now "Investigating"
Posted by Microsoft
Note to customer: This only seems to be an issue at design time. You *can* set the font to VisualUI at runtime. We will continue looking into this from the designer perspective.
Posted by Microsoft
Thanks for reporting this bug, we have been able to repro this issue and are investigating.
Posted by Microsoft
The Microsoft Sub-status is now "Reproduced"
Thanks for reporting this bug, we have been able to repro this issue and are investigating.
Thanks for reporting this bug, we have been able to repro this issue and are investigating.
This was Reported in 2005 and there is not a solution yet.The only Solution that i can offer is designing your own custom font picker or font selector that displays only true type fonts using the FontFamily class that returns only valid true type fonts.
See these links to get started
Custom Font Dialog in WPF
Color and Font Selector Project hosted at Code Project
So,these are the currently available solutions to the Invalid Font Problem of the Font Dialgo control in C#.
Comments are always appreciated.
Java online job support from India
ReplyDeleteAndroid online job support from India
PHP online job support from India
Mainframe online job support from India
ReactJs online job support from India
MicroStrategy online job support from India
Dot Net online job support from India
DevOps online job support from India
Great Article android based projects
DeleteJava Training in Chennai
Project Center in Chennai
Java Training in Chennai
projects for cse
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
Python Course in Bangalore
DeleteReact Course in Bangalore
Automation Anywhere Course in Bangalore
Blue Prism Course in Bangalore
RPA Course in Bangalore
UI Path Course in Bangalore
Clinical SAS Course in Bangalore
Oracle DBA Course in Bangalore
iOS Course in Bangalore
SolidWorks Course in Bangalore
AtoZ is one of the Best Software Training Institute in Trichy, is a leading innovator in the field of advanced software training in the market. We are continually analyzing the IT industry and providing students with best software courses in advance technology like Python Training in Trichy, ReactJS Training in Trichy, Digital Marketing Training in Trichy, UI/UX Development Training in Trichy, Web Development, etc.
ReplyDeleteWe help you achieve your dream job and successful career by training you with time-tested courses by well-trained professional experts.
AtoZ Software Training believe the right software training with is will be an essential part of your IT expertise.
At the end of the course, we would like to make our trainees equipped with all the necessary skills to make an impact on the field.
To achieve that goal, a strong certification is important and that’s what we do provide!