diff --git a/Lib/fontTools/unicodedata/__init__.py b/Lib/fontTools/unicodedata/__init__.py index afabbed14..7998e9dd5 100644 --- a/Lib/fontTools/unicodedata/__init__.py +++ b/Lib/fontTools/unicodedata/__init__.py @@ -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): diff --git a/Tests/unicodedata_test.py b/Tests/unicodedata_test.py index 2ae11beff..aac59bee8 100644 --- a/Tests/unicodedata_test.py +++ b/Tests/unicodedata_test.py @@ -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")