From 62e07743194c8051334ed9b23be90ce31ab80773 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 3 May 2020 11:03:22 +0200 Subject: unicode-combining: store seen combining chains "globally" in the term struct Instead of storing combining data per cell, realize that most combinations are re-occurring and that there's lots of available space left in the unicode range, and store seen base+combining combinations chains in a per-terminal array. When we encounter a combining character, we first try to pre-compose, like before. If that fails, we then search for the current base+combining combo in the list of previously seen combinations. If not found there either, we allocate a new combo and add it to the list. Regardless, the result is an index into this array. We store this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell. When rendering, we need to check if the cell character is a plain character, or if it's a composed character (identified by checking if the cell character is >= COMB_CHARS_LO). Then we render the grapheme pretty much like before. --- meson.build | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index eca6e0fd..f34a5e60 100644 --- a/meson.build +++ b/meson.build @@ -57,11 +57,8 @@ wayland_client = dependency('wayland-client') wayland_cursor = dependency('wayland-cursor') xkb = dependency('xkbcommon') -add_project_arguments('-DFOOT_UNICODE_MAX_COMBINING_CHARS=@0@'.format( - get_option('unicode-max-combining-chars')), language: 'c') add_project_arguments('-DFOOT_UNICODE_PRECOMPOSE=@0@'.format( - get_option('unicode-max-combining-chars') > 0 and get_option('unicode-precompose')), - language: 'c') + get_option('unicode-precompose')), language: 'c') tllist = dependency('tllist', version: '>=1.0.1', fallback: 'tllist') fcft = dependency('fcft', version: ['>=2.0.0', '<2.1.0'], fallback: 'fcft') @@ -95,7 +92,7 @@ foreach prot : [ command: [wscanner_prog, 'private-code', '@INPUT@', '@OUTPUT@']) endforeach -if get_option('unicode-max-combining-chars') > 0 and get_option('unicode-precompose') +if get_option('unicode-precompose') generate_unicode_precompose_sh = files('scripts/generate-unicode-precompose.sh') unicode_data = custom_target( 'unicode-data', @@ -167,8 +164,7 @@ subdir('doc') summary( { - 'Unicode max combining chars': get_option('unicode-max-combining-chars'), - 'Unicode precompose': get_option('unicode-max-combining-chars') > 0 and get_option('unicode-precompose'), + 'Unicode precompose': get_option('unicode-precompose'), }, bool_yn: true ) -- cgit v1.3