Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Blitz => Topic started by: ninogenio on June 01, 2007

Title: bmp to binary font converter[BB2D]
Post by: ninogenio 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
Title: Re: bmp to binary font converter[BB2D]
Post by: Clyde on July 08, 2008
Very usefull indeed, nice one Nino. 8)

Cheers,
Clyde.
Title: Re: bmp to binary font converter[BB2D]
Post by: Pixel_Outlaw on July 08, 2008
This will prove to be very usefull!
Have some karma.