Hi! I want to do something with pixel fonts. I found some font data in this form:
DW 0x00,0x00,0x00,0x00,0x00,0x00 ;
DW 0x10,0xE3,0x84,0x10,0x01,0x00 ; !
DW 0x6D,0xB4,0x80,0x00,0x00,0x00 ; "
DW 0x00,0xA7,0xCA,0x29,0xF2,0x80 ; #
DW 0x20,0xE4,0x0C,0x09,0xC1,0x00 ; $
DW 0x65,0x90,0x84,0x21,0x34,0xC0 ; %
DW 0x21,0x45,0x08,0x55,0x23,0x40 ; &
DW 0x30,0xC2,0x00,0x00,0x00,0x00 ; '
DW 0x10,0x82,0x08,0x20,0x81,0x00 ; (
DW 0x20,0x41,0x04,0x10,0x42,0x00 ; )
DW 0x00,0xA3,0x9F,0x38,0xA0,0x00 ; *
DW 0x00,0x41,0x1F,0x10,0x40,0x00 ; +
DW 0x00,0x00,0x00,0x00,0xC3,0x08 ; ,
DW 0x00,0x00,0x1F,0x00,0x00,0x00 ; -
DW 0x00,0x00,0x00,0x00,0xC3,0x00 ; .
DW 0x00,0x10,0x84,0x21,0x00,0x00 ; /
DW 0x39,0x14,0xD5,0x65,0x13,0x80 ; 0
DW 0x10,0xC1,0x04,0x10,0x43,0x80 ; 1
DW 0x39,0x10,0x46,0x21,0x07,0xC0 ; 2
DW 0x39,0x10,0x4E,0x05,0x13,0x80 ; 3
DW 0x08,0x62,0x92,0x7C,0x20,0x80 ; 4
DW 0x7D,0x04,0x1E,0x05,0x13,0x80 ; 5
DW 0x18,0x84,0x1E,0x45,0x13,0x80 ; 6
DW 0x7C,0x10,0x84,0x20,0x82,0x00 ; 7
...
after clean up and conversion to int/binary i got this data (which, according to 1s and 0s i’s nothing like the font):
space (this is right :)
00000000|0
00000000|0
00000000|0
00000000|0
00000000|0
00000000|0
this should be "!"
00010000|16
11100011|227
10000100|132
00010000|16
00000001|1
00000000|0
"
01101101|109
10110100|180
10000000|128
00000000|0
00000000|0
00000000|0
#
00000000|0
10100111|167
11001010|202
00101001|41
11110010|242
10000000|128
$
00100000|32
11100100|228
00001100|12
00001001|9
11000001|193
00000000|0
%
01100101|101
10010000|144
10000100|132
00100001|33
00110100|52
11000000|192
&
00100001|33
01000101|69
00001000|8
01010101|85
00100011|35
01000000|64
'
00110000|48
11000010|194
00000000|0
00000000|0
00000000|0
00000000|0
(
00010000|16
10000010|130
00001000|8
00100000|32
10000001|129
00000000|0
...
Here is the data file:
http://www.piclist.com/techref/datafile/charset/extractor/font6x8pic8.asm.txt
What am i doing wrong?
here is the code for conversion:
public class ConvertHexToBinary : MonoBehaviour
{
public TextAsset Data;
void Start ()
{
var lines = Data.text.Split("\n"[0]);
foreach (var line in lines)
{
var data = line.Split("|"[0]);
for (int index = 0; index < data.Length; index++)
{
if(index == 6) continue; //skip char
var int16 = Convert.ToInt16(data[index], 16);
Debug.Log(NGUIMath.IntToBinary(int16,8) + "|" + int16);
}
}
}
}