mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
fontconfig: charset and langset apis
This commit is contained in:
@ -11,6 +11,10 @@ pub const CharSet = opaque {
|
||||
c.FcCharSetDestroy(self.cval());
|
||||
}
|
||||
|
||||
pub fn hasChar(self: *CharSet, cp: u32) bool {
|
||||
return c.FcCharSetHasChar(self.cval(), cp) == c.FcTrue;
|
||||
}
|
||||
|
||||
pub inline fn cval(self: *CharSet) *c.struct__FcCharSet {
|
||||
return @ptrCast(
|
||||
*c.struct__FcCharSet,
|
||||
@ -20,6 +24,10 @@ pub const CharSet = opaque {
|
||||
};
|
||||
|
||||
test "create" {
|
||||
const testing = std.testing;
|
||||
|
||||
var fs = CharSet.create();
|
||||
defer fs.destroy();
|
||||
|
||||
try testing.expect(!fs.hasChar(0x20));
|
||||
}
|
||||
|
@ -11,6 +11,10 @@ pub const LangSet = opaque {
|
||||
c.FcLangSetDestroy(self.cval());
|
||||
}
|
||||
|
||||
pub fn hasLang(self: *LangSet, lang: [:0]const u8) bool {
|
||||
return c.FcLangSetHasLang(self.cval(), lang.ptr) == c.FcTrue;
|
||||
}
|
||||
|
||||
pub inline fn cval(self: *LangSet) *c.struct__FcLangSet {
|
||||
return @ptrCast(
|
||||
*c.struct__FcLangSet,
|
||||
@ -20,6 +24,10 @@ pub const LangSet = opaque {
|
||||
};
|
||||
|
||||
test "create" {
|
||||
const testing = std.testing;
|
||||
|
||||
var fs = LangSet.create();
|
||||
defer fs.destroy();
|
||||
|
||||
try testing.expect(!fs.hasLang("und-zsye"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user