Author Topic: cheap font in windows  (Read 4503 times)

0 Members and 1 Guest are viewing this topic.

Offline xernobyl

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
cheap font in windows
« 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.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: cheap font in windows
« Reply #1 on: April 20, 2007 »
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

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.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: cheap font in windows
« Reply #2 on: April 20, 2007 »
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

or go for a detailed description ( same steps basically ) to NeHe - Lession 13 :

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline xernobyl

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: cheap font in windows
« Reply #3 on: April 20, 2007 »
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. :)

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: cheap font in windows
« Reply #4 on: April 20, 2007 »
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

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: cheap font in windows
« Reply #5 on: April 20, 2007 »
3x5 can be made readable ;)
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: cheap font in windows
« Reply #6 on: April 20, 2007 »
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 ;)
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: cheap font in windows
« Reply #7 on: April 21, 2007 »
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

Challenge Trophies Won:

Offline xernobyl

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: cheap font in windows
« Reply #8 on: May 04, 2007 »
maybe 3x5 is the answer for me :)


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

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: cheap font in windows
« Reply #9 on: May 07, 2007 »
That rebels intro is really good. 3X5 should be really small though.
Shockwave ^ Codigos
Challenge Trophies Won: