mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
more wedges
This commit is contained in:
@ -67,40 +67,17 @@ pub fn main() !void {
|
||||
|
||||
{
|
||||
try stdout.print("\x1b[4mWedge Triangles\x1b[0m\n", .{});
|
||||
{
|
||||
var i: usize = 0x1FB3C;
|
||||
const end = 0x1FB40;
|
||||
while (i <= end) : (i += 1) {
|
||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
||||
}
|
||||
}
|
||||
{
|
||||
var i: usize = 0x1FB47;
|
||||
const end = 0x1FB4B;
|
||||
while (i <= end) : (i += 1) {
|
||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
||||
}
|
||||
}
|
||||
{
|
||||
var i: usize = 0x1FB57;
|
||||
const end = 0x1FB5B;
|
||||
while (i <= end) : (i += 1) {
|
||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
||||
}
|
||||
}
|
||||
{
|
||||
var i: usize = 0x1FB62;
|
||||
const end = 0x1FB66;
|
||||
while (i <= end) : (i += 1) {
|
||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
||||
}
|
||||
}
|
||||
{
|
||||
var i: usize = 0x1FB6C;
|
||||
const end = 0x1FB6F;
|
||||
while (i <= end) : (i += 1) {
|
||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
||||
var i: usize = 0x1FB3C;
|
||||
var step: usize = 32;
|
||||
const end = 0x1FB6B;
|
||||
while (i <= end) : (i += step) {
|
||||
var j: usize = 0;
|
||||
while (j < step) : (j += 1) {
|
||||
const v = i + j;
|
||||
if (v <= end) try stdout.print("{u} ", .{@intCast(u21, v)});
|
||||
}
|
||||
|
||||
try stdout.print("\n\n", .{});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,36 @@ pub const Image = opaque {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn composite(
|
||||
self: *Image,
|
||||
op: pixman.Op,
|
||||
src: *Image,
|
||||
mask: ?*Image,
|
||||
src_x: i16,
|
||||
src_y: i16,
|
||||
mask_x: i16,
|
||||
mask_y: i16,
|
||||
dest_x: i16,
|
||||
dest_y: i16,
|
||||
width: u16,
|
||||
height: u16,
|
||||
) void {
|
||||
c.pixman_image_composite(
|
||||
@enumToInt(op),
|
||||
@ptrCast(*c.pixman_image_t, src),
|
||||
@ptrCast(?*c.pixman_image_t, mask),
|
||||
@ptrCast(*c.pixman_image_t, self),
|
||||
src_x,
|
||||
src_y,
|
||||
mask_x,
|
||||
mask_y,
|
||||
dest_x,
|
||||
dest_y,
|
||||
width,
|
||||
height,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn compositeTriangles(
|
||||
self: *Image,
|
||||
op: pixman.Op,
|
||||
|
@ -302,13 +302,20 @@ fn draw(self: BoxFont, alloc: Allocator, img: *pixman.Image, cp: u32) !void {
|
||||
|
||||
0x1FB00...0x1FB3B => self.draw_sextant(img, cp),
|
||||
|
||||
0x1fb3c...0x1fb40,
|
||||
0x1fb47...0x1fb4b,
|
||||
0x1fb57...0x1fb5b,
|
||||
0x1fb62...0x1fb66,
|
||||
0x1fb6c...0x1fb6f,
|
||||
0x1FB3C...0x1FB40,
|
||||
0x1FB47...0x1FB4B,
|
||||
0x1FB57...0x1FB5B,
|
||||
0x1FB62...0x1FB66,
|
||||
0x1FB6C...0x1FB6F,
|
||||
=> try self.draw_wedge_triangle(img, cp),
|
||||
|
||||
0x1FB41...0x1FB45,
|
||||
0x1FB4C...0x1FB50,
|
||||
0x1FB52...0x1FB56,
|
||||
0x1FB5D...0x1FB61,
|
||||
0x1FB68...0x1FB6B,
|
||||
=> try self.draw_wedge_triangle_inverted(img, cp),
|
||||
|
||||
else => return error.InvalidCodepoint,
|
||||
}
|
||||
}
|
||||
@ -2051,6 +2058,26 @@ fn draw_wedge_triangle(self: BoxFont, img: *pixman.Image, cp: u32) !void {
|
||||
img.compositeTriangles(.over, src, .a8, 0, 0, 0, 0, tris);
|
||||
}
|
||||
|
||||
fn draw_wedge_triangle_inverted(self: BoxFont, img: *pixman.Image, cp: u32) !void {
|
||||
try self.draw_wedge_triangle(img, cp);
|
||||
|
||||
const src = try pixman.Image.createSolidFill(white);
|
||||
defer _ = src.unref();
|
||||
img.composite(
|
||||
.out,
|
||||
src,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@intCast(u16, self.width),
|
||||
@intCast(u16, self.height),
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_light_arc(
|
||||
self: BoxFont,
|
||||
alloc: Allocator,
|
||||
|
@ -194,6 +194,7 @@ pub fn indexForCodepoint(
|
||||
|
||||
// "Symbols for Legacy Computing" block
|
||||
0x1FB00...0x1FB3B => true,
|
||||
|
||||
0x1FB3C...0x1FB40,
|
||||
0x1FB47...0x1FB4B,
|
||||
0x1FB57...0x1FB5B,
|
||||
@ -201,6 +202,13 @@ pub fn indexForCodepoint(
|
||||
0x1FB6C...0x1FB6F,
|
||||
=> true,
|
||||
|
||||
0x1FB41...0x1FB45,
|
||||
0x1FB4C...0x1FB50,
|
||||
0x1FB52...0x1FB56,
|
||||
0x1FB5D...0x1FB61,
|
||||
0x1FB68...0x1FB6B,
|
||||
=> true,
|
||||
|
||||
else => false,
|
||||
}) {
|
||||
return FontIndex.initSpecial(.box);
|
||||
|
Reference in New Issue
Block a user