Author Topic: bmp to binary font converter[BB2D]  (Read 3218 times)

0 Members and 1 Guest are viewing this topic.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
bmp to binary font converter[BB2D]
« on: June 01, 2007 »
here is a bmp to binary font converter written for myself but if its usefull please feel free to use it.

basically this spits out binary files that can be used in almost any basic languge.

Code: [Select]
;to be filled by user
;------------------------------
filename$ = ""

CharWidth =
CharHeight =
NoChars =
;------------------------------
 
Graphics 640,480,16,2

Global ArialBlack = LoadAnimImage(filename$,CharWidth,CharHeight,0,NoChars)


filein = WriteFile( filename$+".bi" )

WriteLine(filein,"BinaryFont:")
WriteLine(filein,"")

For z = 0 To NoChars - 1
Cls
DrawImage ArialBlack,0,0,z
Flip
WriteLine(filein,"'Rem "+Chr$(32+z))
For h = 0 To CharHeight - 1
    temp$ = ""
    For w = 0 To CharWidth - 1
GetColor(w,h)
        red=ColorRed()
        red=red Shl 16

        green=ColorGreen()
        green=green Shl 8

          blue=ColorBlue()

        red_green_blue=red Or green Or blue

            If red_green_blue Then
            temp$ = temp$ + "1"
            Else
                temp$ = temp$ + "0"
            EndIf

          If w = CharWidth - 1 Then
            Else
          temp$ = temp$ + ","
        EndIf
    Next
        WriteLine(filein,"data "+temp$)
    Next
    WriteLine(filein,"")
Next
CloseFile(filein)
End

when this is used in conjunction with jims program from here any system font of any size can be converted to binary.
http://dbfinteractive.com/index.php?topic=1701.0
« Last Edit: July 21, 2007 by Shockwave »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: bmp to binary font converter[BB2D]
« Reply #1 on: July 08, 2008 »
Very usefull indeed, nice one Nino. 8)

Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1389
  • Karma: 84
    • View Profile
Re: bmp to binary font converter[BB2D]
« Reply #2 on: July 08, 2008 »
This will prove to be very usefull!
Have some karma.
Challenge Trophies Won: