unicodedata: update the script direction list to Unicode 14.0

same as https://github.com/harfbuzz/harfbuzz/blob/3.2.0/src/hb-common.cc#L514-L613
This commit is contained in:
Cosimo Lupo 2022-01-11 13:19:01 +00:00
parent e778f2c3f4
commit 09e2d1d548
2 changed files with 8 additions and 2 deletions

View File

@ -134,8 +134,10 @@ def script_code(script_name, default=KeyError):
return default
# The data on script direction is taken from CLDR 37:
# https://github.com/unicode-org/cldr/blob/release-37/common/properties/scriptMetadata.txt
# The data on script direction is taken from Harfbuzz source code:
# https://github.com/harfbuzz/harfbuzz/blob/3.2.0/src/hb-common.cc#L514-L613
# This in turn references the following "Script_Metadata" document:
# https://docs.google.com/spreadsheets/d/1Y90M0Ie3MUJ6UVCRDOypOtijlMDLNNyyLk36T6iMu0o
RTL_SCRIPTS = {
# Unicode-1.1 additions
'Arab', # Arabic
@ -200,6 +202,9 @@ RTL_SCRIPTS = {
# Unicode-13.0 additions
'Chrs', # Chorasmian
'Yezi', # Yezidi
# Unicode-14.0 additions
'Ougr', # Old Uyghur
}
def script_horizontal_direction(script_code, default=KeyError):

View File

@ -240,6 +240,7 @@ def test_script_horizontal_direction():
assert unicodedata.script_horizontal_direction("Latn") == "LTR"
assert unicodedata.script_horizontal_direction("Arab") == "RTL"
assert unicodedata.script_horizontal_direction("Thaa") == "RTL"
assert unicodedata.script_horizontal_direction("Ougr") == "RTL"
with pytest.raises(KeyError):
unicodedata.script_horizontal_direction("Azzz")