mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-04 07:15:29 -04:00
config: line-height, letter-spacing: values are in pt by default, but we allow px
If the value is specified without a unit, then the value is assumed to be in points, subject to DPI scaling. The value can optionally have a ‘px’ suffix, in which case the value is treated as a raw pixel count.
This commit is contained in:
parent
4c9f593d91
commit
a6fc8b5da4
6 changed files with 97 additions and 61 deletions
|
|
@ -2064,13 +2064,23 @@ box_drawing(const struct terminal *term, wchar_t wc)
|
|||
};
|
||||
draw_glyph(wc, &buf);
|
||||
|
||||
const struct config *conf = term->conf;
|
||||
|
||||
int x_ofs = conf->horizontal_letter_offset.px > 0
|
||||
? conf->horizontal_letter_offset.px
|
||||
: conf->horizontal_letter_offset.pt * term->font_dpi / 72.;
|
||||
int y_ofs = conf->vertical_letter_offset.px > 0
|
||||
? conf->vertical_letter_offset.px
|
||||
: conf->vertical_letter_offset.pt * term->font_dpi / 72.;
|
||||
|
||||
|
||||
struct fcft_glyph *glyph = xmalloc(sizeof(*glyph));
|
||||
*glyph = (struct fcft_glyph){
|
||||
.wc = wc,
|
||||
.cols = 1,
|
||||
.pix = pix,
|
||||
.x = -term->conf->horizontal_letter_offset,
|
||||
.y = term->conf->vertical_letter_offset + term->fonts[0]->ascent,
|
||||
.x = -x_ofs,
|
||||
.y = y_ofs + term->fonts[0]->ascent,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.advance = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue