VS 2010 Beta2: Workaround for Raster Font Settings Issue

VS 2010 Beta2: Workaround for Raster Font Settings Issue

  • Comments 25

In addition to making announcements, showcasing features, posting walkthroughs, and sharing Visual Studio tips and tricks, we’ll also be using this blog to raise awareness of commonly-encountered bugs and explain their workarounds.  As many of you know, we’ve rebuilt the editor using WPF for Visual Studio 2010.  This allows for a wealth of new visualizations and enables many new extensibility scenarios, often making previously impossible tasks possible and previously difficult tasks much easier.  However, because WPF renders only TrueType fonts, it also means that the Visual Studio editor no longer supports raster or bitmap fonts.

The Bug:
Attempting to use a non-TrueType font in Visual Studio 2010 Beta2 throws an exception when opening a file, usually with the message “Object reference not set to an instance of an object.”  The editor will not load.

The Workaround:
In Tools->Options->Environment->Fonts and Colors, change any raster or bitmap font settings to a TrueType font, or simply click OK to have any raster fonts fall back to the default font (Consolas on English systems).  The editor should then load correctly.

Fix Status:
Already fixed for Visual Studio 2010 RTM.

The most common way to encounter this bug is to import settings that include a non-TrueType font from a previous version of Visual Studio.  Running "devenv /resetuserdata" will also resolve the issue, though it will reset all of your settings to the defaults and therefore change more of your preferences than is necessary to fix the problem.  This bug has already been fixed for VS 2010 RTM, where importing or selecting a non-TrueType font will cause the editor to fall back to the default font (Consolas on English systems) and load successfully instead of throwing an exception.

We also discovered that although most bitmap fonts were removed from the default Fonts and Colors list, we inadvertently missed a few.  They are:  Courier, Fixedsys, Modern, MS Sans Serif, MS Serif, Roman, Script, Small Fonts, System, and Terminal.  These fonts have already been removed from the default list for VS 2010 RTM.

Again, this is a bug in Visual Studio Beta2 that has already been fixed internally for VS 2010 RTM.  If you have any questions about this bug or its workaround, please feel free to post a comment below and we’ll do our best to help.

Thanks for trying Visual Studio 2010 Beta2!

Brittany Behrens
Program Manager, Visual Studio Editor Team

Leave a Comment
  • Please add 1 and 3 and type the answer here:
  • Post
  • i appreciate this. also i wish that every ms blogger would open the comments for anonymous posting like the vs team ;-)

  • Looking forward to the fix. Fixedsys is my alltime fav font to use in visual studio and I'd hate to see it go. Thanks for the heads up!

  • Could you also fix the blurred line number font when zooming in (control+wheel)? It looks terrible...

  • Ricardo: Vote here for the blurred line number font:

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=499235

  • @Jan:

    The fix will allow the editor to load *by falling back to the default font* if a non-TrueType font is selected.  Raster/bitmap fonts will still not be supported for VS 2010 RTM, as WPF text rendering only allows TrueType fonts.  There are lots of TrueType fonts, though - is it a deal-breaker for you if VS 2010 doesn't support Fixedsys?

    @Ricardo and @Hugues:

    Blurred line numbers when zooming is already fixed internally :)  We'll be blogging about this next week, so stay tuned.

  • Removing raster fonts is absolutely unacceptable. Many developers depend on these fonts for day to day development. Why was this decision made and by whom? Microsoft always correlates its decision with customer feedback. Clearly, this decision did not have customer feedback in mind, since raster fonts are very important.

  • Have you also resolved the issue where settings reference a font that hasn't been installed?

    As noted in the comments to the connect issue, I was experiencing this when I'd imported my settings from a different machine.

    VS2008 didn't have an issue, successfully changing to a default font.

  • @Michael:

    We didn't *remove* raster fonts from Visual Studio per se.  Rather, we rebuilt the VS editor on WPF technology, and WPF text rendering does not support raster fonts.  Many raster font users are able to find a TrueType font that meets their needs, but it sounds like this is a major issue for you.  I'd encourage you to contact the WPF text team for more details on their reasons for supporting only TrueType fonts.  You can find their blog at http://blogs.msdn.com/text/default.aspx and contact them directly via the e-mail link on that site (http://blogs.msdn.com/text/contact.aspx).

    @zhaph:

    We think the scenario you describe, importing settings that include a font that's not installed, should work in VS 2010.  It should behave the same way as VS 2008 and fall back to the default font (Consolas for English systems, then Courier New if Consolas is not installed).  Is this not the case for you?  Also, could you provide a link or bug number for the Connect issue you alluded to?

    Thanks!

    Brittany Behrens, Program Manager, VS Platform - Editor

  • Given that there is no going back to raster fonts due to the transition to WPF, here is what I would like to suggest that the VS2010 team do prior to RTM to enable raster font users to more easily transition to TrueType fonts.

    First, some background information is in order. The reason many of us have stuck it out with raster fonts over all these years is not because these fonts are "prettier" per se - it is primarily because these fonts are:

    1) Sharp at all resolutions. There is no font smoothing or sub-pixel blurriness due to ClearType. Some of us still use high resolution CRT monitors and even on LCD monitors, a blurry small font is not very useful.

    2) Vertical line count. Fonts like Terminal allow a high vertical line count. This is very important for editing code, because the more lines of code can be seen at the same time, the greater the comprehension of and navigation ability through the code.

    With regard to #1, I think that VS 2010 Beta 2 does a relatively decent job with TrueType fonts. Some improvements can probably be made, to further align glyphs even better to pixel boundaries, but in my opinion VS 2010 is 90% of the way there.

    With regard to #2, the user DESPERATELY needs the ability to adjust inter-line spacing in the VS 2010 editor. Or, at the very least, such spacing should be reduced by at least 20% for the RTM. As of Beta 2, VS 2010 inserts a gratuitous amount of space between lines of text for decent monospaced TrueType fonts such as Consolas and Courier New.

    To demonstrate this, simply:

    1) Create a sample C# application.

    2) Change the font to Consolas 10 pt.

    3) Copy the Wizard generated code from Program.cs into MS Word 2007

    Notice how the line spacing in MS Word is much smaller than it is in VS2010 Beta 2. In fact, if I take the code pasted into MS Word 2007 and increase the font size from 8 pt Consolas to 10 pt Consolas, it will have the same vertical height as the 8 pt Consolas code in VS 2010. This means that VS 2010 is adding some 25% additional gratuitous vertical space over what is considered "reasonable." This wastes precious vertical screen real-estate without making code any more legible. In fact, this make it less legible, since with smaller line spacing I could use a larger and much more legible font choice such as Consolas 10 pt and get the same line count per screen as with Consolas 8 pt, today.

    Allowing the user to adjust vertical line spacing (much like in products such as MS Word) and not just the font size or at least reducing vertical line spacing by 20% would go a long way to smoothing the transition from raster fonts to TrueType fonts.

    Thank you for listening to our concerns,

    Michael Goldshteyn

  • A minor correction to my previous post. Under the "To demonstrate this, simply:" paragraph, step #2 should be changed to:

    2) Change the font to Consolas 8 pt.

    Thanks,

    Michael Goldshteyn

  • I agree that the line spacing is outrageous in Beta 2 and have raised the issue in this feedback:

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=498859

    Fortunately the line spacing in RTM supposedly is in line with Visual 2005 and 2008. It would be great to go back to the correct line spacing seen in Visual Studio 2003 and earlier, but it seems the decision was made already in 2005 that subjective squiggle prettiness is more important than vertical screen real estate:

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=109065

    Regarding raster fonts and Visual Studio 2010, I still have some hopes of a workaround as I have detailed here:

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=498864

    "Unfortunately WPF requires that the TrueType font include outlines, not just embedded bitmaps, to render correctly. So it seems that your approach of taking a raster font and moving the bitmaps into a TrueType font will probably not be successful. Please feel free to respond to the blog post with any more feedback."

    I know that it's possible, because BatangChe and other Asian fonts use the embedded bitmaps in Visual Studio 2010.

    My problem is that I don't know what the criteria are for the bitmaps to be used by WPF. It's really important for me to make this work, so if I need to provide outlines as well that's not a problem.

    As mentioned in the feedback just loading up the BatangChe font and saving it again breaks the bitmaps in Visual Studio 2010, so the outlines are not the problem.

    Here is the font that is using the embedded bitmaps correctly in non-WPF programs. It only contains one outline, which was enough for non-WPF, but rendering correctly or not is not my current issue, but rather getting WPF to use the embedded bitmaps at all.

    http://www.olofsson.info/MonoProTTF.zip

    If someone from the WPF team could debug why the embedded bitmaps in this font is not used I would be eternally grateful!

  • What if we are willing to disable squiggles? Shouldn't we get our vertical space back in that case?

  • As tempting as it is to jump up and down about lack of raster font support, I can see why pushing for any such support in WPF will be a waste of time. To approach the matter from a different angle (not to change anything but purely out of interest) is there any blog/article discussing the decision to adopt WPF for VS2010?

  • VS2010B2 is crashing for me immediately after starting when displaying a tooltip on the start page.

    I've tried the /resetuserdata workaround to no avail.

    Is there something else I can do?

    I have vs2003 and vs2008 installed under windows 7 x86.

    thanks.

  • I cannot code without my raster font.  Please, I beg of you, do not remove this functionality from the Visual Studio editor.  Please do not force us to code in cleartype and/or outline fonts.  I'm on my hands and knees.

Page 1 of 2 (25 items) 12