mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
revert dpi type to u16
This commit is contained in:
@ -576,8 +576,8 @@ pub const Key = struct {
|
||||
pub fn hash(self: Key, hasher: anytype) void {
|
||||
const autoHash = std.hash.autoHash;
|
||||
autoHash(hasher, @as(u32, @bitCast(self.font_size.points)));
|
||||
autoHash(hasher, @as(u32, @bitCast(self.font_size.xdpi)));
|
||||
autoHash(hasher, @as(u32, @bitCast(self.font_size.ydpi)));
|
||||
autoHash(hasher, self.font_size.xdpi);
|
||||
autoHash(hasher, self.font_size.ydpi);
|
||||
autoHash(hasher, self.descriptors.len);
|
||||
for (self.descriptors) |d| d.hash(hasher);
|
||||
self.codepoint_map.hash(hasher);
|
||||
|
@ -38,13 +38,13 @@ pub const DesiredSize = struct {
|
||||
points: f32,
|
||||
|
||||
// The DPI of the screen so we can convert points to pixels.
|
||||
xdpi: f32 = default_dpi,
|
||||
ydpi: f32 = default_dpi,
|
||||
xdpi: u16 = default_dpi,
|
||||
ydpi: u16 = default_dpi,
|
||||
|
||||
// Converts points to pixels
|
||||
pub fn pixels(self: DesiredSize) u16 {
|
||||
// 1 point = 1/72 inch
|
||||
return @intFromFloat(@round((self.points * self.ydpi) / 72));
|
||||
return @intFromFloat(@round((self.points * @as(f32, @floatFromInt(self.ydpi))) / 72));
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user