0.47.3: color/bitmap emoji rendered far too small (fontconfig size matrix double-applied)
After updating to 0.47.3, all color emoji render shrunk to a tiny dot in the top-left of their cell. It happens everywhere color emoji appear (shell prompt, neovim, plain `printf`), not just one app.
This is the same visual symptom as #10123 (closed with "use symbol_map"), but I think that workaround misses the actual cause, which is a fontconfig size matrix being applied twice. Details below.
### Repro
```sh
kitty --config NONE sh -c 'printf "\U0001F40D snake\n"; sleep 5'
```
The snake shows as a dot instead of a full-cell emoji.
### Bisect
0.47.2 renders it correctly, 0.47.3 does not. The only font/glyph change in `v0.47.2..v0.47.3` is [ee937bdd1b](https://github.com/kovidgoyal/kitty/commit/ee937bdd1b86a23df4bc1698f01128ea979b753c) ("freetype: route FC_MATRIX through cairo for color glyphs"). Reverting just that commit on top of 0.47.3 restores correct rendering.
### Root cause
Noto Color Emoji is a fixed-size CBDT bitmap font, so fontconfig hands every consumer a downscale matrix to fit it to the requested pixel size. On this system:
```
$ fc-match -v 'Noto Color Emoji' | grep matrix
matrix: [0.114679 0; 0 0.114679](w)
```
kitty already does its own cell-fit scaling for color glyphs (`fit_cairo_glyph`). Before `ee937bdd1b` it ignored the fontconfig matrix for these. Now `apply_cairo_font_size` feeds that `~0.1147x` matrix into the cairo font matrix as well, so the already-cell-sized emoji gets scaled down by another ~9x. Font selection is correct, only the scale is wrong:
```
$ kitty --debug-font-fallback sh -c 'printf "\U0001F40D\n"'
U+1f40d emoji_presentation Face(family=Noto Color Emoji ... color=True)
```
So the matrix path in `apply_cairo_font_size` probably needs to be skipped for fixed-size / color-bitmap faces, where the size is already handled by `fit_cairo_glyph` rather than the font matrix.
### Environment
```
kitty 0.47.3
Linux 7.0.12-xanmod1 x86_64, Wayland (niri)
Noto Color Emoji 2.051 (CBDT bitmap)
freetype 2.14.2, fontconfig 2.17.1, cairo 1.18.4
```
0 条评论