New Non Fixed Width font loader works woohoo

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

New Non Fixed Width font loader works woohoo

Post by Asimov » July 7th, 2012, 3:16 pm

HI all,

Well I wrote a routine for loading non fixed width fonts and that works nice.
It work by having a purple pixel dividing each letter. The wider the purple pixel the closer together the letters are. The purple colour is 255,0,255.

Hey now that works well and would work for any font.

The trouble came when I wanted to do a fixed width font system. I wanted to again write the font all in one line. My program divides the total width/total characters and that works out the width of each letter. However when run it is almost readable, but not quite.

Now I am wondering if it was the way I created it in photoshop, or a fault with my program. The problem is that when you type out a font in photoshop it is very hard to crop it to the right size. If it is even slightly cropped to the wrong size the above formula won't work.

Anyway here is my font program for you to laugh at heh heh.
I am writing it for the missile command program, but I want it usable later in other projects. Which is why I am making it work for non fixed width and fixed width.

Asimov
Last edited by Asimov on July 7th, 2012, 5:57 pm, edited 1 time in total.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: New Non Fixed Width font loader works woohoo

Post by chili » July 7th, 2012, 3:24 pm

It looks like there are a few artifacts in the variable-width font too. Nothing major but you might want to fix them. Looks nice though. ;)
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: New Non Fixed Width font loader works woohoo

Post by Asimov » July 7th, 2012, 4:10 pm

Hi Chilli,
It looks like there are a few artifacts in the variable-width font too. Nothing major but you might want to fix them. Looks nice though
The program is ok, it's where I put the purple dots in. I think some are overlapping. Easy to sort out when I got time.

EDIT: since typing this I perfected it. There was nothing wrong with my fixed width part of the program. The problem was cropping the text to the right size in photoshop. I actually used a program called 'bitmap font builder' in the end. Making the variable sized fonts or the fixedwidth font is quite tedious in photoshop. Thinking of writing a program which can do it, but there is the problem. The program would need to load the font in, and if I could do that I wouldn't need the program LOL.

Anyway here is the update. I am hoping to be able to make this procedure more automatic later.

Asimov
Attachments
Font.zip
(1.46 MiB) Downloaded 154 times
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: New Non Fixed Width font loader works woohoo

Post by Asimov » July 7th, 2012, 6:32 pm

Hi all,

Just had a good find. This free program lets you arrange your sprites into a png. Haven't had time to play with it yet, but I believe it will speed up the font sprite creation process.

http://www.nubik.com/SpriteFont/

Anyway this program saves out the font in the attached format. Then all I have to do is to crop off the top and bottom in photoshop and the font is ready to use.

Now I designed the progam to remove the purple from the top line, but I didn't design it to remove the rest, but as you can see it is fully working, and I can make a fontsheet in 2 minutes flat.

Asimov
Attachments
thickfontweb.png
thickfontweb.png (7.22 KiB) Viewed 2540 times
testfontweb.png
This is my current output. Just need too add a little more code to take out all the lines and I am away.
testfontweb.png (69.56 KiB) Viewed 2542 times
Last edited by Asimov on July 7th, 2012, 10:23 pm, edited 1 time in total.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: New Non Fixed Width font loader works woohoo

Post by Asimov » July 7th, 2012, 10:22 pm

Hi all,

Well Since my last post I have improved my font program. I have removed the fixedwidth function because now it is not necessary. My LoadFont class will do both in the same routine.
It doesn't even need editing in photoshop anymore. My program will load the output from spritefont program you can get from the link above. the LoadFont class will autocrop the font and display it.

The first font I created took about an hour and I didn't get it working right in photoshop. By the time I got it to display took about 2 hours.

Now I just did a test. I used spritefont to make 3 fonts and within 10minutes I had 3 fonts in my program.
I have added my font program for you to test. Ok yes it is part of my missile command program but it is easy for you to see what is going on.

Once output from spritefont the class will do fixedwidth or variable. It does not matter.

Asimov
Attachments
fontbox.png
Here is the output in the program
fontbox.png (107.3 KiB) Viewed 2540 times
thickfontweb.png
This is the output from spritefont. This is all my program needs to run the sprite
thickfontweb.png (7.22 KiB) Viewed 2540 times
Font2.zip
(1.59 MiB) Downloaded 153 times
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: New Non Fixed Width font loader works woohoo

Post by chili » July 8th, 2012, 3:03 am

Looks like you got a good system worked out there Asimov. The fonts look sexy. Nice job on finding a utility to do the work for you too. This system will probably tide you over until we get to D3DX fonts.
Chili

Post Reply