Grid Sage Forums

Grid Sage Forums

  • March 23, 2017, 08:12:41 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Grid Sage Wiki Now Open

Author Topic: How to create a custom font?  (Read 207 times)

mbartelsm

  • Unaware
  • *
  • Posts: 3
    • View Profile
How to create a custom font?
« 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.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 2281
    • View Profile
    • Cogmind
Re: How to create a custom font?
« Reply #1 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.
« Last Edit: October 06, 2016, 07:31:34 PM by Kyzrati »
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames

mbartelsm

  • Unaware
  • *
  • Posts: 3
    • View Profile
Re: How to create a custom font?
« Reply #2 on: October 06, 2016, 07:38:54 PM »

That'd be awesome! thanks
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 2281
    • View Profile
    • Cogmind
Re: How to create a custom font?
« Reply #3 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!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames

gumix

  • Derelict
  • **
  • Posts: 64
    • View Profile
Re: How to create a custom font?
« Reply #4 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.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 2281
    • View Profile
    • Cogmind
Re: How to create a custom font?
« Reply #5 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!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames

gumix

  • Derelict
  • **
  • Posts: 64
    • View Profile
Re: How to create a custom font?
« Reply #6 on: October 09, 2016, 01:23:41 AM »

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

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 2281
    • View Profile
    • Cogmind
Re: How to create a custom font?
« Reply #7 on: October 13, 2016, 08:44:33 PM »

mbartelsm: Alrighty, got a patch for your new feature there. Just drop in this exe, run REXPaint once, then close it. 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!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames