From 28e9124c09dde5d45e121efeb581ee2506cb8c82 Mon Sep 17 00:00:00 2001 From: Steven Tracey Date: Thu, 21 Nov 2024 23:32:55 -0500 Subject: [PATCH] Small ui tweaks --- c/libs/Fonts/fonts.h | 26 +++++++++++++------------- c/src/p2fa.c | 12 ++++++++---- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/c/libs/Fonts/fonts.h b/c/libs/Fonts/fonts.h index 4288df9..8462b9f 100644 --- a/c/libs/Fonts/fonts.h +++ b/c/libs/Fonts/fonts.h @@ -62,22 +62,22 @@ typedef struct _tFont //GB2312 -typedef struct // 汉字字模数据结构 -{ - const char index[2]; // 汉字内码索引 - const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8+2]; // 点阵码数据 -}CH_CN; +// typedef struct // 汉字字模数据结构 +// { +// const char index[2]; // 汉字内码索引 +// const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8+2]; // 点阵码数据 +// }CH_CN; -typedef struct -{ - const CH_CN *table; - uint16_t size; - uint16_t ASCII_Width; - uint16_t Width; - uint16_t Height; +//typedef struct +//{ +// const CH_CN *table; +// uint16_t size; +// uint16_t ASCII_Width; +// uint16_t Width; +// uint16_t Height; -}cFONT; +//}cFONT; extern sFONT Font36; extern sFONT Font24; diff --git a/c/src/p2fa.c b/c/src/p2fa.c index f4d7725..d3752ee 100644 --- a/c/src/p2fa.c +++ b/c/src/p2fa.c @@ -33,6 +33,10 @@ void Handler(int sigNum) { exit(0); } +int computeWidth(char* text, sFONT *font) { + return (font->Width) * strlen(text); +} + void code(UWORD *blackImage, char* confName) { int ch; codeLoop: @@ -52,7 +56,7 @@ void code(UWORD *blackImage, char* confName) { const char *code = getCode(confStr); DebugLine(3, 0, "Code: %s\n", code); Paint_DrawString(5, 20, code, &Font36, WHITE, BLACK); - Paint_DrawString(5, 5, confName, &Font12, WHITE, BLACK); + Paint_DrawString(8, 5, confName, &Font12, WHITE, BLACK); Paint_DrawRectangle(10, 114, 240, 94, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); EPD_2in13_V4_Display_Base(blackImage); @@ -77,11 +81,11 @@ void code(UWORD *blackImage, char* confName) { DebugLine(4, 0, "Time Left: %d\n", i); double percentLeft = (double) i / (double) (30 * 1000); progBarEndIndex = 228 - (int) (228 * percentLeft); - Paint_ClearWindows(progBarCurrentIndex, 113, progBarEndIndex, 93, WHITE); + Paint_ClearWindows(progBarCurrentIndex, 113, progBarEndIndex, 95, WHITE); int line = 15; while (progBarCurrentIndex < progBarEndIndex) { - DebugLine(line, 0, "Line: %d,113 - %d,93\n", progBarCurrentIndex, progBarEndIndex); - Paint_DrawLine(progBarCurrentIndex, 113, progBarCurrentIndex, 93, BLACK, DOT_PIXEL_1X1, + DebugLine(line, 0, "Line: %d,113 - %d,95\n", progBarCurrentIndex, progBarEndIndex); + Paint_DrawLine(progBarCurrentIndex, 113, progBarCurrentIndex, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID); ++progBarCurrentIndex; ++line;