From acecab1c8bcb414521867fce46d238ad48f4b621 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 11 Mar 2020 16:10:55 +0100 Subject: term: use logical DPI+scale factor when scaling fonts This fixes an issue where the fonts were rendered too small when the output had fractional scaling. For integral scaling, using the logical (scaled) DPI multiplied with the scaling factor results in the same final DPI value as if we had used the physical DPI. But for fractional scaling, this works around the fact that the compositor downscales the surface after we've rendered it. Closes #5 --- wayland.h | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'wayland.h') diff --git a/wayland.h b/wayland.h index ed53591d..7d7b36ca 100644 --- a/wayland.h +++ b/wayland.h @@ -24,14 +24,39 @@ struct monitor { int x; int y; - int width_mm; - int height_mm; - - int width_px; - int height_px; + struct { + /* Physical size, in mm */ + struct { + int width; + int height; + } mm; + + /* Physical size, in pixels */ + struct { + int width; + int height; + } px_real; + + /* Scaled size, in pixels */ + struct { + int width; + int height; + } px_scaled; + } dim; - int x_ppi; - int y_ppi; + struct { + /* PPI, based on physical size */ + struct { + int x; + int y; + } real; + + /* PPI, logical, based on scaled size */ + struct { + int x; + int y; + } scaled; + } ppi; int scale; float refresh; -- cgit v1.3