more wedges

This commit is contained in:
Mitchell Hashimoto
2022-11-25 15:18:36 -08:00
parent 120dfb4043
commit d2727b1f5c
2 changed files with 50 additions and 0 deletions

View File

@ -316,6 +316,22 @@ fn draw(self: BoxFont, alloc: Allocator, img: *pixman.Image, cp: u32) !void {
0x1FB68...0x1FB6B,
=> try self.draw_wedge_triangle_inverted(img, cp),
0x1FB46,
0x1FB51,
0x1FB5C,
0x1FB67,
=> try self.draw_wedge_triangle_and_box(img, cp),
0x1FB9A => {
try self.draw_wedge_triangle(img, 0x1fb6d);
try self.draw_wedge_triangle(img, 0x1fb6f);
},
0x1FB9B => {
try self.draw_wedge_triangle(img, 0x1fb6c);
try self.draw_wedge_triangle(img, 0x1fb6e);
},
else => return error.InvalidCodepoint,
}
}
@ -2078,6 +2094,32 @@ fn draw_wedge_triangle_inverted(self: BoxFont, img: *pixman.Image, cp: u32) !voi
);
}
fn draw_wedge_triangle_and_box(self: BoxFont, img: *pixman.Image, cp: u32) !void {
try self.draw_wedge_triangle(img, cp);
const y_thirds = self.yThirds();
const box: pixman.Box32 = switch (cp) {
0x1fb46, 0x1fb51 => .{
.x1 = 0,
.y1 = @intCast(i32, y_thirds[1]),
.x2 = @intCast(i32, self.width),
.y2 = @intCast(i32, self.height),
},
0x1fb5c, 0x1fb67 => .{
.x1 = 0,
.y1 = 0,
.x2 = @intCast(i32, self.width),
.y2 = @intCast(i32, y_thirds[0]),
},
else => unreachable,
};
const boxes = &[_]pixman.Box32{box};
img.fillBoxes(.src, white, boxes) catch {};
}
fn draw_light_arc(
self: BoxFont,
alloc: Allocator,

View File

@ -209,6 +209,14 @@ pub fn indexForCodepoint(
0x1FB68...0x1FB6B,
=> true,
0x1FB46,
0x1FB51,
0x1FB5C,
0x1FB67,
0x1FB9A,
0x1FB9B,
=> true,
else => false,
}) {
return FontIndex.initSpecial(.box);