• Welcome to Dark Bit Factory & Gravity.
 

bmp to binary font converter[BB2D]

Started by ninogenio, June 01, 2007

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

ninogenio

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.


;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
Challenge Trophies Won:

Clyde

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:

Pixel_Outlaw

This will prove to be very usefull!
Have some karma.
Challenge Trophies Won: