summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf')
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf173
1 files changed, 173 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf
new file mode 100644
index 00000000000..16e90ea7dc1
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-thai.ldf
@@ -0,0 +1,173 @@
+\ProvidesFile{gloss-thai.ldf}[polyglossia: module for thai]
+%% This is partly based on thai-latex for Babel:
+%%%% Copyright (C) 1999 - 2006
+%%%% by Surapant Meknavin,
+%%%% Theppitak Karoonboonyanan (thep at linux.thai.net),
+%%%% Chanop Silpa-Anan (chanop at debian.org),
+%%%% Poonlap Veerathanabutr (poonlap at linux.thai.net)
+%%%% Thai Linux Working Group
+%%%% http://linux.thai.net/
+%%%%
+\PolyglossiaSetup{thai}{
+ script=Thai,
+ scripttag=thai,
+ hyphennames={nohyphenation},
+ fontsetup=true
+ %TODO localalph={xxx@alph,xxx@Alph}
+ %TODO localdigits=thainumber
+}
+
+\newif\if@thai@numerals
+\def\tmp@thai{thai}
+\define@key{thai}{numerals}[arabic]{%
+ \def\@tmpa{#1}%
+ \ifx\@tmpa\tmp@thai\@thai@numeralstrue\else
+ \@thai@numeralsfalse\fi
+}
+
+\setkeys{thai}{numerals}
+
+\def\captionsthai{%
+ \def\refname{หนังสืออ้างอิง}%
+ \def\abstractname{บทคัดย่อ}%
+ \def\bibname{บรรณานุกรม}%
+ \def\prefacename{คำนำ}%
+ \def\chaptername{บทที่}%
+ \def\appendixname{ภาคผนวก}%
+ \def\contentsname{สารบัญ}%
+ \def\listfigurename{สารบัญรูป}%
+ \def\listtablename{สารบัญตาราง}%
+ \def\indexname{ดรรชนี}%
+ \def\figurename{รูปที่}%
+ \def\tablename{ตารางที่}%
+ %\def\thepart{}%
+ \def\partname{ภาค}%
+ \def\pagename{หน้า}%
+ \def\seename{ดู}%
+ \def\alsoname{ดูเพิ่มเติม}%
+ \def\enclname{สิ่งที่แนบมาด้วย}%
+ \def\ccname{สำเนาถึง}%
+ \def\headtoname{เรียน}%
+ \def\proofname{พิสูจน์}%
+ %\def\glossaryname{}%
+}
+\def\datethai{%
+ \def\thai@month{%
+ \ifcase\month\or
+ มกราคม\or กุมภาพันธ์\or มีนาคม\or เมษายน%
+ \or พฤษภาคม\or มิถุนายน\or กรกฎาคม\or สิงหาคม%
+ \or กันยายน\or ตุลาคม\or พฤศจิกายน\or ธันวาคม\fi}%
+ \newcount\thai@year%
+ \thai@year=\year%
+ \advance\thai@year by 543%
+ \def\today{\thainumber\day \space \thai@month\space พ.ศ.~\thainumber\thai@year}%
+}
+
+%NB: thai-latex had "plus 0.6pt", but .4em appears to give better results
+% FIXME to avoid name clashes, rename \wbr to \wordbreak or \thaiworkbreak ?
+\def\wbr{\hskip0pt plus .4em\relax} %%OR \char"200B = ZWSP ? Does not work
+%\catcode"200b=\active
+%\def^^200b{\hskip 0pt plus .4em}
+
+\def\thaidigits#1{\expandafter\@thai@digits #1@}
+\def\@thai@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\@thai@digits
+ \fi
+}
+
+\def\thainumber#1{%
+ \if@thai@numerals
+ \thaidigits{\number#1}%
+ %%{\protect\addfontfeature{Mapping=thaidigits}\protect\number#1}
+ \else
+ \number#1%
+ %%{\protect\reset@font\number#1}
+ \fi}
+
+\def\@thaialph#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 ม\or ย\or ร\or ล\or ว\or ศ\or ษ\or ส\or ห\or ฬ\or อ\or
+ ฮ\else\xpg@ill@value{#1}{@thaialph}\fi}
+\def\thaiAlph#1{\expandafter\@thaiAlph\csname c@#1\endcsname}
+\def\@thaiAlph#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 พ\or ฟ\or ภ\or ม\or ย\or ร\or ฤ\or ล\or ฦ\or ว\or
+ ศ\or ษ\or ส\or ห\or ฬ\or อ\or ฮ\else\xpg@ill@value{#1}{@thaialph}\fi}
+
+\def\thai@numbers{%
+ \let\@latinalph\@alph%
+ \let\@latinAlph\@Alph%
+ \if@thai@numerals
+ \let\@alph\@thaialph%
+ \let\@Alph\@thaiAlph%
+ \fi
+}
+\def\nothai@numbers{%
+ \let\@alph\@latinalph%
+ \let\@Alph\@latinAlph%
+}
+
+\def\thai@globalnumbers{%
+ \let\orig@arabic\@arabic%
+ \let\@arabic\thainumber%
+ \renewcommand{\thefootnote}{\protect\thainumber{\c@footnote}}%
+}
+\def\nothai@globalnumbers{%
+ \let\@arabic\orig@arabic%
+ \renewcommand\thefootnote{\protect\number{\c@footnote}}%
+}
+
+\def\blockextras@thai{%
+%%TODO \XeTeXlinebreaklocales "th"% uses ICU to find line breaks on the basis of a dictionary lookup-- make this optional? (in case a user might prefer a preprocessor
+ \let\orig@baselinestrech\baselinestretch%
+ \renewcommand{\baselinestretch}{1.2}%
+}
+\def\noblockextras@thai{%
+%%TODO \XeTeXlinebreaklocales "en"%
+ \let\baselinestrech\orig@baselinestretch%
+}
+
+\endinput
+
+%TODO ?
+
+%\def\thainum#1{\expandafter\thainumber\csname c@#1\endcsname}
+%\def\thaibracenum#1{(\expandafter\thainumber\csname c@#1\endcsname)}
+%\def\thaialph#1{\expandafter\@thaialph\csname c@#1\endcsname}
+
+\@ifclassloaded{book}{%
+ % redefine page numbering for frontmatter and mainmatter
+ \def\ps@headnum{\let\@mkboth\@gobbletwo
+ \def\@oddhead{\reset@font\hfil\thepage\hfil}\let\@oddfoot\@empty
+ \let\@evenhead\@oddhead\let\@evenfoot\@empty}
+ \let\@ltxfrontmatter\frontmatter
+ \renewcommand\frontmatter{\@ltxfrontmatter\pagestyle{headnum}\pagenumbering{thaibracenum}}
+ \let\@ltxmainmatter\mainmatter
+ \renewcommand\mainmatter{\@ltxmainmatter\pagestyle{headings}\pagenumbering{thainum}}
+}{}
+
+\@ifclassloaded{book}{%
+\renewcommand\appendix{\par
+ \setcounter{chapter}{0}%
+ \setcounter{section}{0}%
+ \gdef\@chapapp{\appendixname}%
+ \gdef\thechapter{\@thaialph\c@chapter}}
+}{}
+\@ifclassloaded{report}{%
+\renewcommand\appendix{\par
+ \setcounter{chapter}{0}%
+ \setcounter{section}{0}%
+ \gdef\@chapapp{\appendixname}%
+ \gdef\thechapter{\@thaialph\c@chapter}}
+}{}
+\@ifclassloaded{article}{%
+\renewcommand\appendix{\par
+ \setcounter{section}{0}%
+ \setcounter{subsection}{0}%
+ \gdef\thesection{\@thaialph\c@section}}
+}{}