many more boxes

This commit is contained in:
Mitchell Hashimoto
2022-11-25 10:57:38 -08:00
parent ef16ba263f
commit 72cd107e6a

View File

@ -242,6 +242,20 @@ fn draw(self: BoxFont, img: *pixman.Image, cp: u32) !void {
0x255e => self.draw_vertical_single_and_right_double(img),
0x255f => self.draw_vertical_double_and_right_single(img),
0x2560 => self.draw_double_vertical_and_right(img),
0x2561 => self.draw_vertical_single_and_left_double(img),
0x2562 => self.draw_vertical_double_and_left_single(img),
0x2563 => self.draw_double_vertical_and_left(img),
0x2564 => self.draw_down_single_and_horizontal_double(img),
0x2565 => self.draw_down_double_and_horizontal_single(img),
0x2566 => self.draw_double_down_and_horizontal(img),
0x2567 => self.draw_up_single_and_horizontal_double(img),
0x2568 => self.draw_up_double_and_horizontal_single(img),
0x2569 => self.draw_double_up_and_horizontal(img),
0x256a => self.draw_vertical_single_and_horizontal_double(img),
0x256b => self.draw_vertical_double_and_horizontal_single(img),
0x256c => self.draw_double_vertical_and_horizontal(img),
else => return error.InvalidCodepoint,
}
}
@ -865,6 +879,132 @@ fn draw_vertical_double_and_right_single(self: BoxFont, img: *pixman.Image) void
self.vline(img, 0, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_double_vertical_and_right(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.vline(img, 0, self.height, vmid, thick_px);
self.vline(img, 0, hmid, vmid + 2 * thick_px, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid + 2 * thick_px, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid + 2 * thick_px, thick_px);
}
fn draw_vertical_single_and_left_double(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width + thick_px) / 2;
self.vline_middle(img, .light);
self.hline(img, 0, vmid, hmid, thick_px);
self.hline(img, 0, vmid, hmid + 2 * thick_px, thick_px);
}
fn draw_vertical_double_and_left_single(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const vmid = (self.width - thick_px * 3) / 2;
self.hline(img, 0, vmid, (self.height - thick_px) / 2, thick_px);
self.vline(img, 0, self.height, vmid, thick_px);
self.vline(img, 0, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_double_vertical_and_left(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.vline(img, 0, self.height, vmid + 2 * thick_px, thick_px);
self.vline(img, 0, hmid, vmid, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid, thick_px);
self.hline(img, 0, vmid + thick_px, hmid, thick_px);
self.hline(img, 0, vmid, hmid + 2 * thick_px, thick_px);
}
fn draw_down_single_and_horizontal_double(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
self.vline(img, hmid + 2 * thick_px, self.height, (self.width - thick_px) / 2, thick_px);
self.hline(img, 0, self.width, hmid, thick_px);
self.hline(img, 0, self.width, hmid + 2 * thick_px, thick_px);
}
fn draw_down_double_and_horizontal_single(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.hline_middle(img, .light);
self.vline(img, hmid, self.height, vmid, thick_px);
self.vline(img, hmid, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_double_down_and_horizontal(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.hline(img, 0, self.width, hmid, thick_px);
self.hline(img, 0, vmid, hmid + 2 * thick_px, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid + 2 * thick_px, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_up_single_and_horizontal_double(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px) / 2;
self.vline(img, 0, hmid, vmid, thick_px);
self.hline(img, 0, self.width, hmid, thick_px);
self.hline(img, 0, self.width, hmid + 2 * thick_px, thick_px);
}
fn draw_up_double_and_horizontal_single(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.hline_middle(img, .light);
self.vline(img, 0, hmid, vmid, thick_px);
self.vline(img, 0, hmid, vmid + 2 * thick_px, thick_px);
}
fn draw_double_up_and_horizontal(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.vline(img, 0, hmid, vmid, thick_px);
self.vline(img, 0, hmid, vmid + 2 * thick_px, thick_px);
self.hline(img, 0, vmid + thick_px, hmid, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid, thick_px);
self.hline(img, 0, self.width, hmid + 2 * thick_px, thick_px);
}
fn draw_vertical_single_and_horizontal_double(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
self.vline_middle(img, .light);
self.hline(img, 0, self.width, hmid, thick_px);
self.hline(img, 0, self.width, hmid + 2 * thick_px, thick_px);
}
fn draw_vertical_double_and_horizontal_single(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const vmid = (self.width - thick_px * 3) / 2;
self.hline_middle(img, .light);
self.vline(img, 0, self.height, vmid, thick_px);
self.vline(img, 0, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_double_vertical_and_horizontal(self: BoxFont, img: *pixman.Image) void {
const thick_px = Thickness.light.height(self.thickness);
const hmid = (self.height - thick_px * 3) / 2;
const vmid = (self.width - thick_px * 3) / 2;
self.hline(img, 0, vmid, hmid, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid, thick_px);
self.hline(img, 0, vmid, hmid + 2 * thick_px, thick_px);
self.hline(img, vmid + 2 * thick_px, self.width, hmid + 2 * thick_px, thick_px);
self.vline(img, 0, hmid + thick_px, vmid, thick_px);
self.vline(img, 0, hmid, vmid + 2 * thick_px, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid, thick_px);
self.vline(img, hmid + 2 * thick_px, self.height, vmid + 2 * thick_px, thick_px);
}
fn draw_dash_horizontal(
self: BoxFont,
img: *pixman.Image,