Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: xernobyl on April 20, 2007
-
What's the smallest way to get a bitmap font in windows? There is a way to get the system font easily, right? Reading something in a strange place?
Maybe I should check some tiny intros.
-
A bitmap font.. I guess that one cheap way would be to have something up to 8 pixels wide per character and you could probably get away with about 5, 6 or 7 lines high.
You could draw the intro font in binary, line by line
eg;
//A
1,1,1,1,1,1,1,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,1,1,1,1,1,1,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
and convert each line of the font to a byte;
//A;
255,129,129,255,129,129,129
If you had a 5 line high font you could get away with 5 bytes per letter uncompressed which seems quite small, although it would look shit!
There are probably lots of better ways of doing this.
In some tiny stuff, I've noticed vector fonts being used, Gravity Theory uses one for example. http://www.intro-inferno.com/production.php?id=1267 (http://www.intro-inferno.com/production.php?id=1267)
That uses Opengl to load the font, but it's not a bitmap. Maybe the font could be loaded and then turned into a bitmap afterwards.
-
Using OpenGl, there are a lot of examples to do so ... have a look at this thread :
http://dbfinteractive.com/index.php?topic=1701.0 (http://dbfinteractive.com/index.php?topic=1701.0)
or go for a detailed description ( same steps basically ) to NeHe - Lession 13 :
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13)
-
Shockwave: With 36 chars (26 letters + 10 numbers) at 8x16 it will take 8x16*36/8 = 576 bytes... maybe it's not that hard to get a bitmap font from somewhere.
benny!: Using wgl font functions for the fonts gives you little flexibility to what you can do with the font... I wanted to do something more. :)
-
at 8x8 you could fit both lower and uppercase in the same 576 bytes and still have room for some puncuation and 8x8 would still be readable
-
3x5 can be made readable ;)
-
i usually stretch my fonts out i use 8x8 but inside my drawing routine i have an x and y for loop thats set to my size param ie
for y = ypos to ypos+size
drawpixel ypos
next
well thats just pesudo but you get the idea ;)
-
I gowith 8x8 aswell but thas becaus I already have a packed font done exacly how Shocky said above and I just dont really wanna go through al that again infact my font deosntn even have any punctutan too lazy
-
maybe 3x5 is the answer for me :)
(http://vt100.tarunz.org/zoom.font.gif)
That's probably good enough for what I have in mind... but there is a techinque used in tiny intros to use the system font, like in: http://www.pouet.net/prod.php?which=29656
-
That rebels intro is really good. 3X5 should be really small though.