diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-08-31 17:56:59 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-08-31 17:56:59 +0000 |
| commit | bb948d03e199870da6b35ba6f88ea88be12cfe21 (patch) | |
| tree | 5ff108903b3091fa458bed336fbb2d26170293a5 /terminal.c | |
| parent | Merge branch 'csi-cleanup' (diff) | |
terminal: prefer the advance width of ‘M’ over that of a space
This makes some non-monospaced fonts more readable, allowing users to
read errors and warnings printed in the window.
Furthermore, fcft-3.0 will remove the space_advance member, so once we
upgrade, we’ll have to rasterize a glyph ourselves anyway.
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -657,10 +657,15 @@ term_set_fonts(struct terminal *term, struct fcft_font *fonts[static 4]) const struct config *conf = term->conf; + const struct fcft_glyph *M = fcft_glyph_rasterize( + term->fonts[0], L'M', term->font_subpixel); + term->cell_width = - (term->fonts[0]->space_advance.x > 0 - ? term->fonts[0]->space_advance.x - : term->fonts[0]->max_advance.x) + (M != NULL + ? M->advance.x + : (term->fonts[0]->space_advance.x > 0 + ? term->fonts[0]->space_advance.x + : term->fonts[0]->max_advance.x)) + term_pt_or_px_as_pixels(term, &conf->letter_spacing); term->cell_height = term->font_line_height.px >= 0 |
