I built a .net application using Windows 7. One of the textboxes uses Consolas, a fixed-width font. When I run the application on XP some other non-fixed-width font is used. The fixed-width is important for legacy layout purposes.
What is going on here? Does XP somehow not have Consolas? Is there some other fixed-width font I can use? Is this some other issue entirely?
It is indeed the case that
Consolaswas not originally part of XP. I only got it when I installed it as part of VS 2005 or 2008 – I can’t remember now – but I think MS offered it originally as a separate download or something like that. It won’t be redistributable, though – so clearly you won’t be able to include it as part of your app.I think it then became part of the OS offering from Vista onwards.
I would probably go with
Courier Newin the absence of Consolas; there’s alsoCourierof course. You could enumerate the installed Fonts first to see if Consolas is available and use an alternative if not – using the InstalledFontCollection class.