aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-07 16:19:34 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:08 +0000
commit1830dfca55ff45398339ddd5493d55d02d990ab8 (patch)
tree31e86d3f7f14f75fb331fc0180c44c8afea84397
parentterm: add pt_or_px_as_pixels() (diff)
term: use pt_or_px_as_pixels()
-rw-r--r--terminal.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/terminal.c b/terminal.c
index a9c98ed5..a5537732 100644
--- a/terminal.c
+++ b/terminal.c
@@ -644,23 +644,15 @@ term_set_fonts(struct terminal *term, struct fcft_font *fonts[static 4])
(term->fonts[0]->space_advance.x > 0
? term->fonts[0]->space_advance.x
: term->fonts[0]->max_advance.x)
- + (conf->letter_spacing.px > 0
- ? conf->letter_spacing.px
- : conf->letter_spacing.pt * term->font_dpi / 72.);
+ + pt_or_px_as_pixels(term, &conf->letter_spacing);
term->cell_height = conf->line_height.px >= 0
- ? (conf->line_height.px > 0
- ? conf->line_height.px
- : conf->line_height.pt * term->font_dpi / 72.)
+ ? pt_or_px_as_pixels(term, &conf->line_height)
: max(term->fonts[0]->height,
term->fonts[0]->ascent + term->fonts[0]->descent);
- term->font_x_ofs = conf->horizontal_letter_offset.px > 0
- ? conf->horizontal_letter_offset.px
- : conf->horizontal_letter_offset.pt * term->font_dpi / 72.;
- term->font_y_ofs = conf->vertical_letter_offset.px > 0
- ? conf->vertical_letter_offset.px
- : conf->vertical_letter_offset.pt * term->font_dpi / 72.;
+ term->font_x_ofs = pt_or_px_as_pixels(term, &conf->horizontal_letter_offset);
+ term->font_y_ofs = pt_or_px_as_pixels(term, &conf->vertical_letter_offset);
LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height);