Visual Studio and Ligatures

Posted by

For a while now, I’ve been using variable-width fonts when I’m programming. It just makes my code look so much nicer and easier to read.

I’ve typically used Verdana as my font of choice, but since I got a copy of the Vista beta, I’ve started to use Calibri. Calibri seems a bit easier on the eyes than Verdana (which is saying quite a lot – Verdana is a nice font to begin with!) there’s just a couple of drawbacks.

First of all, the capital “O” lowercase “o” and zero “0” all look very similar. But that’s not usually a problem, since my numbers are coloured different to identifiers anyway, and ReSharper can find the different between upper- and lower-case “o” for me.

But the real problem is that Calibri contains ligatures for characters sequence “fi” and for some reason, Visual Studio considers the ligature to be a single character. Observe the following code-snippet, presented in Calibri:

Code snippet, showing the “fi” ligature

If I press backspace at the point where the cursor is right now, it will delete both the “i” and the “f” because Visual Studio considers them to be a single character.

Now, I know “why” it’s doing it – it does it because if you type “e” followed by U+0301 (COMBINING ACUTE ACCENT) you get a character which looks like “é” and pressing backspace would delete the whole thing, not just the acute accent (though in some contexts, it does make sense to just delete the accent). So Visual Studio is just considering the “fi” ligature to be the same sort of thing as a combining accent. But it’s not!

This is clearly a bug in Visual Studio, and I’ve submitted a bug report, so please vote for it :)

blog comments powered by Disqus