From f6f8f2b35ec10eb09f2c7c5b8214b62fa87b59e5 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 13 Aug 2021 17:38:56 +0200 Subject: pt-or-px: heed the dpi-aware setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this patch, pt-or-px values, like letter-spacing, were *always* scaled using the current DPI value. This is wrong; if the fonts are scaled using the output’s scaling factor, then so should all other point values. This also fixes an issue where e.g. letter-spacing would use one DPI value at startup, but then when increasing/decreasing or resetting the font size, would be re-calculated using a different DPI value, leading to completely different spacing. This happened when there were multiple monitors, with different DPI values, and foot guessed the initial DPI value wrong. Normally, foot would correct itself as soon as the window was mapped, and the “correct” DPI value known. But if the fonts were scaled using the scaling factor, it was possible that the font reload never happened. This patch also updates the thickness calculation (for LIGHT and HEAVY box drawing characters) to use the scaling factor when appropriate. Closes #680 --- terminal.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 74a8f2de..f394a5b0 100644 --- a/terminal.h +++ b/terminal.h @@ -643,6 +643,9 @@ bool term_font_size_decrease(struct terminal *term); bool term_font_size_reset(struct terminal *term); bool term_font_dpi_changed(struct terminal *term, int old_scale); void term_font_subpixel_changed(struct terminal *term); + +bool term_font_sized_by_dpi(const struct terminal *term, int scale); +bool term_font_sized_by_scale(const struct terminal *term, int scale); int term_pt_or_px_as_pixels( const struct terminal *term, const struct pt_or_px *pt_or_px); -- cgit v1.3