Main Menu

News:

LINKS: Website | Steam | Wiki

How to create a custom font?

Started by mbartelsm, October 06, 2016, 02:47:23 PM

Previous topic - Next topic

mbartelsm

I've tried making a custom font for the Armstrad CPC, but all characters are inverted (foreground draws on the background) how do I fix this, I tried inverting the colors but nothing changed.

Kyzrati

#1
Ah, the font reader uses the pixel at 0,0 (the top left corner) to determine what the background color is for the rest of the font bitmap (because technically bitmaps can use either a black or white background color as desired by the creator), so the problem here is that first character actually uses the upper leftmost pixel. That pixel must be black to detect fonts correctly.

I'll add that bit to the manual.

Edit: If you like I could also add a cfg option to override this setting. It's nice that it's usually handled automagically, but sometimes there are special circumstances like this font.
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

mbartelsm


Kyzrati

Alrighty, I'm in crunch time working on an upcoming new Cogmind release, so this'll have to wait until after that's out. I'll get to it next week!
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

gumix

I'd also consider switching from upper left (chr 00h) pixel test to the space character (20h) area.

Kyzrati

I considered that approach, but technically CP437's top left character is already empty, and not everyone uses CP437 anyway (the "font" can use arbitrary characters, or even sprites), so we won't really know where "space" is located!
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

gumix

Yep, right. It is more tricky in case of no CP related sprite sheets.  :-X

Kyzrati

#7
mbartelsm: Alrighty, got a patch for your new feature there. Just drop in this exe, run REXPaint once, then close it. (Edit: Feature now included with v1.04) It'll create a new entry in the cfg, fontKeyColorOverride, where you can force the background color to be anything you want instead of using the automated detection. In your case just set the RGB values to 0,0,0!
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon