commit f7d24d2281007037f2fbdcaa96df9598d28a477a
parent 9832e41c76d6bbfbd2e5f60fae033aa678280e22
Author: Remy Noulin <loader2x@gmail.com>
Date: Thu, 1 Dec 2022 11:46:29 +0200
fix last line in show quadrant functions when font is odd
termfont.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
Diffstat:
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/termfont.c b/termfont.c
@@ -416,9 +416,14 @@ void showStringQuadrant(twidfont *font, char *string) {
}
if (font->height & 1) {
u8 block = 0;
- range(i, totalWidth) {
- block = (*(p + i)== ' ' ? 0 : 2);
- printf(halfBlocks[block]);
+ rangeFromStep(i, 1, totalWidth, 2) {
+ block = (*(p + i-1) == ' ' ? 0 : 8)
+ | (*(p + i) == ' ' ? 0 : 4);
+ printf(quadrants[block]);
+ }
+ if (totalWidth & 1) {
+ block = (*(p + totalWidth-1) == ' ' ? 0 : 8);
+ printf(quadrants[block]);
}
put;
}
@@ -479,10 +484,17 @@ void showStringQuadrantColors(twidfont *font, char *string) {
}
if (font->height & 1) {
u8 block = 0;
- range(i, totalWidth) {
- block = (*(p + i)== ' ' ? 0 : 2);
- printf(halfBlocks[block]);
+ printf("%k", colors[font->height/2]);
+ rangeFromStep(i, 1, totalWidth, 2) {
+ block = (*(p + i-1) == ' ' ? 0 : 8)
+ | (*(p + i) == ' ' ? 0 : 4);
+ printf(quadrants[block]);
}
+ if (totalWidth & 1) {
+ block = (*(p + totalWidth-1) == ' ' ? 0 : 8);
+ printf(quadrants[block]);
+ }
+ printf(RST);
put;
}