Fix horizontal alignment of emoji incorrect becase rendered_width was not being set after switching to using cairo to render them

Fixes #9395
This commit is contained in:
Kovid Goyal
2026-01-20 20:01:20 +05:30
parent a53d5b2fae
commit a88cb2d14d
2 changed files with 6 additions and 0 deletions

View File

@@ -197,6 +197,9 @@ Detailed list of changes
- Wayland: Remove usage of the wayland color management protocol to inform
compositors of the color space used by kitty
- Linux: Fix a regression in 0.40 that caused horizontal alignment for emoji to
be incorrect in some cases (:iss:`9395`)
0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -858,6 +858,8 @@ render_glyph_with_cairo(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned
g.y = fm.ascent;
memset(self->cairo.buf, 0, self->cairo.stride * self->cairo.height);
cairo_set_source_rgba(self->cairo.cr, fg.r / 255., fg.g / 255., fg.b / 255., fg.a / 255.);
cairo_text_extents_t extents;
cairo_glyph_extents(self->cairo.cr, &g, 1, &extents);
cairo_show_glyphs(self->cairo.cr, &g, 1);
cairo_surface_flush(self->cairo.surface);
#if 0
@@ -874,6 +876,7 @@ render_glyph_with_cairo(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned
ans->rows = height;
ans->bitmap_left = (int)bb.x_bearing;
ans->bitmap_top = -(int)bb.y_bearing;
ans->right_edge = (int)ceil(extents.x_advance);
return true;
}