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:
parent
e778f2c3f4
commit
09e2d1d548
@ -134,8 +134,10 @@ def script_code(script_name, default=KeyError):
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
# The data on script direction is taken from CLDR 37:
|
# The data on script direction is taken from Harfbuzz source code:
|
||||||
# https://github.com/unicode-org/cldr/blob/release-37/common/properties/scriptMetadata.txt
|
# 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 = {
|
RTL_SCRIPTS = {
|
||||||
# Unicode-1.1 additions
|
# Unicode-1.1 additions
|
||||||
'Arab', # Arabic
|
'Arab', # Arabic
|
||||||
@ -200,6 +202,9 @@ RTL_SCRIPTS = {
|
|||||||
# Unicode-13.0 additions
|
# Unicode-13.0 additions
|
||||||
'Chrs', # Chorasmian
|
'Chrs', # Chorasmian
|
||||||
'Yezi', # Yezidi
|
'Yezi', # Yezidi
|
||||||
|
|
||||||
|
# Unicode-14.0 additions
|
||||||
|
'Ougr', # Old Uyghur
|
||||||
}
|
}
|
||||||
|
|
||||||
def script_horizontal_direction(script_code, default=KeyError):
|
def script_horizontal_direction(script_code, default=KeyError):
|
||||||
|
@ -240,6 +240,7 @@ def test_script_horizontal_direction():
|
|||||||
assert unicodedata.script_horizontal_direction("Latn") == "LTR"
|
assert unicodedata.script_horizontal_direction("Latn") == "LTR"
|
||||||
assert unicodedata.script_horizontal_direction("Arab") == "RTL"
|
assert unicodedata.script_horizontal_direction("Arab") == "RTL"
|
||||||
assert unicodedata.script_horizontal_direction("Thaa") == "RTL"
|
assert unicodedata.script_horizontal_direction("Thaa") == "RTL"
|
||||||
|
assert unicodedata.script_horizontal_direction("Ougr") == "RTL"
|
||||||
|
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
unicodedata.script_horizontal_direction("Azzz")
|
unicodedata.script_horizontal_direction("Azzz")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user