• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EXCEPTIONS = {
15    "Hira": "kana",
16    "Hrkt": "kana",
17    "Laoo": "lao ",
18    "Yiii": "yi  ",
19    "Nkoo": "nko ",
20    "Vaii": "vai ",
21    "Zinh": DEFAULT_SCRIPT,
22    "Zyyy": DEFAULT_SCRIPT,
23    "Zzzz": DEFAULT_SCRIPT,
24}
25
26NEW_SCRIPT_TAGS = {
27    "Beng": ("bng2",),
28    "Deva": ("dev2",),
29    "Gujr": ("gjr2",),
30    "Guru": ("gur2",),
31    "Knda": ("knd2",),
32    "Mlym": ("mlm2",),
33    "Orya": ("ory2",),
34    "Taml": ("tml2",),
35    "Telu": ("tel2",),
36    "Mymr": ("mym2",),
37}
38
39NEW_SCRIPT_TAGS_REVERSED = {
40    value: key for key, values in NEW_SCRIPT_TAGS.items() for value in values
41}
42