Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: .:] Druid [:. on November 22, 2006

Title: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on November 22, 2006
Hello,
Sorry if it's dumb or been asked several times (I did not find any..) but I'm just wondering if there is an other way to create those:

data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,1,0,0,0,0

other than editing via notepad etc?

Thanks for your help!
Title: Re: A tool to create those "binaries" fonts?
Post by: Jim on November 22, 2006
Most people only use data statements if they want to avoid using external files.  Ideally you'd load your font from a bitmap - there are lots of tools for creating bitmaps from Windows fonts, for instance.

Jim
Title: Re: A tool to create those "binaries" fonts?
Post by: benny! on November 22, 2006
@Druid-tro:

Do you mean a tool for "drawing" fonts that outputs the final font in this data-structure
or do you mean a tool for converting e.g. system fonts to this way ?
Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on November 23, 2006
Benny,

Any of those.  If it cant be converted but can be drawn, I'll survive :)
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on November 23, 2006
I make mine the hard way :( The good thing is that if your font is say 8 pixels wide you can make each line fit into a byte if you can be arsed to do it which makes it really tiny in the exe :)
Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on November 25, 2006
Thanks for your answers...now, i'll add another question then :)

do you have some tuts about using drawed fonts?  also, i'd like to have the fonts included in the exe (bin2bas maybe?) , any hint is welcome

Many thanks in advance!
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on November 26, 2006
That wouldn't be too difficult to do. Have you managed to load a bitmap picture yourself yet?
Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on November 26, 2006
that's waht i'm working on lately to be honnest :)  It drives me crazy ... but it did not yell for help yet :)  Oki, I'll do that first then once it's done, i'll come back with those fotns questions ;)
Title: Re: A tool to create those "binaries" fonts?
Post by: Rbz on November 26, 2006
@Druid: to load a 256 color bitmap, there's an example source included with bmp2raw (http://dbfinteractive.com/index.php?topic=370.0), any problem, let me know!


Title: Re: A tool to create those "binaries" fonts?
Post by: rdc on November 26, 2006
For FreeBasic .17 there is a DrawFont command which is what I am using for some of my demos. You can get the info on the FB wiki. Jofers also wrote a little utility to convert TTF fonts to drawfont format. You can find a link on that on the FB forums. I have used it and it works quite well.

Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on November 26, 2006
@rbraz: thanks a LOT it works just like a charm !!! :)

@rdc: i'll give it a try, thanks mate!
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on November 26, 2006
Glad that you've got a picture loaded mate :)
Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on February 10, 2007
Sorry to bring that old post....but I finally managed to use bmp fonts! i'm coding an intro to use those new functions i'm writing.

If anyone is interrested I can put the code explaining how to import and use those fonts...just let me know in this post
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on February 10, 2007
:) That would earn you some Karma I am sure.

Here's a tip when you are using bitmap fonts.. Make sure that you set them out in ASCII order, for example;


!"#$%'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ


And you can then do the calculation;


ASC(MID(STRING,OFFSET,1))-31


To find your letter.. It's the fastest and most elegant way of coding it :)
Title: Re: A tool to create those "binaries" fonts?
Post by: Jim on February 10, 2007
Here's the one I use (src+exe) to generate the bmp fonts for my engine.
http://members.iinet.net.au/~jimshaw/Yabasic/makefont.zip (http://members.iinet.net.au/~jimshaw/Yabasic/makefont.zip)
You have to watch the bmps it spits out though, they're 24bit uncompressed.
The font I generated for the Blocks demo was 3.9Mb until I loaded it into another package and turned it into 8bit RLE BMP and then it came down to 90Kb.

Jim
Title: Re: A tool to create those "binaries" fonts?
Post by: .:] Druid [:. on February 11, 2007
really interresting tool Jim!  Thanks for sharing it!

Shockwave: thanks for the tip and it's how I managed to make it work...but I received some fonts, coming from intros, demos...and most of the time, it's not working as is...so, i use "ASC(MID(STRING,OFFSET,1))" without the -31 and by using a select  I make a ch-n ... working...
The good point of this: if the char is not supported, instead of putting a wrong char, you can select yourself the one you prefer to use...hmm..;by rereading i'm not sure i'm clear in the explanation :s  if it's the case, let me know ;)
Title: Re: A tool to create those "binaries" fonts?
Post by: Jim on March 02, 2009
Pixel Outlaw requested a version that does all the extra DOS characters, 128-255.  Here it is
http://members.iinet.net.au/~jimshaw/makefont256.zip (http://members.iinet.net.au/~jimshaw/makefont256.zip)

Jim
Title: Re: A tool to create those "binaries" fonts?
Post by: Pixel_Outlaw on March 02, 2009
It is a great update!


I'll probably use this more in the future!

EDIT

I just got the font I needed working. This is a great tool Jim.
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on March 02, 2009
Thanks Jim :)
Title: Re: A tool to create those "binaries" fonts?
Post by: Jim on March 03, 2009
It needs another screen up-front before I release it.  Right now if I want a variable width font on a blue background I just go into the source and change it.
3 things need selecting:
1) Fixed or Variable spacing
2) Background Colour
3) Width/Height of texture.  Right now, 256 wide by any height.  To allow gfx to be packed together vertically ;)  And the variable width code writes out the uv's in format known only to myself...

Jim
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on March 03, 2009
When it's finished it would be a good thing to add to the downloads section. I have a lot of things to put into it next time I update it, the font tool would be the only one of it's kind in our library.
Title: Re: A tool to create those "binaries" fonts?
Post by: Jim on March 04, 2009
I should think about that.  There're a raft of tools sitting in my website and source folders suffering from bit rot.

Jim
Title: Re: A tool to create those "binaries" fonts?
Post by: Shockwave on March 04, 2009
Better that someone gets some use of them :)