Exception caused by installed font <p>I want to ask this because I am a novice programmer, and quite frankly, I dont like weird errors popping up when they feel like it, and then seemingly solving themselves for no apparent reason, so I hope you can help me understand what is going on.</p> <p>I am using "Cambria" as font for my Windows Forms app. I believe it comes preinstalled in w7 machines, but not in XP, and since I wanted to run the program on XP boxes as well, I went ahead and added the font files in the "Fonts folder" of my setup project. Before I did this, it was reverting back to Sans-Serif, making the interface really ugly (because of stretching and such, not that I dont like the font).</p> <p>So, everything seemed to work fine and I was very happy, thinking my program was done. Just recently I had to come back to it to make some ammends, and... </p> <p>A wild <code>System.Reflection.TargetInvocationException</code> appeared!</p> <p>And that was on program startup. I was perplexed. I hadn´t touched a line of the first form. Why was it failing to load now? I tested it before, and everything was ok... This happened only on XP, and I´m testing on a XP virtual machine, Home version, so debugging is kind of weird to set up. </p> <p>I look at the stack from the system log. The error comes from <code>InitializeComponent()</code>??? My perplexity level increased. I definitely did not touch that. Lets try and catch it to see what it has to say (since I cant get the debugger to work on the machine)... I catch it and the <code>InternalException.Message</code> is:</p> <blockquote> <p>The font "Cambria" does not support style "Regular"</p> </blockquote> <p>I still don't know why does this error happen. But at least I now have a lead to follow. I check the fonts folder to see if the fonts are there, and I see that the cambria "regular" is slightly different... since it is "Cambria.ttc" while the others are "Cambria Bold.ttf". The other fonts are also .ttf. Can this be the problem?</p> <p>So, I decide to run the program again and copy the text from the inner exception to goolge it up. And... it runs. I didn't touch a font. I just opened the fonts folder to see if the font was there, closed it, ran the application, and it worked.</p> <p>What am I missing here? How can I make sure it doesn't happen again?</p>