[PATCH] Fix emoji font support

Maxime Coste mawww at kakoune.org
Sat Feb 8 22:33:54 CET 2020


Hello,

On Fri, 7 Feb 2020 07:42:06 +0100, Marc Lehmann <schmorp at schmorp.de> wrote:
> Is there a better explanation available on what this patch actually
> does? Preferably with some examples? (For example, what is meant by
> scaling applied by Xft - a scaling matrix, some size calculation, or
> what? And what does this have to do with emojis only?).

This patch is related to the one available there:

https://gitlab.freedesktop.org/xorg/lib/libxft/merge_requests/1

My objective with those two patches was to enable color emoji rendering in
rxvt-unicode (and as a side effect in other applications relying on libXft).

Emoji fonts such as Noto Color Emoji contains a single pixelsize (124x124 IIRC)
set of BGRA glyphs, hence they require scaling.

The transformation applied is an arbitrary matrix provided by fontconfig
(most of the time identity, scaling in the case of BGRA glyphs, can also be
an auto slanting one).

Note that in the vast majority of cases, there is just no transformation applied
and the computation should be equivalent. It seems more correct in principle to
respect the ascent/descent/height as computed by libXft, and in practice I have
not experienced differences in my testing, but from looking at the code there
would be one difference in the non-transformed case: libXft does not add 63
before shifting, so it would round down when rxvt-unicode currently rounds up.
 
> The patch, like any similar patch, has major potential to break things for
> a lot of people, so it's unlikely to be applied without a thorough
> understanding of what it exactly does, what it solves, and what the
> implications are.

Fair enough.
 
> So it only affects bitmap fonts? Any specific font that exhibits these
> issues?

The intention is to enable Noto Color Emoji.

In any case, the rest of the patch (everything but the hunk at line 1239)
is IMHO improving the correctness of rxvt-unicode by making it use text_t
for width computation, respecting the UNICODE_3 setting. I think this could
be applied independently.

Hope this makes a bit more sense,

Best regards,

Maxime Coste.



More information about the rxvt-unicode mailing list