From 5ea37adaf407c63d8915a0ace2437bce46cf06cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 7 Jan 2021 17:17:17 +0100 Subject: [PATCH] term: add pt_or_px_as_pixels() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function takes a ‘union pt_or_px’ and converts its value to a pixel value. --- terminal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/terminal.c b/terminal.c index 676f0cb4..a9c98ed5 100644 --- a/terminal.c +++ b/terminal.c @@ -608,6 +608,15 @@ err_sem_destroy: return false; } +static int +pt_or_px_as_pixels(const struct terminal *term, + const union pt_or_px *pt_or_px) +{ + return pt_or_px->px == 0 + ? pt_or_px->pt * term->font_dpi / 72 + : pt_or_px->px; +} + static bool term_set_fonts(struct terminal *term, struct fcft_font *fonts[static 4]) {