diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/polyglossia/gloss-thai.ldf')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/polyglossia/gloss-thai.ldf | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/polyglossia/gloss-thai.ldf b/Master/texmf-dist/tex/xelatex/polyglossia/gloss-thai.ldf new file mode 100644 index 00000000000..c456ccdb93d --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/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/ +%%%% +\makeatletter + +\ifx\l@thai\@undefined% + \xpg@nopatterns{Thai}% + \adddialect\l@thai0% +\fi + +\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{\textthai{หนังสืออ้างอิง}}% + \def\abstractname{\textthai{บทคัดย่อ}}% + \def\bibname{\textthai{บรรณานุกรม}}% + \def\prefacename{\textthai{คำนำ}}% + \def\chaptername{\textthai{บทที่}}% + \def\appendixname{\textthai{ภาคผนวก}}% + \def\contentsname{\textthai{สารบัญ}}% + \def\listfigurename{\textthai{สารบัญรูป}}% + \def\listtablename{\textthai{สารบัญตาราง}}% + \def\indexname{\textthai{ดรรชนี}}% + \def\figurename{\textthai{รูปที่}}% + \def\tablename{\textthai{ตารางที่}}% + %\def\thepart{\textthai{}}% + \def\partname{\textthai{ภาค}}% + \def\pagename{\textthai{หน้า}}% + \def\seename{\textthai{ดู}}% + \def\alsoname{\textthai{ดูเพิ่มเติม}}% + \def\enclname{\textthai{สิ่งที่แนบมาด้วย}}% + \def\ccname{\textthai{สำเนาถึง}}% + \def\headtoname{\textthai{เรียน}}% + \def\proofname{\textthai{พิสูจน์}}% + %\def\glossaryname{\textthai{}}% + } +\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{\textthai{\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\thainumber#1{\if@thai@numerals{\protect\addfontfeature{Mapping=thaidigits}\protect\number#1}\else{\protect\reset@font\protect\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\@latinarabic\@arabic% + \let\@arabic\thainumber% + \renewcommand{\thefootnote}{\protect\thainumber{\c@footnote}}% + } +\def\nothai@globalnumbers{% + \let\@arabic\@latinarabic% + \renewcommand{\thefootnote}{\protect\number{\c@footnote}}% + } + +\def\thai@font{% + \@ifundefined{thaifont}{% + \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt + \zf@check@ot@script{thai}% + \if@tempswa% + \addfontfeature{Script=Thai}% + \else% + \PackageError{polyglossia}{^^J + The current font does not contain the Thai script!^^J + Please define \string\thaifont\space with \string\newfontfamily}% + \fi% + }% + {\thaifont}} + +\def\selectnormalfontthai{% + \let\normalfont=\thai@font% + \let\rmfamily=\thai@font% + \let\sffamily=\thai@font% + \let\ttfamily=\thai@font% + \def\reset@font{\normalfont}} + +\def\thai@language{\protect\language=\l@thai} + +\setlocalhyphenmins{thai}{11}{11}% + +\def\blockextras@thai{% + \renewcommand{\baselinestretch}{1.2}% FIXME restore default value in noextras? + } +\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}} +}{} |