From 82e472ba469c44272e6e3cfd5b9e047a7121ef68 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 17 Dec 2024 11:27:09 +0100 Subject: [PATCH] Compose: Allow to force string final states Appending the ':' character to a sequence result forces it to be a string final state. This will cause a KeyValue lookup that would normally not happen for single-character results. This is useful to make Tamil letters smaller, even when they are the result of a Shift. --- srcs/compose/compile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/srcs/compose/compile.py b/srcs/compose/compile.py index e8feba3..d64a630 100644 --- a/srcs/compose/compile.py +++ b/srcs/compose/compile.py @@ -195,6 +195,9 @@ def make_automata(tries): # There are two encoding for leafs: character final state for 15-bit # characters and string final state for the rest. if len(c) > 1 or ord(c[0]) > 32767: # String final state + # A ':' can be added to the result of a sequence to force a string + # final state. For example, to go through KeyValue lookup. + if c.startswith(":"): c = c[1:] javachars = array('H', c.encode("UTF-16-LE")) states.append((-1, len(javachars) + 1)) for c in javachars: