Grid Sage Forums

REXPaint => Everything REXPaint => Topic started by: mbartelsm on October 06, 2016, 02:47:23 PM

Title: How to create a custom font?
Post by: mbartelsm on October 06, 2016, 02:47:23 PM
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.
Title: Re: How to create a custom font?
Post by: Kyzrati on October 06, 2016, 06:51:06 PM
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.
Title: Re: How to create a custom font?
Post by: mbartelsm on October 06, 2016, 07:38:54 PM
That'd be awesome! thanks
Title: Re: How to create a custom font?
Post by: Kyzrati on October 06, 2016, 07:42:41 PM
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!
Title: Re: How to create a custom font?
Post by: gumix on October 08, 2016, 02:23:25 PM
I'd also consider switching from upper left (chr 00h) pixel test to the space character (20h) area.
Title: Re: How to create a custom font?
Post by: Kyzrati on October 08, 2016, 06:58:30 PM
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!
Title: Re: How to create a custom font?
Post by: gumix on October 09, 2016, 01:23:41 AM
Yep, right. It is more tricky in case of no CP related sprite sheets.  :-X
Title: Re: How to create a custom font?
Post by: Kyzrati on October 13, 2016, 08:44:33 PM
mbartelsm: Alrighty, got a patch for your new feature there. Just drop in this exe (http://www.gridsagegames.com/blogs/fileDownload.php?fileName=REXPaint-v1.03_color_patch.zip), 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!