Text should be easy
At this point, I’m not too worried about adding new instructions to my 8-bit machine; that’s going to be the easy part. I need a better user interface, though, and that means worrying about rendering. In particular, text rendering.
Rendering text
If you want to do text rendering properly, well, then you do it properly! Oh sorry, don’t know why I got mean there all of a sudden. If you want to do text rendering properly, then you need to worry about text size and resolution independence. You see, on easy mode, you take a bitmap of a bunch of characters and then you cut and paste those characters to create your text. The downside of this method is, that showing the text on any size other than the original bitmap, is going to look bad. Since screens have different sizes and different resolutions, going with only one font size is really going to hurt the user experience.
On hard mode, you use a scalable font. These are the fonts you are used to: the Arials and Helveticas of this world. They usually come in the TrueType or OpenType file format and these formats describe each letter as a series of lines and curves. This makes them infinitely scalable.
It also makes them much more difficult to render, since you now need to figure out a way to turn those lines and curves into pixels, because in the end, everything you render needs to be pixels.
A temporary solution
Progress is more important to me right now than perfection, so I’m looking for a solution that I can implement relatively quickly. SDL is a proven library for cross-platform graphics and sound and a whole lot more. It’s pure C, so it will fit in with my current code nicely, and it comes with an extension that can render TrueType fonts. Sure, it’s overkill, but I can replace it with something leaner later on, if that’s what I want. For now it’s the simplest option.
Except I forgot what a nightmare cross-platform C libraries can be. The nice folks who created SDL do their best to make it as easy as possible and this is what as easy as possible looks like. It’s not that I don’t want to take the trouble to get this up and running on the platforms I care about, but I worry about making my project hard to build for others. If you want to play around with the source code, you shouldn’t have to fiddle around with the build system for six hours. I know that few C projects succeed in providing a trouble-free build, but that doesn’t mean I shouldn’t try.
So, where does that leave me? Other third party solutions have the same problem and they are less suited to my needs anyway. I could move away from C, but to what? C# with WinForms or WPF is a possibility. So is Electron. That’s a pretty big shift, though, and right now, I just want to iterate on what I have.
What’s the simplest thing I can do? Well, I know how to render bitmap fonts. Yeah, that’s fine for the stage I’m at. Only challenge is, I’ve never written a renderer for Mac before. I’ve been meaning to, but never had a pressing reason to do so.
Until now!