New games every week!
JSE - The Font Struggle Blog
21st May 2021
A couple of days ago, I figured I'd try out multiple fonts in the engine.

-=-=-



It "Almost" worked.
But it also didn't quite work at all.

The main issue is that not a single one of the "Retro System Fonts" that I could find online had the proper 32->255 sets of ascii characters.
Obviously, ASCII's come a long way since the early 80's, but you'd've thought font designers would've replaced the characters with their original representations for the sake of completion.
.. Guess not.

Additionally, having multiple web-fonts leads to multiple issues, with some fonts not wanting to download at the time, and caching or not-caching, and aargh!!

In addition to that, for reasons unknown, every single system font I could find seemed to have a completely different base size, when asked to draw at Font Size 8.
That's no good!!
You'd think, if they're all based on an 8x8 grid of pixels, that they'd all look the same when printed at 8pt. But.. No..
Bah, humbug..

So, what to do?
I sat wondering about this for most of Wednesday, before deciding yesterday that I was going to end up going the long way 'round.

First, I got a screenshot of the Amstrad CPC's font.
I typed...
For n=32 to 255 : Print Chr$(n) : Next
... into the emulated basic, and then took a Screenshot!
Easy!

Next, I wrote a PHP script to find pixels and turn them into blocks, then write those blocks as a path in an .SVG formatted Font.
I took that .SVG font, uploaded it to This Font Converter Site and got it to generate a .woff2 version.
Then I added that into the engine, and .. Bob's your uncle.



The complete font, as it originally was, pixel for pixel.. ('ish,.. It's missing one pixel, see if you can spot it, and the final character's gone because the for-loop of the converter runs n=0;n<255;n++, since apparently I've forgotten how for-loops work outside of BASIC!!)

They display at the correct size, working within a monospaced font grid, and since they're "Proper fonts", they'll scale to whatever size you want, too.

As a side-effect of the wonderful FontConverter site, I'm also getting a nice .ttf font, too, which I'll happily pop onto the site once everything's done.

The next stage is to go through all the systems that I'd like to steal the fonts from, write similar character displaying routines, screenshot pixel-for-pixel, and run them through the php script.

The php script is actually set up to render a whole bunch of these into a single font file. Starting at character 1032-1255, with the next font at 2032-2255, and so on.
I then need to rewrite the Text function so that it converts your string into the right set of Chrs, which .. might be tricky..
But hopefully by the time I'm done, everything should be working with one single font file.
I will, of course, be restricting the .ttf fonts to standard 32-255 ascii chrs, because.. Well, it'd be silly not to! And I'll upload them all to the site as .ttf's once I'm done, so you can grab and play.

Right, that's today's task. Screenshots.
And I'm going to be using Windows for that, because MacOS emulators are still a struggle... Be it because of the M1 switch, or simply because Emu-Dev's tend not to do it on Macs!
There's also the whole "Retina displays scale everything up, and end up making the screenshots a bit blurry" thing, too.

So, the old Windows laptop's been on charge all night, and I'm ready for screenshotting.

Wish me luck!!
Views 96, Upvotes 19  
Daily Blog , Jse , Fonts
New games every week!
Site credits : PHP script, Blog posts, Games, Music, Pixelart, Poems and More : Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed 78

Blog - JSE - The Font Struggle - AGameAWeek