def script_key_to_scripts(script_key): """First script in list is the 'default' script.""" if script_key == 'LGC': return ['Latn', 'Grek', 'Cyrl'] elif script_key == 'Aran': return ['Arab'] elif script_key == 'HST': raise ValueError('!do not know scripts for HST script key') else: if script_key not in lang_data.scripts(): raise ValueError('!not a script: %s' % script_key) return [script_key]
def script_key_to_primary_script(script_key): """We need a default script for a font, and fonts using a 'script key' support multiple fonts. This lets us pick a default sample for a font based on it. The sample is named with a script that can include 'Jpan' so 'Jpan' should be the primary script in this case.""" if script_key == 'LGC': return 'Latn' if script_key == 'Aran': return 'Arab' if script_key == 'HST': raise ValueError('!do not know scripts for HST script key') if script_key not in lang_data.scripts(): raise ValueError('!not a script key: %s' % script_key) return script_key
def script_key_to_primary_script(script_key): """We need a default script for a font, and fonts using a 'script key' support multiple fonts. This lets us pick a default sample for a font based on it. The sample is named with a script that can include 'Jpan' so 'Jpan' should be the primary script in this case.""" if script_key == "LGC": return "Latn" if script_key == "Aran": return "Arab" if script_key == "HST": raise ValueError("!do not know scripts for HST script key") if script_key == "MONO": return "Latn" if script_key in ["MUSE", "SYM2"]: return "Zsym" if script_key not in lang_data.scripts(): raise ValueError("!not a script key: %s" % script_key) return script_key