mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
coretext: calculate units per em/point
This commit is contained in:
@ -130,6 +130,14 @@ pub const Font = opaque {
|
|||||||
pub fn getUnderlineThickness(self: *Font) f64 {
|
pub fn getUnderlineThickness(self: *Font) f64 {
|
||||||
return c.CTFontGetUnderlineThickness(@ptrCast(self));
|
return c.CTFontGetUnderlineThickness(@ptrCast(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn getUnitsPerEm(self: *Font) u32 {
|
||||||
|
return c.CTFontGetUnitsPerEm(@ptrCast(c.CTFontRef, self));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn getSize(self: *Font) f64 {
|
||||||
|
return c.CTFontGetSize(@ptrCast(c.CTFontRef, self));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const FontOrientation = enum(c_uint) {
|
pub const FontOrientation = enum(c_uint) {
|
||||||
|
@ -317,6 +317,10 @@ pub const Face = struct {
|
|||||||
const strikethrough_position = cell_baseline * 0.6;
|
const strikethrough_position = cell_baseline * 0.6;
|
||||||
const strikethrough_thickness = underline_thickness;
|
const strikethrough_thickness = underline_thickness;
|
||||||
|
|
||||||
|
// Note: is this useful?
|
||||||
|
// const units_per_em = ct_font.getUnitsPerEm();
|
||||||
|
// const units_per_point = @intToFloat(f64, units_per_em) / ct_font.getSize();
|
||||||
|
|
||||||
// std.log.warn("width={d}, height={d} baseline={d} underline_pos={d} underline_thickness={d}", .{
|
// std.log.warn("width={d}, height={d} baseline={d} underline_pos={d} underline_thickness={d}", .{
|
||||||
// cell_width,
|
// cell_width,
|
||||||
// cell_height,
|
// cell_height,
|
||||||
|
Reference in New Issue
Block a user