mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
fontconfig: charset and langset apis
This commit is contained in:
@ -11,6 +11,10 @@ pub const CharSet = opaque {
|
|||||||
c.FcCharSetDestroy(self.cval());
|
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 {
|
pub inline fn cval(self: *CharSet) *c.struct__FcCharSet {
|
||||||
return @ptrCast(
|
return @ptrCast(
|
||||||
*c.struct__FcCharSet,
|
*c.struct__FcCharSet,
|
||||||
@ -20,6 +24,10 @@ pub const CharSet = opaque {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test "create" {
|
test "create" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
var fs = CharSet.create();
|
var fs = CharSet.create();
|
||||||
defer fs.destroy();
|
defer fs.destroy();
|
||||||
|
|
||||||
|
try testing.expect(!fs.hasChar(0x20));
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@ pub const LangSet = opaque {
|
|||||||
c.FcLangSetDestroy(self.cval());
|
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 {
|
pub inline fn cval(self: *LangSet) *c.struct__FcLangSet {
|
||||||
return @ptrCast(
|
return @ptrCast(
|
||||||
*c.struct__FcLangSet,
|
*c.struct__FcLangSet,
|
||||||
@ -20,6 +24,10 @@ pub const LangSet = opaque {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test "create" {
|
test "create" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
var fs = LangSet.create();
|
var fs = LangSet.create();
|
||||||
defer fs.destroy();
|
defer fs.destroy();
|
||||||
|
|
||||||
|
try testing.expect(!fs.hasLang("und-zsye"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user