You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tex-compiler/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf

176 lines
6.8 KiB

\ProvidesFile{gloss-tibetan.ldf}[polyglossia: module for tibetan]
%% Copyright 2013 Elie Roux
%% Under the CC0 license <http://creativecommons.org/publicdomain/zero/1.0/>
%%
%% A good font to make tests is \newfontfamily\tibetanfont{Tibetan Machine Uni}
%%
\PolyglossiaSetup{tibetan}{
bcp47=bo,
script=Tibetan,
scripttag=tibt,
langtag=TIB,
hyphennames={nohyphenation},
fontsetup=true,
localnumeral=tibetannumerals
%TODO localalph={xxx@alph,xxx@Alph}
}
% BCP-47 compliant aliases
\setlanguagealias*{tibetan}{bo}
\newif\if@tibetan@numerals
\def\tmp@tibetan{tibetan}
\define@key{tibetan}{numerals}[tibetan]{%
\def\@tmpa{#1}%
\ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue\else
\@tibetan@numeralsfalse\fi
}
\ifluatex
\newluatexattribute\xpg@tibteol %
\directlua{polyglossia.load_tibt_eol()}%
\fi
\def\tibetan@eol{%
\ifluatex %
\xpg@tibteol=1\relax %
\directlua{polyglossia.activate_tibt_eol()}%
\else %
\XeTeXlinebreaklocale "bo"%
\XeTeXlinebreakskip=0pt plus 0.1em% doesn't do much, but doesn't harm I guess...
\fi %
}
\def\notibetan@eol{%
\ifluatex %
\xpg@tibteol=0\relax %
%\directlua{polyglossia.activate_tibt_eol()}%
\else %
\XeTeXlinebreaklocale "en"% en? really?
\XeTeXlinebreakskip=0pt plus 0pt%
\fi %
}
% Register default options
\xpg@initialize@gloss@options{tibetan}{numerals=tibetan}
% some are known, but very few
% a few come from "Standardizing Tibetan Terms of Information Technology"
% from the China Tibetology Research Center
\def\captionstibetan{%
%\def\refname{}%
\def\abstractname{གནད་བསས།}%
\def\bibname{དཔ་ཆའ་ཐ་གཞང་།}% or dpe deb kyi re'u mig?
\def\prefacename{དཔ་དབ་ཀ་གང་བརད།}% or gleng brjod 'god pa or ngo sprod?
\def\chaptername{ལ་}%
\def\appendixname{ཞར་བང་།}%
\def\contentsname{དཀར་ཆག།}%
%\def\listfigurename{}%
%\def\listtablename{}%
\def\indexname{གསལ་བང་།}%
\def\figurename{པར་རས་}% or dpe ris?
\def\tablename{ར་མག་}%
%\def\thepart{}%
\def\partname{ཆ་ཤས་}%
\def\pagename{ཤག་}%
%\def\seename{}%
%\def\alsoname{}%
%\def\enclname{}%
\def\ccname{འད་བཤས་ལན་མཁན་}%
%\def\headtoname{}%
\def\proofname{བདན་དཔང་།}% not sure about this one...
\def\glossaryname{མང་ཚག་ར་མག།}%
}
\def\datetibetan{%
\def\tibetan@month{%
\ifcase\month\or
་དང་པ\or ཟ་གཉས་པ\or ཟ་གསམ་པ%
\or ཟ་བཞ་པ\or ཟ་ལ་པ\or ཟ་དག་པ\or ཟ་བདན་པ%
\or ཟ་བརད་པ\or ཟ་དག་པ\or ཟ་བཆ་པ\or ཟ་བཆ་གཅག་པ\or ཟ་བཆ་གཉས་པ\fi}%
\def\tibetan@daynum{%
\ifcase\day\or དང་པ\or གཉས་པ\or གསམ་པ \or བཞ་པ\or ལ་པ\or དག་པ\or བདན་པ\or བརད་པ\or དག་པ\or བཆ་པ%
\or བཆ་གཅག་པ\or བཆ་གཉས་པ\or བཆ་གསམ་པ\or བཆ་བཞ་པ\or བཆ་ལ་པ\or བཆ་དག་པ\or བཆ་བདན་པ\or བཆ་བརད་པ\or བཆ་དག་པ\or ཉ་ཤ་པ%
\or ཉ་ཤ་ར་གཅག་པ\or ཉ་ཤ་ར་གཉས་པ\or ཉ་ཤ་ར་གསམ་པ\or ཉ་ཤ་ར་བཞ་པ\or ཉ་ཤ་ར་ལ་པ\or ཉ་ཤ་ར་དག་པ\or ཉ་ཤ་ར་བདན་པ\or ཉ་ཤ་ར་བརད་པ\or ཉ་ཤ་ར་དག་པ\or སམ་ཆ་པ%
\or སམ་ཆ་ས་གཅག་པ\fi}%
% As we use gregorian calendar, it's better to stick with spyi lo
%\newcount\tibetan@year%
%\tibetan@year=\year%
%\advance\tibetan@year by 127% this is bod rgyal lo, the most common, but there are others...
% I'm not sure the / character is in most tibetan fonts
%\def\today{\tibetannumber\day /\tibetannumber\day /\tibetannumber\year}%
\def\today{\tibetannumber\day །\tibetannumber\month །\tibetannumber\year}%
% this is more litterate, but longer
%\def\today{ས་ལ་\tibetannumber\year ་ས་\tibetan@month{}་ད་རས་\tibetan@daynum{}།}%
}
\def\tibetandigits#1{\expandafter\@tibetan@digits #1@}
\def\@tibetan@digits#1{%
\ifx @#1% then terminate
\else
\ifx0#1༠\else\ifx1#1༡\else\ifx2#1༢\else\ifx3#1༣\else\ifx4#1༤\else\ifx5#1༥\else\ifx6#1༦\else\ifx7#1༧\else\ifx8#1༨\else\ifx9#1༩\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\expandafter\@tibetan@digits
\fi
}
\def\tibetannumber#1{%
\if@tibetan@numerals
\tibetandigits{\number#1}%
%%{\protect\addfontfeature{Mapping=tibetandigits}\protect\number#1}
\else
\number#1%
%%{\protect\reset@font\number#1}
\fi}
\def\@tibetanalph#1{%
\ifcase#1\or ཀ\or ཁ\or ག\or ང\or ཅ\or ཆ\or ཇ\or ཉ\or ཏ\or ཐ\or ད\or ན\or པ\or
ཕ\or བ\or མ\or ཙ\or ཚ\or ཛ\or ཝ\or ཞ\or ཟ\or འ\or ཡ\or ར\or ལ\or ཤ\or ས\or ཧ\or ཨ
\else\xpg@ill@value{#1}{@tibetanalph}\fi}
\def\tibetanAlph#1{\expandafter\@tibetanAlph\csname c@#1\endcsname}
\def\@tibetanAlph#1{%
\ifcase#1\or ཀ\or ཁ\or ག\or ང\or ཅ\or ཆ\or ཇ\or ཉ\or ཏ\or ཐ\or ད\or ན\or པ\or
ཕ\or བ\or མ\or ཙ\or ཚ\or ཛ\or ཝ\or ཞ\or ཟ\or འ\or ཡ\or ར\or ལ\or ཤ\or ས\or ཧ\or ཨ
\else\xpg@ill@value{#1}{@tibetanalph}\fi}
\newcommand{\tibetanumerals}[2]{\tibetannumber{#2}}
\def\tibetan@numbers{%
\if@tibetan@numerals
\let\@alph\@tibetanalph%
\let\@Alph\@tibetanAlph%
\fi
}
\def\notibetan@numbers{%
\let\@alph\latin@alph%
\let\@Alph\latin@Alph%
}
\def\tibetan@globalnumbers{%
\let\xpg@orig@arabic\@arabic%
\let\@arabic\tibetannumber%
\renewcommand{\thefootnote}{\localnumeral*{footnote}}%
}
\def\notibetan@globalnumbers{%
\let\@arabic\xpg@orig@arabic%
}
\def\noextras@tibetan{%
\notibetan@eol%
\ifcsname xpg@orig@baselinestretch\endcsname\renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}\fi %
}
\def\inlineextras@tibetan{%
\xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
}
\def\blockextras@tibetan{%
\xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
}
\endinput