Fast and reasonably complete (framebuffer) terminal emulator (Zig fork)

Perform autoscaling on high res if scale factor is 0

mintsuki fa54a602 01b3069a

Changed files
+14 -12
backends
+13
backends/fb.c
···
size_t font_scale_x, size_t font_scale_y,
size_t margin
) {
+
if (font_scale_x == 0 || font_scale_y == 0) {
+
font_scale_x = 1;
+
font_scale_y = 1;
+
if (width >= (1920 + 1920 / 3) && height >= (1080 + 1080 / 3)) {
+
font_scale_x = 2;
+
font_scale_y = 2;
+
}
+
if (width >= (3840 + 3840 / 3) && height >= (2160 + 2160 / 3)) {
+
font_scale_x = 4;
+
font_scale_y = 4;
+
}
+
}
+
#ifndef FLANTERM_FB_DISABLE_BUMP_ALLOC
// Limit terminal size if needed
if (width > FLANTERM_FB_WIDTH_LIMIT || height > FLANTERM_FB_HEIGHT_LIMIT) {
+1 -12
backends/fb.h
···
uint8_t blue_mask_size, uint8_t blue_mask_shift
#endif
) {
-
size_t font_scale_x = 1;
-
size_t font_scale_y = 1;
-
if (width >= (1920 + 1920 / 3) && height >= (1080 + 1080 / 3)) {
-
font_scale_x = 2;
-
font_scale_y = 2;
-
}
-
if (width >= (3840 + 3840 / 3) && height >= (2160 + 2160 / 3)) {
-
font_scale_x = 4;
-
font_scale_y = 4;
-
}
-
return flanterm_fb_init(
NULL,
NULL,
···
NULL, NULL,
NULL, NULL,
NULL, 0, 0, 1,
-
font_scale_x, font_scale_y,
+
0, 0,
0
);
}