Page 1 of 1

Editing FNT (fonts) files Video Tutorial [80% done]

PostPosted: 31 Mar 2009, 16:37
by Greninho
Editing FNT (fonts) files Video Tutorial

http://cleyton.110mb.com/Tutorial/
(Made with flash, 400kb~)
I think it will help someone to edit fnt files or to create a program to edit fnt file.

PostPosted: 31 Mar 2009, 22:29
by harold
I tried to write an editor for it but quickly found that letting the user draw is a biotch. If I make it a Paint.NET filetype plugin, would that be OK with everyone?

edit: progress update, loading now works
edit: non-progress, ok this is isn't going to work either. I think I'll just add fnt loading to the graphics editor and you will just have to edit the letters separately.

PostPosted: 15 Jul 2009, 18:46
by Krom
Why don't just export all 256 letters to bmp and let user use MSPaint, then just pack all 256 bmps back into fnt - that should work good enough and easy to code :)

PostPosted: 15 Jul 2009, 19:08
by harold
It's not easy, how can you tell the bounds of the letter? Dynamic programming of "best distribution of 256 rectangles that encompass all opaque pixels and the least possible number of transparent pixels" or something like that? (can that even be done with dynamic programming?)
It just kinda sucks. Exporting 256 bitmaps would be easy, but that causes major suckage for the editor..

PostPosted: 15 Jul 2009, 19:28
by Krom
Why do the distribution? Just make all letterboxes the same size :wink: we don't need optimization for 256 boxes, are we?

Actualy thats an idea: export 1 bmp with fixed size letter boxes (e.g. specified at export stage). User will specify size he wants to draw into (32x16 should be quite enough). Find maximum required sizes when packing everything back to fnt and stack all letters (remove transparent pixels on sides and bottom).

P.S. The reason I bump the topic - we add multilang to Remake and some fonts (Russian to be specific) are way off standard. Besides we could add new Greek/Brazil locales if we had the fonts as well. I would've coded the font tool, but I'm too busy with Remake.

PostPosted: 15 Jul 2009, 20:17
by harold
With the boxes all the same size, you wouldn't have the required width information (the height doesn't matter)

PostPosted: 15 Jul 2009, 20:28
by Krom
Width = width_of_all_non-transparent_pixels.
You can define one color as invisible in KaM, but visible in BMP, e.g. #FE
When packing back to fnt you set it to be transparent and include its pixels into width calculation. Do you get my idea?

PostPosted: 15 Jul 2009, 20:59
by harold
Hm. might work. But I'm not sure the width is always exactly that (esp. in the case of a comma or | etc)?

PostPosted: 16 Jul 2009, 05:07
by Krom
Thats why I suggest this example:

OOTTTOOO
OOTTTOOO
OOTXTOOO
OOTXTOOO
OOTXTOOO
OOTXTOOO
OOTXTOOO
OOTXTOOO

See, X is where | symbol is, T means transparent pixels in fnt file which are also forming character area (height offset), O are transparent pixels forming uniform cell and not used in width/height calculation. Chat width is 3, height is 8, but 3 upper pixels will be transparent ingame.

PostPosted: 16 Jul 2009, 16:39
by harold
So you'd have 2 types of transparent pixels? Ok I think I get it now, that should work

PostPosted: 16 Jul 2009, 16:51
by Krom
Exactly :)

PostPosted: 19 Mar 2010, 13:12
by Krom
We've made such Font Editor with Lewin :)
Does anyone wants to test it?

PostPosted: 19 Mar 2010, 21:23
by Litude
Sounds great, I think I could give it a spin :wink:

PostPosted: 23 Mar 2010, 02:58
by Greninho
wow!! Great *--* I want test if possible