by Michael S. Kaplan, published on 2012/08/14 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2012/08/14/10338893.aspx
The other day, Peter Parker (probably not his real name) asked:
How can I determine if a font is fixed width, like Visual Studio does?
Well, he certainly can't rely on his spidey sense even if he was the real Peter Parker, since Spiderman doesn't scale! :-)
When he referred to "like Visual Studio does", he meant the Bold items on the list:
The principle is simple enough:
You can see many examples of this being correctly done for Meiryo/Meiryo UI (since the Latins are based on Verdana) and Microsoft YaHei/Microsoft JhengHei (since the Latins are based on Segoe UI) and so on.
It may even interest our Marvel action hero enough to want to emulate the checks.
However, there are three problems here;
I suppose there could be an IsfixedWidth method where you can pass the font name and some text.
It could then return whether all of that text you passed in is the exact same width per character!
For now, you are mildly on your own checking for this.
Even if you spin a web any size and catch thieves just like flies...