mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
render: font_baseline(): simply use the primary font's ascent
This is what we used as baseline for regular glyphs anyway. Thus, we can update that code to call font_baseline() now. This makes it easier to change how we define the baseline in the future.
This commit is contained in:
parent
719d521e33
commit
7be98291e1
1 changed files with 4 additions and 16 deletions
20
render.c
20
render.c
|
|
@ -83,19 +83,7 @@ pixman_color_dim_for_search(pixman_color_t *color)
|
||||||
static inline int
|
static inline int
|
||||||
font_baseline(const struct terminal *term)
|
font_baseline(const struct terminal *term)
|
||||||
{
|
{
|
||||||
assert(term->fonts[0]->ascent >= 0);
|
return term->fonts[0]->ascent;
|
||||||
assert(term->fonts[0]->descent >= 0);
|
|
||||||
|
|
||||||
int diff = term->fonts[0]->height - (term->fonts[0]->ascent + term->fonts[0]->descent);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
LOG_INFO("height=%d, ascent=%d, descent=%d, diff=%d",
|
|
||||||
term->fonts[0]->height,
|
|
||||||
term->fonts[0]->ascent, term->fonts[0]->descent,
|
|
||||||
diff);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return term->fonts[0]->height - diff / 2 - term->fonts[0]->descent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -286,7 +274,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
if (!(cell->attrs.blink && term->blink.state == BLINK_OFF)) {
|
if (!(cell->attrs.blink && term->blink.state == BLINK_OFF)) {
|
||||||
pixman_image_composite32(
|
pixman_image_composite32(
|
||||||
PIXMAN_OP_OVER, glyph->pix, NULL, pix, 0, 0, 0, 0,
|
PIXMAN_OP_OVER, glyph->pix, NULL, pix, 0, 0, 0, 0,
|
||||||
x + glyph->x, y + term->fonts[0]->ascent - glyph->y,
|
x + glyph->x, y + font_baseline(term) - glyph->y,
|
||||||
glyph->width, glyph->height);
|
glyph->width, glyph->height);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -295,7 +283,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
||||||
pixman_image_composite32(
|
pixman_image_composite32(
|
||||||
PIXMAN_OP_OVER, src, glyph->pix, pix, 0, 0, 0, 0,
|
PIXMAN_OP_OVER, src, glyph->pix, pix, 0, 0, 0, 0,
|
||||||
x + glyph->x, y + term->fonts[0]->ascent - glyph->y,
|
x + glyph->x, y + font_baseline(term) - glyph->y,
|
||||||
glyph->width, glyph->height);
|
glyph->width, glyph->height);
|
||||||
pixman_image_unref(src);
|
pixman_image_unref(src);
|
||||||
}
|
}
|
||||||
|
|
@ -792,7 +780,7 @@ render_search_box(struct terminal *term)
|
||||||
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
||||||
pixman_image_composite32(
|
pixman_image_composite32(
|
||||||
PIXMAN_OP_OVER, src, glyph->pix, buf->pix, 0, 0, 0, 0,
|
PIXMAN_OP_OVER, src, glyph->pix, buf->pix, 0, 0, 0, 0,
|
||||||
x + glyph->x, y + term->fonts[0]->ascent - glyph->y,
|
x + glyph->x, y + font_baseline(term) - glyph->y,
|
||||||
glyph->width, glyph->height);
|
glyph->width, glyph->height);
|
||||||
pixman_image_unref(src);
|
pixman_image_unref(src);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue