summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-khmer.ldf
blob: 00c569c06b1e09a0daa179a9a529f5b96b5c2bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
\ProvidesFile{gloss-khmer.ldf}[polyglossia: module for Khmer]
\PolyglossiaSetup{khmer}{
	script=Khmer,%
	scripttag=khmr,%
	langtag=KHM,%
	hyphennames={nohyphenation},%
	fontsetup=true,%
	localnumeral=khmernumerals%
}
\newif\if@khmer@numerals
\def\tmp@khmer{khmer}
\define@key{khmer}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@khmer\@khmer@numeralstrue%
	\else\@khmer@numeralsfalse\fi%
}
\setkeys{khmer}{numerals}
\def\captionskhmer{%
	\def\prefacename{អារម្ភកថា}%
	\def\refname{ឯកសារយោង}%
	\def\abstractname{សង្ខេប}%
	\def\bibname{គន្ថនិទ្ទេស}%
	\def\chaptername{ជំពូក}%
	\def\appendixname{សេចក្ដីបន្ថែម}%
	\def\contentsname{មាតិការ}%
	\def\listfigurename{បញ្ជីរូបភាព}%
	\def\listtablename{បញ្ជីតារាង}%
	\def\indexname{សន្ទស្សន៍}%
	\def\figurename{រូប}%
	\def\tablename{តារាង}%
	\def\partname{ផ្នែក}%
	\def\pagename{ទំព័រ}%
	\def\seename{មើល}%
	\def\alsoname{មើលបន្ថែម}%
	\def\enclname{ឯកសារភ្ជាប់}%
	\def\ccname{ចម្លងជួន}%
	\def\headtoname{ផ្ញើរទៅ}%
	\def\proofname{សម្រាយ}%
	\def\glossaryname{សទានុក្រម}%
}
\def\datekhmer{%
	\def\khmer@month{%
		\ifcase\month\or%
		មករា\or%
		កុម្ភៈ\or%
		មិនា\or%
		មេសា\or%
		ឧសភា\or%
		មិថុនា\or%
		កក្កដា\or%
		សីហា\or%
		កញ្ញា\or%
		តុលា\or%
		វិច្ឆិកា\or%
		ធ្នូ\fi}%
	\def\today{\khmernumber\day\space\khmer@month\space\khmernumber\year}%
}
\def\khmerdigits#1{\expandafter\@khmer@digits #1@}
\def\@khmer@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\@khmer@digits%
    \fi
}

\newcommand{\khmernumerals}[2]{\khmernumber{#2}}

\def\khmernumber#1{%
	\if@khmer@numerals%
		\khmerdigits{\number#1}%
	\else%
		\number#1%
	\fi}
\def\khmer@globalnumbers{%
	\let\orig@arabic\@arabic%
	\let\@arabic\khmernumber%
	\renewcommand{\thefootnote}{\localnumeral*{footnote}}%
}
\def\nokhmer@globalnumbers{%
	\let\@arabic\orig@arabic%
}
\def\thepart{\arabic{part}}
\def\@khmeralph#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 អ%
\else\xpg@ill@value{#1}{@khmeralph}\fi}
\def\khmerAlph#1{\expandafter\@khmerAlph\csname c@#1\endcsname}
\def\@khmerAlph#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 អ%
\else\xpg@ill@value{#1}{@khmeralph}\fi}
\def\khmer@numbers{%
	\if@khmer@numerals
		\let\@alph\@khmeralph%
		\let\@Alph\@khmerAlph%
	\fi%
}
\def\nokhmer@numbers{%
	\let\@alph\latin@alph%
	\let\@Alph\latin@Alph%
}
\def\blockextras@khmer{%
	\XeTeXlinebreaklocale "kh" % 
	\XeTeXlinebreakskip = 0pt plus 1pt minus 1pt
%	\let\orig@baselinestretch\baselinestretch%
%	\renewcommand{\baselinestretch}{1.2}% not work
}
\def\noblockextras@khmer{% 
	\XeTeXlinebreaklocale "en"%
%	\let\baselinestretch\orig@baselinestretch%
}
\@ifclassloaded{beamer}{%
	\usefonttheme{professionalfonts}%
	\def\factname{ស្វ័យសត្យ}%
	\def\lemmaname{បទគន្លិះ}%
	\def\theoremname{ទ្រឹស្ដីបទ}%
	\def\corollaryname{អនុសាធ្យ}%
	\def\problemname{ចំណោទ}%
	\def\solutionname{ដំណោះស្រាយ}%
	\def\definitionname{និយមន័យ}%
	\def\examplename{ឧទាហរណ៏}%
	\uselanguage{khmer}%
	\languagepath{khmer}%
	\deftranslation[to=khmer]{Fact}{\factname}%
	\deftranslation[to=khmer]{Lemma}{\lemmaname}%
	\deftranslation[to=khmer]{Theorem}{\theoremname}%
	\deftranslation[to=khmer]{Corollary}{\corollaryname}%
	\deftranslation[to=khmer]{Problem}{\problemname}%
	\deftranslation[to=khmer]{Solution}{\solutionname}%
	\deftranslation[to=khmer]{Definition}{\definitionname}%
	\deftranslation[to=khmer]{Definitions}{\definitionname}%
	\deftranslation[to=khmer]{Example}{\examplename}%
	\deftranslation[to=khmer]{Examples}{\examplename}%
	\AtEndDocument{\immediate\write\@auxout{\string\@writefile{nav}%
		{\noexpand\headcommand{\noexpand\def\noexpand%
		\inserttotalframenumber{\localnumeral*{framenumber}}}}}}%
}{}
\endinput