mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Merge pull request #385 from mgeist/update-font-dpi
Update font DPI when the content scale is updated
This commit is contained in:
@ -1192,6 +1192,18 @@ pub fn scrollCallback(
|
|||||||
try self.queueRender();
|
try self.queueRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn contentScaleCallback(self: *Surface, content_scale: apprt.ContentScale) void {
|
||||||
|
const x_dpi = content_scale.x * font.face.default_dpi;
|
||||||
|
const y_dpi = content_scale.y * font.face.default_dpi;
|
||||||
|
const size = size: {
|
||||||
|
var size = self.font_size;
|
||||||
|
size.xdpi = @intFromFloat(x_dpi);
|
||||||
|
size.ydpi = @intFromFloat(y_dpi);
|
||||||
|
break :size size;
|
||||||
|
};
|
||||||
|
self.setFontSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
/// The type of action to report for a mouse event.
|
/// The type of action to report for a mouse event.
|
||||||
const MouseReportAction = enum { press, release, motion };
|
const MouseReportAction = enum { press, release, motion };
|
||||||
|
|
||||||
|
@ -349,6 +349,8 @@ pub const Surface = struct {
|
|||||||
.x = @floatCast(x),
|
.x = @floatCast(x),
|
||||||
.y = @floatCast(y),
|
.y = @floatCast(y),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.core_surface.contentScaleCallback(self.content_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn updateSize(self: *Surface, width: u32, height: u32) void {
|
pub fn updateSize(self: *Surface, width: u32, height: u32) void {
|
||||||
|
Reference in New Issue
Block a user