Microkernel thing OS experiment (Zig ⚡)

HiDPI font scaling

pci.express 9d05e8fa 981b0d81

verified
Changed files
+13 -2
components
ukernel
arch
amd64
+13 -2
components/ukernel/arch/amd64/boot.zig
···
const fb = common.aux.Framebuffer.from_limine(fb_response.getFramebuffers()[0]);
common.init_data.framebuffer = fb;
common.init_data.console = flanterm.init(
//malloc and free
null,
···
// font spacing
1,
// font scale x and y
-
0,
-
0,
// margin
0,
);
···
const fb = common.aux.Framebuffer.from_limine(fb_response.getFramebuffers()[0]);
common.init_data.framebuffer = fb;
+
// Set the font scaling depending on screen resolution
+
const font_scale_x: usize, const font_scale_y: usize = blk: {
+
if (fb.width >= 2560 and fb.height >= 1440) {
+
break :blk .{ 2, 2 };
+
} else if (fb.width >= 5120 and fb.height >= 2880) {
+
break :blk .{ 4, 4 };
+
} else {
+
break :blk .{ 1, 1 };
+
}
+
};
+
common.init_data.console = flanterm.init(
//malloc and free
null,
···
// font spacing
1,
// font scale x and y
+
font_scale_x,
+
font_scale_y,
// margin
0,
);