mirror of
https://github.com/stasenso/rp_pico_test.git
synced 2026-06-26 21:42:44 +03:00
Font conversion has been improved
This commit is contained in:
+17
-6
@@ -4,9 +4,11 @@
|
||||
#include "DrawBezier.h"
|
||||
|
||||
|
||||
const uint16_t font_width = 704;
|
||||
const uint16_t font_height = 242;
|
||||
const uint8_t font_data[] = {
|
||||
const uint16_t image_linear_width = 704;
|
||||
const uint8_t char_width = 22;
|
||||
const uint8_t char_height = 22;
|
||||
const uint16_t total_chars = 352;
|
||||
const uint8_t image_data[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -259,7 +261,7 @@ void draw_char(uint8_t x, uint8_t y, char c) {
|
||||
|
||||
// Определяем смещение символа в массиве
|
||||
if (c >= 32 && c <= 127) { // ASCII символы
|
||||
offset = (c - 32) * char_height;
|
||||
offset = ((c - 32) * char_height/8);
|
||||
} else if (c >= 0x0400 && c <= 0x04FF) { // Кириллица
|
||||
offset = (c - 0x0400 + 113) * char_height; // 96 - сдвиг для ASCII
|
||||
} else {
|
||||
@@ -267,12 +269,21 @@ void draw_char(uint8_t x, uint8_t y, char c) {
|
||||
}
|
||||
|
||||
// Проверяем, что не выходим за границы массива
|
||||
if (offset + char_height > sizeof(font_data)) {
|
||||
if (offset + char_height > sizeof(image_data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint16_t row = 0; row < char_height; row++)
|
||||
{
|
||||
uint16_t row_data = image_data[offset + row];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (uint8_t row = 0; row < char_height; row++) {
|
||||
uint8_t row_data = font_data[offset + row];
|
||||
uint8_t row_data = image_data[offset + row];
|
||||
for (uint8_t col = 0; col < char_width; col++) {
|
||||
if (row_data & (1 << (7 - col))) {
|
||||
set_pixel(x + col, y + row, COLOR_BLACK); // Чёрный пиксель
|
||||
|
||||
Reference in New Issue
Block a user