mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
f26251d3bd
commit
bb948d03e1
1 changed files with 8 additions and 3 deletions
11
terminal.c
11
terminal.c
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue