mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
font: move metrics from terminal struct to font struct
This commit is contained in:
parent
431800a8a5
commit
bc86cd61c7
5 changed files with 35 additions and 34 deletions
19
terminal.c
19
terminal.c
|
|
@ -377,21 +377,6 @@ initialize_fonts(struct terminal *term, const struct config *conf)
|
|||
}
|
||||
|
||||
tll_free(font_names);
|
||||
|
||||
FT_Face ft_face = term->fonts[0]->face;
|
||||
int max_x_advance = ft_face->size->metrics.max_advance / 64;
|
||||
int height = ft_face->size->metrics.height / 64;
|
||||
int descent = ft_face->size->metrics.descender / 64;
|
||||
int ascent = ft_face->size->metrics.ascender / 64;
|
||||
|
||||
term->fextents.height = height * term->fonts[0]->pixel_size_fixup;
|
||||
term->fextents.descent = -descent * term->fonts[0]->pixel_size_fixup;
|
||||
term->fextents.ascent = ascent * term->fonts[0]->pixel_size_fixup;
|
||||
term->fextents.max_x_advance = max_x_advance * term->fonts[0]->pixel_size_fixup;
|
||||
|
||||
LOG_DBG("metrics: height: %d, descent: %d, ascent: %d, x-advance: %d",
|
||||
height, descent, ascent, max_x_advance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -529,8 +514,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
|
|||
goto err;
|
||||
|
||||
/* Cell dimensions are based on the font metrics. Obviously */
|
||||
term->cell_width = (int)ceil(term->fextents.max_x_advance);
|
||||
term->cell_height = (int)ceil(term->fextents.height);
|
||||
term->cell_width = term->fonts[0]->max_x_advance;
|
||||
term->cell_height = term->fonts[0]->height;
|
||||
LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height);
|
||||
|
||||
/* Start the slave/client */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue