% Language definition file (part of polyglossia v2.2 -- 2024/07/15) % \ProvidesFile{gloss-sanskrit.ldf}[polyglossia: module for Sanskrit] \RequirePackage{devanagaridigits} \PolyglossiaSetup{sanskrit}{ bcp47=sa-Deva, bcp47-language=sa, bcp47-script=Deva, bcp47-casing=sa-Deva, langtag=SAN, hyphennames={sanskrit,prakrit}, hyphenmins={1,3}, frenchspacing=true, fontsetup=false, % will be done below localnumeral=sanskritnumerals } % BCP-47 compliant aliases \setlanguagealias*{sanskrit}{sa} \setlanguagealias*[script=devanagari]{sanskrit}{sa-Deva} \setlanguagealias*[script=malayalam]{sanskrit}{sa-Mlym} \setlanguagealias*[script=telugu]{sanskrit}{sa-Telu} \setlanguagealias*[script=bengali]{sanskrit}{sa-Beng} \setlanguagealias*[script=kannada]{sanskrit}{sa-Knda} \setlanguagealias*[script=gujarati]{sanskrit}{sa-Gujr} \setlanguagealias*[script=latin]{sanskrit}{sa-Latn} \def\fontsetup@sanskrit@devanagari{% \SetLanguageKeys{sanskrit}{scripttag=deva,script=Devanagari,bcp47=sa-Deva,bcp47-language=sa,bcp47-script=Deva,bcp47-casing=sa-Deva} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@gujarati{% \SetLanguageKeys{sanskrit}{scripttag=gujr,script=Gujarati,bcp47=sa-Gujr,bcp47-language=sa,bcp47-script=Gujr,bcp47-casing=sa-Gujr} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@malayalam{% \SetLanguageKeys{sanskrit}{scripttag=mlym,script=Malayalam,bcp47=sa-Mlym,bcp47-language=sa,bcp47-script=Mlym,bcp47-casing=sa-Mlym} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@bengali{% \SetLanguageKeys{sanskrit}{scripttag=beng,script=Bengali,bcp47=sa-Beng,bcp47-language=sa,bcp47-script=Beng,bcp47-casing=sa-Beng} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@kannada{% \SetLanguageKeys{sanskrit}{scripttag=knda,script=Kannada,bcp47=sa-Knda,bcp47-language=sa,bcp47-script=Knda,bcp47-casing=sa-Knda} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@telugu{% \SetLanguageKeys{sanskrit}{scripttag=telu,script=Telugu,bcp47=sa-Relu,bcp47-language=sa,bcp47-script=Relu,bcp47-casing=sa-Relu} \SetupNonLatinPolyglossiaFont{sanskrit}} \def\fontsetup@sanskrit@latin{% \SetLanguageKeys{sanskrit}{scripttag=latn,script=Latin,bcp47=sa-Latn,bcp47-language=sa,bcp47-script=Latn,bcp47-casing=sa-Latn} \SetupLatinPolyglossiaFont{sanskrit}} \newif\ifsanskrit@devanagari@numerals \sanskrit@devanagari@numeralstrue \DeclareKeys[polyglossia/gloss/sanskrit] { script.code = \@ifundefined{fontsetup@sanskrit@#1}% {\xpg@error{`#1' is not a valid script for Sanskrit}}% {\csname fontsetup@sanskrit@#1\endcsname}, script.default:n = devanagari, numerals.choice:, numerals / devanagari.code = {% \sanskrit@devanagari@numeralstrue \SetLanguageKeys{sanskrit}{bcp47-extension-u=nu-deva}% }, numerals / western.code = {% \sanskrit@devanagari@numeralsfalse \SetLanguageKeys{sanskrit}{bcp47-extension-u=nu-latn}% }, numerals.default:n = devanagari, numerals/unknown.code = \xpg@warning{Unknown Sanskrit numeral `#1'} } % Register default options \InitializeGlossOptions{sanskrit}{script=devanagari,numerals=devanagari} % Use \providecommand here as the ldf file might % be reloaded via BCP. \providecommand{\sanskritnumerals}[2]{\sanskritnumber{#2}} \def\sanskritnumber#1{% \ifsanskrit@devanagari@numerals \devanagaridigits{\number#1}% \else \number#1% \fi% } \ifluatex \directlua{require('polyglossia-sanskrit')}% \else \newXeTeXintercharclass\sanskrit@questionexclamation % ! ? ‼ ⁇ ⁈ ⁉ ‽ \newXeTeXintercharclass\sanskrit@punctthin % : ; danda double_danda \fi \def\sanskrit@punctthinspace{{\unskip\thinspace}} \def\sanskrit@punctuation{% \ifluatex \directlua{polyglossia.activate_sanskrit_punct()}% \else \XeTeXinterchartokenstate=1% \XeTeXcharclass `\! \sanskrit@questionexclamation \XeTeXcharclass `\? \sanskrit@questionexclamation \XeTeXcharclass `\‼ \sanskrit@questionexclamation \XeTeXcharclass `\⁇ \sanskrit@questionexclamation \XeTeXcharclass `\⁈ \sanskrit@questionexclamation \XeTeXcharclass `\⁉ \sanskrit@questionexclamation \XeTeXcharclass `\‽ \sanskrit@questionexclamation % interrobang, U+203D \XeTeXcharclass `\: \sanskrit@punctthin \XeTeXcharclass `\; \sanskrit@punctthin \XeTeXcharclass `\। \sanskrit@punctthin % danda, U+0964 \XeTeXcharclass `\॥ \sanskrit@punctthin % double danda, U+0965 \XeTeXinterchartoks \z@ \sanskrit@questionexclamation = \sanskrit@punctthinspace \XeTeXinterchartoks \z@ \sanskrit@punctthin = \sanskrit@punctthinspace \XeTeXinterchartoks \sanskrit@questionexclamation \sanskrit@punctthin = \sanskrit@punctthinspace \fi } \def\nosanskrit@punctuation{% \ifluatex \directlua{polyglossia.deactivate_sanskrit_punct()}% \else \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ \XeTeXcharclass `\‼ \z@ \XeTeXcharclass `\⁇ \z@ \XeTeXcharclass `\⁈ \z@ \XeTeXcharclass `\⁉ \z@ \XeTeXcharclass `\‽ \z@ \XeTeXcharclass `\: \z@ \XeTeXcharclass `\; \z@ \XeTeXcharclass `\। \z@ \XeTeXcharclass `\॥ \z@ \XeTeXinterchartokenstate=0% \fi } \def\noextras@sanskrit{% \nosanskrit@punctuation% } \def\blockextras@sanskrit{% \sanskrit@punctuation% } \endinput