改为通用库 16点阵汉字库,包含额外ASCII 16点阵字库
需要额外的显示代码
void DrawChar(int x, int y, int w, int h, const uint8_t* data)
{
for (int yy = 0; yy < h; yy++)
{
for (int xx = 0; xx < w; xx++)
{
int index = yy * w + xx;
LCD_DrawPixel(x + xx, y + yy, (data[index >> 3] & (0x80 >> (index & 7))) ? crText : crTextBk);
}
}
}
void LCD_Write(int x, int y, const char* text, size_t len)
{
Artint_HZK::BITMAPFONT font = {0};
for (size_t i = 0; i < len;)
{
if (*text == '\0')
{
return;
}
int8_t L = Artint_HZK::hzk16.Query(text, len - i, &font);
if (L <= 0)
{
i++;
text++;
continue;
}
DrawChar(x, y, font.width, font.height, font.data);
text += L;
i += L;
x += font.width;
if (x + 16 >= LCD_W)
{
x = 0;
y += font.height;
if (y >= LCD_H)
{
return;
}
}
}
}