xref: /aosp_15_r20/external/fonttools/Lib/fontTools/unicodedata/OTTags.py (revision e1fe3e4ad2793916b15cccdc4a7da52a7e1dd0e9)
1# Data updated to OpenType 1.8.2 as of January 2018.
2
3# Complete list of OpenType script tags at:
4# https://www.microsoft.com/typography/otspec/scripttags.htm
5
6# Most of the script tags are the same as the ISO 15924 tag but lowercased,
7# so we only have to handle the exceptional cases:
8# - KATAKANA and HIRAGANA both map to 'kana';
9# - spaces at the end are preserved, unlike ISO 15924;
10# - we map special script codes for Inherited, Common and Unknown to DFLT.
11
12DEFAULT_SCRIPT = "DFLT"
13
14SCRIPT_ALIASES = {
15    "jamo": "hang",
16}
17
18SCRIPT_EXCEPTIONS = {
19    "Hira": "kana",
20    "Hrkt": "kana",
21    "Laoo": "lao ",
22    "Yiii": "yi  ",
23    "Nkoo": "nko ",
24    "Vaii": "vai ",
25    "Zmth": "math",
26    "Zinh": DEFAULT_SCRIPT,
27    "Zyyy": DEFAULT_SCRIPT,
28    "Zzzz": DEFAULT_SCRIPT,
29}
30
31SCRIPT_EXCEPTIONS_REVERSED = {
32    "math": "Zmth",
33}
34
35NEW_SCRIPT_TAGS = {
36    "Beng": ("bng2",),
37    "Deva": ("dev2",),
38    "Gujr": ("gjr2",),
39    "Guru": ("gur2",),
40    "Knda": ("knd2",),
41    "Mlym": ("mlm2",),
42    "Orya": ("ory2",),
43    "Taml": ("tml2",),
44    "Telu": ("tel2",),
45    "Mymr": ("mym2",),
46}
47
48NEW_SCRIPT_TAGS_REVERSED = {
49    value: key for key, values in NEW_SCRIPT_TAGS.items() for value in values
50}
51