Procedure file tip: tab compatibility with monospaced font

I have recently started using the Consolas monospaced font to improve my Procedure code legibility: better text alignment, slashed zero, etc. I noticed that the character alignment was not always maintained if tab stops were employed, for example in for - endfor loops. This results from having the tab width in physical increments (e.g. inches) rather than character widths. One solution that seems to work is first to find the monospaced fixed character width-to-height ratio (0.55 for Consolas), and multiply by the character height (font size). Divide this result by 72 to get the character width in inches, decide on a tab width of 'n' characters, and set the resulting value in the Procedure window Document Settings. For example using Consolas-10, and 4-character tab, the tab width is 0.305 inches. These Procedures settings should be saved (Capture Procedure Preferences...) if you want to apply them to future Procedure windows. Results have been tested only with Igor Pro 6.37 on Windows 7. (Previous error corrected : Multiply by 72 -> Divide by 72)
This is also a major headache for me. While configuring Igor to make it look fine, no matter what I do, tabs still look off in other editors (word, notepad, notepad+, you name it) even with the default. I sometimes use notepad+ with proper highlighting to brush up procedures when I am at home without Igor available. I usually spend a lot of effort to line everything up properly and have the comments in 'one column'. But of course, all this effort is program-specific (usually only fine in Igor I use) because fonts, sizes, and tab widths don't match. It is not even as simple as switching the fonts in all programs to the same one, as the tab definition is different. I guess for now there is no solution?
I'll keep this in mind for a possible future enhancement. For backward compatibility, it would have to be an option in addition to the current behavior.

I finally have found a solution for the problem of comment alignment inside procedure windows that works nicely for me. Inspired by the Prettify code snipped from Tony, I wrote a procedure which aligns the comments of all selected lines by inserting tab characters with the press of a button (two actually).

You can find the code here:

The only limitations (I am aware of) currently are: The settings for the used font and the tab width for procedure windows is currently hard-coded as constants. so you have to dial them in for your environment. I did not find a way to get this information programmatically. A panel would be thinkable, but this would still be a hassle. Also, one needs to select whole lines for this to work. Otherwise the comment of the first line is misplaced. Is there a way of modify the selection of procedure windows programatically?

It would be great if somebody had an idea how to improve upon these things. I also would be interested to hear if this works for Mac people as well.

@chozo: Would one off GetDefaultFont, GetDefaultFontSize, GetDefaultFontStyle, FontSizeHeight, FontSizeStringWidth help?

Thomas, thank you for your tips. Unfortunately, it turned out that there is no way to grab this information for procedure windows. Please see also the discussion below the code snippet. GetDefaultFont() etc. works only for graphs or the whole experiment. And FontSizeStringWidth() gives out a tab width of one character length, and not the real tab width setting. So for the time being there is no way around dialing in these values manually (either in the file or via a GUI).

By the way, the problem with the selection of the first line could be solved.