Sublime Text 2 uses software rendering only. Ultimately, it caused too many compatibility issues in 1.x, and with going cross platform for version 2, that would only have increased. Nonetheless, I’ll talk about Sublime Text 1.x for a bit.
The basic text rendering itself was fairly standard: textured quads are drawn to the screen, one per character. However, there are a few details worth noting:
- Characters are buffered, and sorted by color, to reduce state changes.
- Most OpenGL applications will have a single channel texture for the characters, and blend the desired color on top. Sublime Text uses RGB textures, with the text pre-composed with the correct foreground and background color. This takes more memory, but allows ClearType to be used, which is important for a text editor.
The Sublime Text 1.x UI code was inspired by some of the immediate mode GUI thoughts. For example, layout is done at drawing time, and controls are referred to by ids. I believe this was a mistake, and Sublime Text 2 doesn’t do this, its UI toolkit more resembles a traditional one, and it’s much, much better off for it.
While the rationale behind immediate mode UIs is appealing (the more stateless a thing is, the better, generally), it becomes less so as a UI gets more complex. Fundamentally, UIs are stateful entities, and trying to hide this isn’t a long term win.