<p>I would really like to see a proportional font IDE, even if I have to build it myself (perhaps as an extension to Visual Studio). What I basically mean is MS Word style editing of code that sort of looks like the typographical style in <a href="http://www.research.att.com/~bs/3rd.html" rel="nofollow noreferrer">The C++ Programming Language book</a>.</p>

<p>I want to set tab stops for my indents and lining up function signatures and rows of assignment statements,  which could be specified in points instead of fixed character positions. I would also like bold and italics. Various font sizes and even style sheets would be cool.</p>

<p>Has anyone seen anything like this out there or know the best way to start building one?</p>

[{'answer_id': 14510, 'author': 'Andrew', 'author_id': 1389, 'author_profile': 'https://Stackoverflow.com/users/1389', 'pm_score': 1, 'selected': False, 'text': '<p>When I last looked at Eclipse (some time ago now!) it allowed you to choose any installed font to work in.  Not so sure whether it supported the notion of indenting using tab stops.  </p>\n\n<p>It looked cool, but the code was definitely harder to read...</p>\n'}, {'answer_id': 14513, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 5, 'selected': True, 'text': '<p>I\'d still like to see a popular editor or IDE implement <a href="http://nickgravgaard.com/elastictabstops/" rel="noreferrer">elastic tabstops</a>.</p>\n'}, {'answer_id': 14519, 'author': 'Leon Bambrick', 'author_id': 49, 'author_profile': 'https://Stackoverflow.com/users/49', 'pm_score': 2, 'selected': False, 'text': '<p>i expected you\'ll get down-modded and picked on for that suggestion, but there\'s some real sense to the idea. </p>\n\n<p>The main advantage of the traditional \'non-proportional\' font requirement in code editors is to ease the burden of performing code formatting. </p>\n\n<p>But with all of the interactive automatic formatting that occurs in modern IDE\'s, it\'s really possible that a proportional font could improve the readability of the code (rather than hampering it, as i\'m sure many purists would expect).</p>\n\n<p>A character called <a href="http://mindprod.com/" rel="nofollow noreferrer">Roedy Green</a> (famous for his \'<a href="http://mindprod.com/jgloss/unmain.html" rel="nofollow noreferrer">how to write unmaintainable code</a>\' articles) wrote about a theoretical editor/language, based on Java and called <a href="http://mindprod.com/jgloss/bali.html" rel="nofollow noreferrer">Bali</a>. It didn\'t include non-proportional fonts exactly, but it did include the idea of having non-uniform font-sizes.</p>\n\n<p>Also, this short <a href="http://www.joelonsoftware.com/items/2006/07/03.html" rel="nofollow noreferrer">Joel Spolsky post</a> posts to a solution, elastic tab stops (as mentioned by another commentor) that would help with the support of non-proportional (and variable sized) fonts.</p>\n'}, {'answer_id': 14520, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 1, 'selected': False, 'text': "<p>Soeren: That's kind of neat, IMO. But do people really line comments up like that? For my end of line comments, I always use a single space then // or /* or equivalent, depending on language I'm using. I never try to line up declarations or comments or anything, and the only place I've ever seen that is in textbooks.</p>\n"}, {'answer_id': 14576, 'author': 'Brian Ensink', 'author_id': 1254, 'author_profile': 'https://Stackoverflow.com/users/1254', 'pm_score': 2, 'selected': False, 'text': "<p>@Thomas Owens</p>\n\n<blockquote>\n  <p>But do people really line comments up\n  like that? ... I never try to\n  line up declarations or comments or\n  anything, and the only place I've ever\n  seen that is in textbooks.</p>\n</blockquote>\n\n<p>Yes people do line up comments and declarations and all sorts of things.  Consistently well formatted code is easier to read and code that is easier to read is easier to maintain.  </p>\n"}, {'answer_id': 14583, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 1, 'selected': False, 'text': "<p>@Brian Ensink: I don't find code formatted like that easier to read.</p>\n\n<pre><code>int var1 = 1 //Comment\nint longerVar = 2 //Comment\nint anotherVar = 4 //Command\n</code></pre>\n\n<p>versus</p>\n\n<pre><code>int var2       = 1 //Comment\nint longerVar  = 2 //Comment\nint anotherVar = 4 //Comment\n</code></pre>\n\n<p>I find the first lines easier to read than the second lines, personally.</p>\n"}, {'answer_id': 14755, 'author': 'Brian Ensink', 'author_id': 1254, 'author_profile': 'https://Stackoverflow.com/users/1254', 'pm_score': 2, 'selected': False, 'text': '<p>@Thomas Owens</p>\n\n<blockquote>\n  <p>I don\'t find code formatted like that easier to read.</p>\n</blockquote>\n\n<p>That\'s fine, it is just a personal preference and we can disagree.  Format it the way you think is best and I\'ll respect it.  I frequently ask myself \'how should I format this or that thing?\'  My answer is always to format it to improve readability, which I admit can be subjective.</p>\n\n<p>Regarding your sample, I just like having that nicely aligned column on the right hand side, its sort of a quick "index" into the code on the left.  Having said that, I would probably avoid commenting every line like that anyway because the code itself shouldn\'t need that much explanation.  And if it does I tend to write a paragraph above the code.</p>\n\n<p>But consider this example from the original poster.  Its easier to spot the comments in the second one in my opinion.</p>\n\n<pre><code>for (size-type i = 0; i&lt;v.size(); i++) { // rehash:\n    size-type ii = has(v[i].key)%b.size9); // hash\n    v[i].next = b[ii]; // link\n    b[ii] = &amp;v[i];\n}\n\nfor (size-type i = 0; i&lt;v.size(); i++) {     // rehash:\n    size-type ii = has(v[i].key)%b.size9);   // hash\n    v[i].next = b[ii];                       // link\n    b[ii] = &amp;v[i];\n}\n</code></pre>\n'}, {'answer_id': 217695, 'author': 'Andreas Scherer', 'author_id': 11633, 'author_profile': 'https://Stackoverflow.com/users/11633', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.lanovaz.org/daniel/Site/Blog/Entries/2004/10/31_Thinking_with_Style.html" rel="noreferrer">Thinking with Style</a> suggests to use your favorite text-manipulation software like Word or Writer. Create your programme code in rich XML and extract the compiler-relevant sections with XSLT. The "Office" software will provide all advanced text-manipulation and formatting features.</p>\n'}, {'answer_id': 217736, 'author': 'jussij', 'author_id': 14738, 'author_profile': 'https://Stackoverflow.com/users/14738', 'pm_score': -1, 'selected': False, 'text': '<p>The major problem with proportional fonts is they destroy the vertical alignment of the code and this is a fairly major loss when it comes to writing code.</p>\n\n<p>The vertical alignment makes it possible to manipulate rectangular blocks of code that span multiple lines by allowing block operations like cut, copy, paste, delete and indent, unindent etc to be easily performed.</p>\n\n<p>As an example consider this snippet of code:</p>\n\n<pre><code>a1 = a111;\nB2 = aaaa;\nc3 = AAAA;\nw4 = wwWW;\nW4 = WWWW;\n</code></pre>\n\n<p>In a mono-spaced font the <strong><em>=</em></strong> and the <strong><em>;</em></strong> all line up.</p>\n\n<p>Now if this text is loded into <strong>Word</strong> and display using a <strong>proportional font</strong> the text effectively turns into this:</p>\n\n<p><strong>NOTE:</strong> Extra white space added to show how the <strong><em>=</em></strong> and <strong><em>;</em></strong> no longer line up:</p>\n\n<pre><code>a1 = a1 1 1;\nB2  = aaaa;\nc3 = A A A A;\nw4 = w w W  W;\nW4  = W W W  W;\n</code></pre>\n\n<p>With the vertical alignment gone those nice blocks of code effectively disappear.</p>\n\n<p>Also because the cursor is no longer guaranteed to move vertically (i.e. the column number is not always constant from one line to the next) it makes it more difficult to write throw away macro scripts designed to manipulated similar looking lines.</p>\n'}, {'answer_id': 217760, 'author': 'myplacedk', 'author_id': 28683, 'author_profile': 'https://Stackoverflow.com/users/28683', 'pm_score': 2, 'selected': False, 'text': '<p>I wonder why nobody actually answers your question, and why the accepted answer doesn\'t really have anything to do with your question. But anyway...</p>\n\n<p><strong>a proportional font IDE</strong></p>\n\n<p>In Eclipse you can cchoose any font on your system.</p>\n\n<p><strong>set tab stops for my indents</strong></p>\n\n<p>In Eclipse you can configure the automatic indentation, including setting it to "tabs only".</p>\n\n<p><strong>lining up function signatures and rows of assignment statements</strong></p>\n\n<p>In Eclipse, automatic indentation does that.</p>\n\n<p><strong>which could be specified in points instead of fixed character positions.</strong></p>\n\n<p>Sorry, I don\'t think Eclipse can help you there. But it is open source. ;-)</p>\n\n<p><strong>bold and italics</strong></p>\n\n<p>Eclipse has that.</p>\n\n<p><strong>Various font sizes and even style sheets would be cool</strong></p>\n\n<p>I think Eclipse only uses one font and font-size for each file type (for example Java source file), but you can have different "style sheets" for different file types.</p>\n'}, {'answer_id': 3076845, 'author': 'user371179', 'author_id': 371179, 'author_profile': 'https://Stackoverflow.com/users/371179', 'pm_score': 0, 'selected': False, 'text': '<p>Folks are all complaining about comments not lining up. </p>\n\n<p>Seems to me that there\'s a very simple solution:  Define the unit space as the widest character in the font. Now, proportionally space all characters except the space. the space takes up as much room so as to line up the next character where it would be if all preceeding characters on the line were the widest in the font. </p>\n\n<p>ie:</p>\n\n<p>iiii_space_Foo</p>\n\n<p>xxxx_space_Foo</p>\n\n<p>would line up the "Foo", with the space after the "i" being much wider than after the "x".</p>\n\n<p>So call it elastic spaces. rather than tab-stops.   </p>\n\n<p>If you\'re a smart editor, treat comments specially, but that\'s just gravy</p>\n'}, {'answer_id': 7393839, 'author': 'pgfearo', 'author_id': 63965, 'author_profile': 'https://Stackoverflow.com/users/63965', 'pm_score': 1, 'selected': False, 'text': '<p>The indentation part of your question is being done today in a real product, though possibly to even a greater level of automation than you imagined, the product I mention is an <a href="http://coherentweb.com/" rel="nofollow noreferrer">XSLT IDE</a>, but the same formatting principles would work with most (but not all) conventional code syntaxes.</p>\n\n<p>This really has to be seen in <a href="http://youtu.be/IFJHG1EnS0A" rel="nofollow noreferrer">video</a> to get the sense of it all (sorry about the music back-track). There\'s also a light XML editor spin-off product, <a href="http://xmlquire.com" rel="nofollow noreferrer">XMLQuire</a>, that serves as a technology demonstrator.</p>\n\n<p>The screenshot below shows XML formatted with quite complex formatting rules in this XSLT IDE, where all indentation is performed word-processor style, using the left margin - not space or tab characters.</p>\n\n<p><img src="https://i.stack.imgur.com/O6Jg4.png" alt="enter image description here"></p>\n\n<p>To emphasise this formatting concept, all characters have been highlighted to show where the left-margin extends to keep indentation. I use the term <em>Virtual Formatting</em> to describe this - it\'s not like elastic tab stops, because there simply are no tabs, just margin information which is part of the \'paragraph\' formatting (RTF codes are used here). The parser reformats continuously, in the same pass as syntax coloring.</p>\n\n<p>A proportional font hasn\'t been used here, but it could have been quite easily - because the indentation is set in TWIPS. The editing experience is quite compelling because, as you refactor the code (XML in this case), perhaps through drag and drop, or by extending the length of an attribute value, the indentation just re-flows itself to fit - there\'s no tab-key or \'reformat\' button to press.</p>\n\n<p>So, the indentation is there, but the font work is a more complex problem. I\'ve experimented with this, but found that if fonts are re-selected as you type, the horizontal shifting of the code is too distracting - there would need to be a user-initiated \'format fonts\' command probably. The product also has Ink/Handwriting technology built-in for annotating code, but I\'ve yet to exploit this in the live release.</p>\n'}, {'answer_id': 25633473, 'author': 'realbart', 'author_id': 1677285, 'author_profile': 'https://Stackoverflow.com/users/1677285', 'pm_score': 0, 'selected': False, 'text': '<p>Let me recall arguments about using the \'var\' keyword in C#. People hated it, and thought it would make code less clear. For example, you couldn\'t know the type in something like:</p>\n\n<pre><code>var x = GetResults("Main");\nforeach(var y in x)\n{\n   WriteResult(x);\n}\n</code></pre>\n\n<p>Their argument was, that you couln\'t see if x was an array, an List or any other IEnumerable. Or what the type of y was. In my opinion the unclearity did not arise from using var, but from picking unclear variable names. Why not just type:</p>\n\n<pre><code>var electionResults = GetRegionalElactionResults("Main");\nforeach(var result in electionResults)\n{\n   Write(result); // you can see what you\'re writing!!\n}\n</code></pre>\n\n<p>"But you still cannot see the type of electionResults!" - does it really matter? If you want to change the return type of GetRegionalElectionResults, you can do so. Any IEnumerable will do.</p>\n\n<p>Fast forward to now. People want to align comments en similar code:</p>\n\n<pre><code>int var2       =  1; //The number of days since startup, including the first\nint longerVar  =  2; //The number of free days per week\nint anotherVar = 38; //The number of working hours per week\n</code></pre>\n\n<p>So without the comment everything is unclear. And if you don\'t align the values, you cannot seperate them from the variales. But do you? What about this (ignore the bullets please)</p>\n\n<ul>\n<li>int daysSinceStartup = 1; // including first</li>\n<li>int freeDaysPerWeek = 2;</li>\n<li>int workingHoursPerWeek = 38;</li>\n</ul>\n\n<p>If you need a comment on EVERY LINE, you\'re doing something wrong. "But you still need to align the VALUES" - do you? what does 38 have to do with 2?</p>\n\n<p>In C# Most code blocks can easily be aligned using only tabs (or acually, multiples of four spaces):</p>\n\n<ul>\n<li>var regionsWithIncrease =\n<ul>\n<li>from result in GetRegionalElectionResults()</li>\n<li>where result.TotalCount > result > PreviousTotalCount &amp;&amp;\n<ul>\n<li>result.PreviousTotalCount > 0 // just new regions</li>\n</ul></li>\n<li>select result.Region;</li>\n</ul></li>\n<li>foreach (var region in regionsWithIncrease)</li>\n<li>{\n<ul>\n<li>Write(region);</li>\n</ul></li>\n<li>}</li>\n</ul>\n\n<p>You should never use line-to-line comments and you should rarely need to vertically align things. Rarely, not never. So I understand if some of you guys prefer a  monospaced font. I prefer the readibility of font Noto Sans or Source Sans Pro. These fonts are available freely from Google, and resemble Calibri, but are designed for programming and thus have all the neccesary characteristics:</p>\n\n<ul>\n<li>Big : ; . , so you can clearly see the difference</li>\n<li>Clearly distinct 0Oo and distinct Il|</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/14504', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1659/']