Fonts

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

Here are a few font images/resources which I've used in the past.

This is 'Glacier Belle' - a 3x10 font I designed for the PlusCart.
The name is an anagram of "clear legible", and this is perhaps my favourite '2600 font. It's particularly nice given the 3-pixel width.

crt_composite_PlusCart_20240106_203445.jpg

Captain Morgan Spice
crt_composite_CaptainMorganSpice_20240106_205054.jpg

Trichotomic-12
crt_composite_Trichotomic-12_20240106_205009.jpg




Andrew Davie

#1
This is the font used in Boulder Dash, an 8 x 10 size.

const unsigned char charAtoZ[] = {

    __XXX___,
    _XXXXX__,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,

    XXXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXX__,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXX__,

    __XXXXX_,
    _XXXXXX_,
    XXXX____,
    XXX_____,
    XXX_____,
    XXX_____,
    XXXX____,
    XXXXXXX_,
    _XXXXXX_,
    __XXXXX_,

    XXXXX___,
    XXXXXX__,
    XXX_XXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXX__,

    XXXXXXX_,
    XXXXXXX_,
    XXX_____,
    XXXXX___,
    XXXXX___,
    XXX_____,
    XXX_____,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,

    XXXXXXX_,
    XXXXXXX_,
    XXX_____,
    XXX_____,
    XXXXX___,
    XXXXX___,
    XXXXX___,
    XXX_____,
    XXX_____,
    XXX_____,

    __XXXXX_,
    _XXXXXX_,
    XXXX____,
    XXX_XXX_,
    XXX_XXX_,
    XXX__XX_,
    XXXX_XX_,
    XXXXXXX_,
    _XXXXXX_,
    __XXXXX_,

    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,

    _XXXXX__,
    _XXXXX__,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    _XXXXX__,
    _XXXXX__,
    _XXXXX__,

    ____XXX_,
    ____XXX_,
    ____XXX_,
    ____XXX_,
    ____XXX_,
    ____XXX_,
    XXX_XXX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    XXX___X_,
    XXX__XX_,
    XXX_XXX_,
    XXXXXX__,
    XXXXX___,
    XXXXX___,
    XXXXXX__,
    XXXXXXX_,
    XXX_XXX_,
    XXX__XX_,

    XXX_____,
    XXX_____,
    XXX_____,
    XXX_____,
    XXX_____,
    XXX_____,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,

    XX___XX_,
    XXX_XXX_,
    XXXXXXX_,
    XXXXXXX_,
    XX_X_XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,

    XX___XX_,
    XXX__XX_,
    XXXX_XX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,
    XX_XXXX_,
    XXX_XXX_,
    XXX__XX_,
    XXX__XX_,

    _XXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    XXXXX___,
    XXXXXX__,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXX__,
    XXX_____,
    XXX_____,
    XXX_____,

    _XXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX_XXX_,
    XXXXXX__,
    XXXXXXXX,
    _XXX_XXX,

    XXXXX___,
    XXXXXX__,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXX__,
    XXXXX___,
    XXXXXX__,
    XXX_XXX_,
    XXX__XX_,

    __XXXXX_,
    _XXXXXX_,
    XXXX____,
    XXXX____,
    XXXXXX__,
    _XXXXXX_,
    ___XXXX_,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXX__,

    XXXXXXX_,
    XXXXXXX_,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,

    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    _XXXXXX_,
    __XXXX__,

    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    _XXXXX__,
    _XXXXX__,
    _XXXXX__,
    __XXX___,
    __XXX___,

    XXX___XX,
    XXX___XX,
    XXX___XX,
    XXX___XX,
    XXX___XX,
    XXX_X_XX,
    XXXXXXXX,
    XXXXXXXX,
    XXXX_XXX,
    XXX___XX,

    XXX__XX_,
    XXX__XX_,
    XXX_XXX_,
    XXXXXX__,
    _XXXX___,
    __XXXX__,
    _XXXXXX_,
    XXX_XXX_,
    XX__XXX_,
    XX__XXX_,

    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    _XXXXX__,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,

    XXXXXXX_,
    XXXXXXX_,
    ____XXX_,
    ___XXXX_,
    __XXXX__,
    _XXXX___,
    XXXX____,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,

    _XXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    ___XX___,
    __XXX___,
    __XXX___,
    __XXX___,
    ___XX___,
    ___XX___,
    ___XX___,
    __XXXX__,
    __XXXX__,
    __XXXX__,

    _XXXXX__,
    XXXXXXX_,
    XXX_XXX_,
    ____XXX_,
    ___XXX__,
    __XXX___,
    _XXX____,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,

    XXXXXXX_,
    XXXXXXX_,
    ____XXX_,
    ___XXX__,
    __XXXX__,
    ____XXX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    ___XXX__,
    __XXXX__,
    _XXXXX__,
    XXX_XX__,
    XX__XX__,
    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,
    ____XX__,
    ____XX__,

    XXXXXXX_,
    XXXXXXX_,
    XXX_____,
    XXXXXX__,
    XXXXXXX_,
    _____XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    _XXXXX__,
    XXXXXX__,
    XXX_____,
    XXX_____,
    XXXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    XXXXXXX_,
    XXXXXXX_,
    XXXXXXX_,
    ____XXX_,
    ___XXX__,
    ___XXX__,
    __XXX___,
    __XXX___,
    __XXX___,
    __XXX___,

    _XXXXX__,
    XXXXXXX_,
    XXX__XX_,
    _XXXXX__,
    XXXXXXX_,
    XXX__XX_,
    XXX__XX_,
    XXXXXXX_,
    XXXXXXX_,
    _XXXXX__,

    _XXXXX__,
    XXXXXXX_,
    XX__XXX_,
    XX__XXX_,
    XX__XXX_,
    XXXXXXX_,
    _XXXXXX_,
    ____XXX_,
    _XXXXX__,
    _XXXX___,

    __XXXX__,
    _X____X_,
    X_XXX__X,
    X_X__X_X,
    X_X__X_X,
    X_XXX__X,
    X_X_X__X,
    X_X__X_X,
    _X____X_,
    __XXXX__,
};



JetSetIlly

I'd like to see a proportionally spaced version of Glacier Belle for use in my rough port of Adventureland. https://github.com/JetSetIlly/Adventureland-2600.

The 2600 side of the font renderer isn't great and needs some more work so that it uses the full width of the screen, but apart from that it's okay I think.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Thomas Jentzsch

If you want to make your proportional font look really good, you might want to add some basic kerning.

JetSetIlly

#4
There is some basic kerning in there. I've not spent a lot of time on it but the principle is in there. The 'T' and 'e' in "Tell" on the last line is a good example. However, when I tried it with, for example, 't' and 'r' in "trees" the results weren't good.

It might be more successful with Glacier Belle though.

edit:

The 't'  and 'o' of "to" have been moved together also. That looks okay I think
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

#5
WenHop has a few fonts and a proportional-draw system. I thought I'd dump the font graphics here in case they're useful to anyone. The red pixels are kind of spacers/placeholders. I use a tool to parse the image and separate out each character and create a c-structure/header of the font data.

Files:
image files are the three fonts I use. Note, the spacing is unimportant, so long as there is a clear vertical blank (any size) between each character. I haven't defined all the chars, so some are wonky/placeholders.  A red pixel (or block) can be used as a placeholder.  The red pixels are also used to guarantee characters are a certain width -- the red effectively increases the width of the character, but does not appear in the shape data itself.

alphanumeric.py - the python conversion program (accepts most image formats)
make.sh - sample usage/calls to process the font files
fontcompact.c/h - output from alphanumeric on fontcompact.png after running make.sh

Note the screenshot, which shows some of the output structures with emoji comments for awesomeness!

Andrew Davie

Here's my proportional string draw. First: usage...

drawString(FONT_COMPACT, 0x16, 10, _BUF_COPYRIGHT_GRP, _BUF_COPYRIGHT_COLUP0, "=presents", 120);

That sets up a draw, which can happen asyncronously. Note the third parameter is a delay bewteen characters. The string "=presents" is parsed for formatting characters.

= means center from here onwards
< means left-justify from here onwards
> means right justify from here onwards
_ means underline on/off toggle  "_this_ is underlined" will underline the word "this"
} means new paragraph
| means new line
% start open quote (single)
& close open quote (single)
" start open quote (double)
# close open quote (double)

The above can be escaped to show the actual character instead of the parsed result
\}  == display a close curly brace instead of a new paragraph

Every frame, to output a character (if the delay makes it due)...

drawNextChar();

That is all you need to fully draw a string (over multiple frames). Or if you want to draw the entire string instantly, here's an example...

drawString(FONT_STANDARD, 0x16, 10, _BUF_COPYRIGHT_GRP, _BUF_COPYRIGHT_COLUP0, "=INCREDIBLE", 70);
while (drawNextChar());

drawNextChar() returns true if there's more to draw.

Code buried (and other stuff) inside the draw.c file. You really just want drawString(...) and drawNextChar(...).  Note, drawString() is passed a pointer to the character set created by alphanumeric.py mentioned in the previous post.

It uses the character spacing for the font ALSO produced by alphanumeric.py. This contains font widths, and character shapes.  The kerning is in the table justifyChar, which flags each character for spacing adjustments left/right. For example, the lowercase 'r' (and quite a few other) characters space the next character one pixel closer (dropping the trailing single-pixel separator).





Andrew Davie

#7
Sample output, compact font.  Note the proportional spacing and kerning.
Kerning in the T of "The" (right side), and all the "e" (right side), and all the "t" (left side).