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.
This commit is contained in:
Jules Aguillon 2024-05-29 15:56:08 +02:00
parent 39b3f50aa3
commit cf1aaa3bdf
3 changed files with 2050 additions and 19 deletions

View File

@ -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

2037
srcs/compose/keysymdef.h Normal file

File diff suppressed because it is too large Load Diff