vt: only apply VS-15/16 to valid sequences

At compile time, build a lookup table from the Unicode data file
'emoji-variation-sequences.txt'.

At run-time, when we detect a VS-15/16 sequence, do a lookup in this
table, and enforce the variation selector iff the sequence is valid.

Closes #1742
This commit is contained in:
Daniel Eklöf 2024-06-24 21:18:37 +02:00
parent 94583703e1
commit 9665661445
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 903 additions and 6 deletions

View file

@ -199,6 +199,14 @@ builtin_terminfo = custom_target(
'@default_terminfo@', foot_terminfo, 'foot', '@OUTPUT@']
)
generate_emoji_variation_sequences = files('scripts/generate-emoji-variation-sequences.py')
emoji_variation_sequences = custom_target(
'generate_emoji_variation_sequences',
input: 'unicode/emoji-variation-sequences.txt',
output: 'emoji-variation-sequences.h',
command: [python, generate_emoji_variation_sequences, '@INPUT@', '@OUTPUT@']
)
common = static_library(
'common',
'log.c', 'log.h',
@ -227,7 +235,8 @@ vtlib = static_library(
'osc.c', 'osc.h',
'sixel.c', 'sixel.h',
'vt.c', 'vt.h',
builtin_terminfo, wl_proto_src + wl_proto_headers,
builtin_terminfo, emoji_variation_sequences,
wl_proto_src + wl_proto_headers,
version,
dependencies: [libepoll, pixman, fcft, tllist, wayland_client, xkb, utf8proc],
link_with: [common, misc],