module Data.Text.ParagraphLayout.Internal.Script (ScriptCode, charScript)
where
-- TODO: Use a direct interface to the ICU library, if possible.
-- The unicode-data-scripts package and the shortening code in this file use
-- hardcoded ranges, which may get out of sync with ICU.
import Unicode.Char.General.Scripts
type ScriptCode = String
-- | A short script code for the given character, as expected by HarfBuzz.
charScript :: Char -> ScriptCode
charScript = code . script
-- Hardcoded shortenings of script codes as of Unicode 15.0.0.
code :: Script -> ScriptCode
code Adlam = "Adlm"
code Ahom = "Ahom"
code AnatolianHieroglyphs = "Hluw"
code Arabic = "Arab"
code Armenian = "Armn"
code Avestan = "Avst"
code Balinese = "Bali"
code Bamum = "Bamu"
code BassaVah = "Bass"
code Batak = "Batk"
code Bengali = "Beng"
code Bhaiksuki = "Bhks"
code Bopomofo = "Bopo"
code Brahmi = "Brah"
code Braille = "Brai"
code Buginese = "Bugi"
code Buhid = "Buhd"
code CanadianAboriginal = "Cans"
code Carian = "Cari"
code CaucasianAlbanian = "Aghb"
code Chakma = "Cakm"
code Cham = "Cham"
code Cherokee = "Cher"
code Chorasmian = "Chrs"
code Common = "Zyyy"
code Coptic = "Copt"
code Cuneiform = "Xsux"
code Cypriot = "Cprt"
code CyproMinoan = "Cpmn"
code Cyrillic = "Cyrl"
code Deseret = "Dsrt"
code Devanagari = "Deva"
code DivesAkuru = "Diak"
code Dogra = "Dogr"
code Duployan = "Dupl"
code EgyptianHieroglyphs = "Egyp"
code Elbasan = "Elba"
code Elymaic = "Elym"
code Ethiopic = "Ethi"
code Georgian = "Geor"
code Glagolitic = "Glag"
code Gothic = "Goth"
code Grantha = "Gran"
code Greek = "Grek"
code Gujarati = "Gujr"
code GunjalaGondi = "Gong"
code Gurmukhi = "Guru"
code Han = "Hani"
code Hangul = "Hang"
code HanifiRohingya = "Rohg"
code Hanunoo = "Hano"
code Hatran = "Hatr"
code Hebrew = "Hebr"
code Hiragana = "Hira"
code ImperialAramaic = "Armi"
code Inherited = "Zinh"
code InscriptionalPahlavi = "Phli"
code InscriptionalParthian = "Prti"
code Javanese = "Java"
code Kaithi = "Kthi"
code Kannada = "Knda"
code Katakana = "Kana"
code Kawi = "Kawi"
code KayahLi = "Kali"
code Kharoshthi = "Khar"
code KhitanSmallScript = "Kits"
code Khmer = "Khmr"
code Khojki = "Khoj"
code Khudawadi = "Sind"
code Lao = "Laoo"
code Latin = "Latn"
code Lepcha = "Lepc"
code Limbu = "Limb"
code LinearA = "Lina"
code LinearB = "Linb"
code Lisu = "Lisu"
code Lycian = "Lyci"
code Lydian = "Lydi"
code Mahajani = "Mahj"
code Makasar = "Maka"
code Malayalam = "Mlym"
code Mandaic = "Mand"
code Manichaean = "Mani"
code Marchen = "Marc"
code MasaramGondi = "Gonm"
code Medefaidrin = "Medf"
code MeeteiMayek = "Mtei"
code MendeKikakui = "Mend"
code MeroiticCursive = "Merc"
code MeroiticHieroglyphs = "Mero"
code Miao = "Plrd"
code Modi = "Modi"
code Mongolian = "Mong"
code Mro = "Mroo"
code Multani = "Mult"
code Myanmar = "Mymr"
code Nabataean = "Nbat"
code NagMundari = "Nagm"
code Nandinagari = "Nand"
code NewTaiLue = "Talu"
code Newa = "Newa"
code Nko = "Nkoo"
code Nushu = "Nshu"
code NyiakengPuachueHmong = "Hmnp"
code Ogham = "Ogam"
code OlChiki = "Olck"
code OldHungarian = "Hung"
code OldItalic = "Ital"
code OldNorthArabian = "Narb"
code OldPermic = "Perm"
code OldPersian = "Xpeo"
code OldSogdian = "Sogo"
code OldSouthArabian = "Sarb"
code OldTurkic = "Orkh"
code OldUyghur = "Ougr"
code Oriya = "Orya"
code Osage = "Osge"
code Osmanya = "Osma"
code PahawhHmong = "Hmng"
code Palmyrene = "Palm"
code PauCinHau = "Pauc"
code PhagsPa = "Phag"
code Phoenician = "Phnx"
code PsalterPahlavi = "Phlp"
code Rejang = "Rjng"
code Runic = "Runr"
code Samaritan = "Samr"
code Saurashtra = "Saur"
code Sharada = "Shrd"
code Shavian = "Shaw"
code Siddham = "Sidd"
code SignWriting = "Sgnw"
code Sinhala = "Sinh"
code Sogdian = "Sogd"
code SoraSompeng = "Sora"
code Soyombo = "Soyo"
code Sundanese = "Sund"
code SylotiNagri = "Sylo"
code Syriac = "Syrc"
code Tagalog = "Tglg"
code Tagbanwa = "Tagb"
code TaiLe = "Tale"
code TaiTham = "Lana"
code TaiViet = "Tavt"
code Takri = "Takr"
code Tamil = "Taml"
code Tangsa = "Tnsa"
code Tangut = "Tang"
code Telugu = "Telu"
code Thaana = "Thaa"
code Thai = "Thai"
code Tibetan = "Tibt"
code Tifinagh = "Tfng"
code Tirhuta = "Tirh"
code Toto = "Toto"
code Ugaritic = "Ugar"
code Unknown = "Zzzz"
code Vai = "Vaii"
code Vithkuqi = "Vith"
code Wancho = "Wcho"
code WarangCiti = "Wara"
code Yezidi = "Yezi"
code Yi = "Yiii"
code ZanabazarSquare = "Zanb"