[an error occurred while processing this directive]
|
unsigned char DrawChar(unsigned int SetX,unsigned int SetY,unsigned char Color,unsigned char c)
{
unsigned char FontHeight = Table_chars[3];
unsigned char FontBitsPixel= Table_chars[4];
unsigned char FontFirstChar= Table_chars[5];
unsigned char FontLastChar = Table_chars[6];
unsigned char charwidth;
unsigned char width;
unsigned int x ;
unsigned int y ;
unsigned char i;
unsigned int data_point;
unsigned char bitspixel = FontBitsPixel & 0x7F;
unsigned char bitsmask = 0xFF >> (8 - bitspixel);
unsigned int bits;
unsigned char bitscount;
unsigned long index = 0;
unsigned char table[4];
unsigned char padding ;
unsigned char pixelcount;
unsigned char pixelcolor;
bit clipinvalid;
unsigned int stopY;
unsigned int stopX;
unsigned char Colors[]={0,0x27,0xF0,0xE3,0x2F,0x58,0x4F,0xC7,0X07,0XE8,0X5F};
charwidth =Table_chars[7 + c - FontFirstChar];
if (charwidth == 0) {return(0);}
width = charwidth;
if (c < 128) {width++;}
x += width;
i = 0;
if (FontBitsPixel & 0x80) {
data_point =7 + FontLastChar - FontFirstChar +1;
padding = Table_chars[data_point++];
table[0] = 1;
table[1] = Table_chars[data_point++];
table[2] = Table_chars[data_point++];
table[3] = Table_chars[data_point++];
index = 0;
for (i = FontFirstChar; i < c; i++) {
index += Table_chars[data_point++];
}
index *= padding;
data_point =7 + (FontLastChar - FontFirstChar +3) * 2 + index;
bits = Table_chars[data_point++];
bitscount = 8;
} else {
data_point = *Table_chars + 7;
index = 0;
for (i = FontFirstChar; i < c; i++) {
index += Table_chars[data_point++];
}
index *= FontHeight * bitspixel;
bitscount = index % 8;
index /= 8;
data_point =Table_chars[7 + FontLastChar - FontFirstChar +1 + index];
bits = Table_chars[data_point++] >> bitscount;
bitscount = 8 - bitscount;
}
pixelcount = 0;
pixelcolor = 0;
clipinvalid = 1;
stopY =FontHeight -1;
stopX =charwidth -1;
for (x=0; x <= stopX; x++) {
for (y=0; y <= stopY; y++) {
if (pixelcount == 0) {
if (bitscount <= 8) {
bits |= Table_chars[data_point++] << bitscount;
bitscount += 8;
}
if (FontBitsPixel & 0x80) {
pixelcount = table[bits & 3];
bits >>= 2;
bitscount -= 2;
} else {
pixelcount++;
}
if (bitspixel < 2) {
if (bits & bitsmask) {pixelcolor = Color;} else{pixelcolor = 0;}
} else {
pixelcolor = Colors[bits & bitsmask];
}
bits >>= bitspixel;
bitscount -= bitspixel;
}
pixelcount--;
if ((pixelcolor !=0)) {
if (clipinvalid) {
clipinvalid = 0;
}
DrawPoint(SetX+x,(SetY + FontHeight -1)-y,pixelcolor);
} else { clipinvalid = 1; }
}
}
return(width);
}
E-mail: info@telesys.ru