The platform APIs available for printing boil down to: Here’s a canvas, give us pixels. Properly implementing printing requires picking the right colors, because otherwise we’d be sending white on black to a printer. You also need to handle pagination and again the font size as the pixel density of a printer is vastly different to that of people’s monitors.
See for example the dialog used by gedit for printing:
Plus the whole preview page:
Of course this differs entirely depending on the platform you’re using. Windows for instance has two different printing APIs to choose from, which each may have their advantages.
If you want to know why we implemented OpenGL rendering: Sublime Text previously was entirely CPU rendered which was fine for higher end CPUs using low DPI screen, but when using a low end CPU or a high-dpi display - like you get on any recent mac - performance suffers. The implementation is also mostly cross platform, as OpenGL is supported by Windows, Linux and macOS and Sublime Text was already architecture to support hardware accelerated rendering. Although a large project my guesstimate is that OpenGL rendering was significantly less work than it would take to providing proper printing support. Faster rendering also affects an ever growing number of users, whereas the printing is declining.
Plenty of developers like us have a use for image diffs. Trying to get the same thing without direct support by Sublime Merge would pretty much require using a competing application which is a pretty big barrier for people looking to use our apps. In comparison the once in a super blood wolf moon that anyone I know ever needed to print out any code it’s almost as easy to fire up a word processor, note taking app or use a command line tool as it would be to print from Sublime Text directly.
There may be ways to “just send raw text to the printer” on some platforms, but I highly doubt anyone asking for printer support would be happy with the end result. If you’d really be happy with a “just send raw text to the printer” implementation for Linux, you can trivially write a build system that uses lpr
to send the current file to the printer.