mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
41 lines
893 B
Zig
41 lines
893 B
Zig
const std = @import("std");
|
|
const c = @import("c.zig");
|
|
|
|
pub const Pattern = opaque {
|
|
pub fn create() *Pattern {
|
|
return @ptrCast(*Pattern, c.FcPatternCreate());
|
|
}
|
|
|
|
pub fn parse(str: [:0]const u8) *Pattern {
|
|
return @ptrCast(*Pattern, c.FcNameParse(str.ptr));
|
|
}
|
|
|
|
pub fn destroy(self: *Pattern) void {
|
|
c.FcPatternDestroy(self.cval());
|
|
}
|
|
|
|
pub fn defaultSubstitute(self: *Pattern) void {
|
|
c.FcDefaultSubstitute(self.cval());
|
|
}
|
|
|
|
pub fn print(self: *Pattern) void {
|
|
c.FcPatternPrint(self.cval());
|
|
}
|
|
|
|
pub inline fn cval(self: *Pattern) *c.struct__FcPattern {
|
|
return @ptrCast(*c.struct__FcPattern, self);
|
|
}
|
|
};
|
|
|
|
test "create" {
|
|
var pat = Pattern.create();
|
|
defer pat.destroy();
|
|
}
|
|
|
|
test "name parse" {
|
|
var pat = Pattern.parse(":monospace");
|
|
defer pat.destroy();
|
|
|
|
pat.defaultSubstitute();
|
|
}
|