From cf1aaa3bdfcb25388dd0ced888d2ad024fe4a029 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 29 May 2024 15:56:08 +0200 Subject: Add compose sequences for Greek, Cyrillic, Hebrew and more Parse key names from keysymdef.h, which is distributed with Xorg. The Greek, Cyrillic and Hebrew sequences referenced these keysyms. This increases the number of sequences from 2043 to 2668. --- srcs/compose/compile.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'srcs/compose/compile.py') diff --git a/srcs/compose/compile.py b/srcs/compose/compile.py index 2cb060e..aa3b7f8 100644 --- a/srcs/compose/compile.py +++ b/srcs/compose/compile.py @@ -1,23 +1,17 @@ -import textwrap, sys, re, string, json +import textwrap, sys, re, string, json, os -# Names not defined in Compose.pre -xkb_char_extra_names = { - "space": " ", - "minus": "-", - "asterisk": "*", - "colon": ":", - "equal": "=", - "exclam": "!", - "grave": "`", - "parenleft": "(", - "parenright": ")", - "percent": "%", - "period": ".", - "plus": "+", - "question": "?", - "semicolon": ";", - "underscore": "_", - } +# Parse symbol names from keysymdef.h. Many compose sequences in +# en_US_UTF_8_Compose.pre reference theses. For example, all the sequences on +# the Greek, Cyrillic and Hebrew scripts need these symbols. +def parse_keysymdef_h(): + with open(os.path.join(os.path.dirname(__file__), "keysymdef.h"), "r") as inp: + keysym_re = re.compile(r'^#define XK_(\S+)\s+\S+\s*/\*.U\+([0-9a-fA-F]+)\s') + for line in inp: + m = re.match(keysym_re, line) + if m != None: + yield (m.group(1), chr(int(m.group(2), 16))) + +xkb_char_extra_names = dict(parse_keysymdef_h()) dropped_sequences = 0 -- cgit v1.2.3