mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-22 07:15:19 +00:00
font/coretext: ability to set variation axes
This commit is contained in:
@@ -39,6 +39,14 @@ pub const Font = opaque {
|
||||
c.CFRelease(self);
|
||||
}
|
||||
|
||||
pub fn retain(self: *Font) void {
|
||||
_ = c.CFRetain(self);
|
||||
}
|
||||
|
||||
pub fn copyDescriptor(self: *Font) *text.FontDescriptor {
|
||||
return @ptrCast(@constCast(c.CTFontCopyFontDescriptor(@ptrCast(self))));
|
||||
}
|
||||
|
||||
pub fn getGlyphsForCharacters(self: *Font, chars: []const u16, glyphs: []graphics.Glyph) bool {
|
||||
assert(chars.len == glyphs.len);
|
||||
return c.CTFontGetGlyphsForCharacters(
|
||||
|
||||
@@ -31,6 +31,21 @@ pub const FontDescriptor = opaque {
|
||||
) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn createCopyWithVariation(
|
||||
original: *FontDescriptor,
|
||||
id: *foundation.Number,
|
||||
value: f64,
|
||||
) Allocator.Error!*FontDescriptor {
|
||||
return @as(
|
||||
?*FontDescriptor,
|
||||
@ptrCast(@constCast(c.CTFontDescriptorCreateCopyWithVariation(
|
||||
@ptrCast(original),
|
||||
@ptrCast(id),
|
||||
value,
|
||||
))),
|
||||
) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn release(self: *FontDescriptor) void {
|
||||
c.CFRelease(self);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user