aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:29 +0000
commit83fd67409b5afb7c64a73d5bb084b0090ceedd56 (patch)
tree1b14d78f4dc9ee2db3a6c3511d85313531c6da6b /render.c
parentMerge branch 'fish-completions' (diff)
parentchangelog: move line-height entry from ‘changed’ to ‘added’ (diff)
Merge branch 'line-height-and-letter-spacing'
Closes #244
Diffstat (limited to 'render.c')
-rw-r--r--render.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/render.c b/render.c
index 16198589..51341365 100644
--- a/render.c
+++ b/render.c
@@ -256,7 +256,7 @@ color_dim_for_search(pixman_color_t *color)
static inline int
font_baseline(const struct terminal *term)
{
- return term->fonts[0]->ascent;
+ return term->font_y_ofs + term->fonts[0]->ascent;
}
static void
@@ -541,18 +541,20 @@ render_cell(struct terminal *term, pixman_image_t *pix,
pixman_image_t *clr_pix = pixman_image_create_solid_fill(&fg);
if (glyph != NULL) {
+ const int letter_x_ofs = term->font_x_ofs;
+
if (unlikely(pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8)) {
/* Glyph surface is a pre-rendered image (typically a color emoji...) */
if (!(cell->attrs.blink && term->blink.state == BLINK_OFF)) {
pixman_image_composite32(
PIXMAN_OP_OVER, glyph->pix, NULL, pix, 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + letter_x_ofs + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
}
} else {
pixman_image_composite32(
PIXMAN_OP_OVER, clr_pix, glyph->pix, pix, 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + letter_x_ofs + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
}
@@ -589,7 +591,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
pixman_image_composite32(
PIXMAN_OP_OVER, clr_pix, g->pix, pix, 0, 0, 0, 0,
- x + x_ofs + g->x, y + font_baseline(term) - g->y,
+ x + letter_x_ofs + x_ofs + g->x, y + font_baseline(term) - g->y,
g->width, g->height);
}
}
@@ -1691,6 +1693,8 @@ render_osd(struct terminal *term,
struct fcft_font *font = term->fonts[0];
pixman_color_t fg = color_hex_to_pixman(_fg);
+ const int x_ofs = term->font_x_ofs;
+
for (size_t i = 0; i < wcslen(text); i++) {
const struct fcft_glyph *glyph = fcft_glyph_rasterize(
font, text[i], term->font_subpixel);
@@ -1701,7 +1705,7 @@ render_osd(struct terminal *term,
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
pixman_image_composite32(
PIXMAN_OP_OVER, src, glyph->pix, buf->pix[0], 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + x_ofs + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
pixman_image_unref(src);
@@ -2268,6 +2272,7 @@ render_search_box(struct terminal *term)
struct fcft_font *font = term->fonts[0];
const int x_left = width - visible_width + margin;
+ const int x_ofs = term->font_x_ofs;
int x = x_left;
int y = margin;
pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]);
@@ -2415,13 +2420,13 @@ render_search_box(struct terminal *term)
/* Glyph surface is a pre-rendered image (typically a color emoji...) */
pixman_image_composite32(
PIXMAN_OP_OVER, glyph->pix, NULL, buf->pix[0], 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + x_ofs + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
} else {
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
pixman_image_composite32(
PIXMAN_OP_OVER, src, glyph->pix, buf->pix[0], 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + x_ofs + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
pixman_image_unref(src);
}