Wednesday, July 19, 2023

7×13 Font?

This entry is an extension to a theme that I started from some time ago about bitmap fonts.

So, if you recall, I recently got ahold of Eileen-III. With her 2560×1600 resolution on a 16″ screen, using the 5×10 fonts is a great way to migraine central.

I had been using Unifont adjusted to be monospace-friendly set to scale down from the default 8×16 to 7×13 just so that I can have at least 81×2=162 horizontal characters under a half-screen set up (the math works out to be 1280/162∼7.9=7 pels per character width).

It worked fine, but man it looked ugly. This is generally true for regular vector fonts when we scale it down to the point the mechnical scaling/anti-aliasing starts to destroy the font due to how there is no good way for the text renderers to correctly position pixel-equivalents at pixel scale without losing contrast. When the width of a stroke is down to the width of a single pixel, contrast starts taking on a much outsized role, and that's why some of the best small/tiny fonts are hand-crafted instead of relying on auto-scaling via math.

And in this case, the Unifont version is just ugly.
Just look at it: broken 0 and }, X and Y are suddenly spouting umlauts, and all the glyphs that are supposed to be round at the x-height have a sharp corner or two.

Since I was sick of it, I started to look at the small stash of hand-crafted bitmap fonts that I had lying around. The 6×11 font looked pretty good for the display set up that Eileen-III had, but there was just not enough spacing in it. On a lower resolution (but with comparable physical dimensions) display, a single pixel space was adequate, but for the particular display that Eileen-III had, it was just too small.

So, starting with the 6×11, I expanded it to 7×13 by adding one more column of blank pixels on the left, thus centering all the glyphs (the original 6 pel width used only the first 5 pixel columns for the glyph art work), and added two more rows of blank pixels on the top. I then tweaked some of the oddities that I missed from the 6×11 font, including adjusting how my 6 and 9 look, as well as adjusting the positions of the different types of brackets/pseudo brackets to better fit the larger cell. I also adjusted the overall shape of the glyphs to better match my 5×10 font, in the sense that they looked much closer to how I would envision a good high-resolution super-scaling of my 5×10 font to 7×13 would look like. And here it is:
There are still some things that I could tweak more still, but I think it is excellent for now.

There was one negative side effect of using this 7×13 bitmap font instead of the weirdly scaled down Unifont---CJK characters under this font look much worse than that of Unifont. Unifont will scale its 16×16 CJK fonts to fit into 13×13, which looks remarkably good considering that its complexity meant that any form of approximation looked better than the approximation one saw with the simpler Latin-1 glyphs.

With this font, the CJK characters made the text renderer pull up some other fallback vector font, which again had weird (in this case, worse) scaling and contrast issues that made them illegible.

Is this a problem? Yes. Is this a big problem? Eh... not really. I don't usually need to operate on stuff with CJK when I'm using my ``optimised'' text mode---at that point I will literally pull out my full-scale Unifont set up instead (i.e. 8×16 for single characters, and 16×16 for CJK characters).

And that's it for this post. Till the next one then.

No comments: