summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf')
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf146
1 files changed, 111 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf
index 8cb0731d2df..57ec25f48e5 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf
@@ -10,6 +10,10 @@
hyphenmins={2,2},
fontsetup=true}
+% Babel aliases
+\setlanguagealias[variant=acadian]{french}{acadien}
+\setlanguagealias[variant=canadian]{french}{canadien}
+
\def\french@variant{french}
\define@choicekey*+{french}{variant}[\val\nr]{french,canadian,acadian}[french]{%
\ifcase\nr\relax
@@ -20,17 +24,17 @@
\def\french@variant{canadien}%
\SetLanguageKeys{french}{babelname=canadien}%
\xpg@ifdefined{canadien}{}%
- {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak
- I will use the standard patterns for French instead}%
- \adddialect\l@canadien\l@french\relax}%
+ {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak
+ I will use the standard patterns for French instead}%
+ \adddialect\l@canadien\l@french\relax}%
\or
% acadian:
\def\french@variant{acadian}%
\SetLanguageKeys{french}{babelname=canadien}%
\xpg@ifdefined{acadian}{}%
- {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak
- I will use the standard patterns for French instead}%
- \adddialect\l@acadian\l@french\relax}%
+ {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak
+ I will use the standard patterns for French instead}%
+ \adddialect\l@acadian\l@french\relax}%
\fi
\xpg@info{Option: French, variant=\val}%
}{\xpg@warning{Unknown French variant `#1'}}
@@ -41,8 +45,7 @@
}%
\ifluatex
- \newluatexattribute\xpg@frpt %
- \directlua{polyglossia.load_frpt()}%
+ \directlua{require('polyglossia-french')}%
\else
\newXeTeXintercharclass\french@openbrackets % ( ] {
\newXeTeXintercharclass\french@closebrackets % ( ] {
@@ -83,6 +86,10 @@
\define@boolkey{french}[french@]{autospaceguillemets}[true]{}
\french@autospaceguillemetstrue
+\newif\iffrench@thincolonspace
+\define@boolkey{french}[french@]{thincolonspace}[true]{}
+\french@thincolonspacefalse
+
% Backwards compatibility
\define@boolkey{french}[french@]{automaticspacesaroundguillemets}[true]{%
\iffrench@automaticspacesaroundguillemets
@@ -109,6 +116,51 @@
\fi
}
+% Configuration of item labels
+\def\french@itemi{\textemdash}
+\def\french@itemii{\textemdash}
+\def\french@itemiii{\textemdash}
+\def\french@itemiv{\textemdash}
+
+\define@key{french}{itemlabels}[\textemdash]{%
+ \def\french@itemi{#1}
+ \def\french@itemii{#1}
+ \def\french@itemiii{#1}
+ \def\french@itemiv{#1}
+}
+
+\define@key{french}{itemlabeli}[\textemdash]{%
+ \def\french@itemi{#1}
+}
+
+\define@key{french}{itemlabelii}[\textemdash]{%
+ \def\french@itemii{#1}
+}
+
+\define@key{french}{itemlabeliii}[\textemdash]{%
+ \def\french@itemiii{#1}
+}
+
+\define@key{french}{itemlabeliv}[\textemdash]{%
+ \def\french@itemiv{#1}
+}
+
+\define@boolkey{french}[french@]{frenchitemlabels}[true]{%
+ \AfterPreamble{%
+ \ifdefstring{\xpg@main@language}{french}{%
+ \iffrench@frenchitemlabels
+ \renewcommand{\labelitemi}{\french@itemi}%
+ \renewcommand{\labelitemii}{\french@itemii}%
+ \renewcommand{\labelitemiii}{\french@itemiii}%
+ \renewcommand{\labelitemiv}{\french@itemiv}%
+ \else
+ \let\@makefntext\xpg@orig@makefntext
+ \fi
+ }{\xpg@warning{Option 'frenchitemlabels' only supported if French is main language!}}%
+ }%
+}
+
+
\def\french@fontsetup{%
\unless\iffrench@autospacetypewriter
\let\ttfamily\french@ttfamilyFB
@@ -120,11 +172,24 @@
\let\ttfamily\french@ttfamilyORI
}
+\def\xpg@french@thinsp{\kern 0.5\fontdimen2\font}
+
\def\french@punctuation{%
\lccode"2019="2019
\ifluatex
- \xpg@frpt=1\relax %
- \directlua{polyglossia.activate_frpt()}%
+ \iffrench@thincolonspace
+ \iffrench@autospaceguillemets
+ \directlua{polyglossia.activate_french_punct(true, true)}%
+ \else
+ \directlua{polyglossia.activate_french_punct(true, false)}%
+ \fi
+ \else
+ \iffrench@autospaceguillemets
+ \directlua{polyglossia.activate_french_punct(false, true)}%
+ \else
+ \directlua{polyglossia.activate_french_punct(false, false)}%
+ \fi
+ \fi
\else
\XeTeXinterchartokenstate=1
\XeTeXcharclass `\! \french@punctthin
@@ -134,50 +199,53 @@
\XeTeXcharclass `\⁈ \french@punctthin
\XeTeXcharclass `\⁉ \french@punctthin
\XeTeXcharclass `\; \french@punctthin
- \XeTeXcharclass `\: \french@punctthick
+ \iffrench@thincolonspace
+ \XeTeXcharclass `\: \french@punctthin
+ \else
+ \XeTeXcharclass `\: \french@punctthick
+ \fi
\XeTeXcharclass `\« \french@punctguillstart
\XeTeXcharclass `\» \french@punctguillend
\XeTeXcharclass `\‹ \french@punctguillstart
\XeTeXcharclass `\› \french@punctguillend
\XeTeXcharclass `\( \french@openbrackets
\XeTeXcharclass `\) \french@closebrackets
- \XeTeXcharclass `\] \french@openbrackets
- \XeTeXcharclass `\[ \french@closebrackets
+ \XeTeXcharclass `\[ \french@openbrackets
+ \XeTeXcharclass `\] \french@closebrackets
\XeTeXcharclass `\{ \french@openbrackets
\XeTeXcharclass `\} \french@closebrackets
- \XeTeXinterchartoks \z@ \french@punctthin = {\thinspace}%
+ \XeTeXcharclass `\⟨ \french@openbrackets
+ \XeTeXcharclass `\⟩ \french@closebrackets
+ \XeTeXinterchartoks \z@ \french@punctthin = {\xpg@french@thinsp}%
\XeTeXinterchartoks \z@ \french@punctthick = {\nobreakspace}%
- \XeTeXinterchartoks \xpg@boundaryclass \french@punctthin = {\xpg@unskip\thinspace}%
+ \XeTeXinterchartoks \xpg@boundaryclass \french@punctthin = {\xpg@unskip\xpg@french@thinsp}%
\XeTeXinterchartoks \xpg@boundaryclass \french@punctthick = {\xpg@unskip\nobreakspace}%
\iffrench@autospaceguillemets
- \XeTeXinterchartoks \french@punctguillstart \z@ = {\thinspace}% "«a" -> "«\,a"
- % \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged?
- % \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged?
- \XeTeXinterchartoks \z@ \french@punctguillend = {\thinspace}% "a»" -> "a\,»"
- \XeTeXinterchartoks \french@punctguillstart \xpg@boundaryclass = {\thinspace\ignorespaces}% "« " -> "«\,"
- \XeTeXinterchartoks \xpg@boundaryclass \french@punctguillend = {\xpg@unskip\thinspace}% " »" -> "\,»"
+ \let\xpg@french@guillspace\xpg@french@thinsp%
+ \XeTeXinterchartoks \french@punctguillstart \z@ = {\xpg@french@guillspace}% "«a" -> "«\,a"
+ % \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged?
+ % \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged?
+ \XeTeXinterchartoks \z@ \french@punctguillend = {\xpg@french@guillspace}% "a»" -> "a\,»"
+ \XeTeXinterchartoks \french@punctguillstart \xpg@boundaryclass = {\xpg@french@guillspace\ignorespaces}% "« " -> "«\,"
+ \XeTeXinterchartoks \xpg@boundaryclass \french@punctguillend = {\xpg@unskip\xpg@french@guillspace}% " »" -> "\,»"
+ \XeTeXinterchartoks \french@closebrackets \french@punctguillend = {\xpg@french@guillspace}% ")»" -> ")\,»"
+ \else
+ \def\xpg@french@guillspace{}%
\fi
- \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\thinspace}% "»;" -> "»\,;"
+ \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\xpg@french@thinsp}% "»;" -> "»\,;"
\XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
- \XeTeXinterchartoks \french@punctthin \french@punctguillend = {\thinspace}% "?»" -> "?\,»"
+ \XeTeXinterchartoks \french@punctthin \french@punctguillend = {\xpg@french@thinsp}% "?»" -> "?\,»"
\XeTeXinterchartoks \french@openbrackets \french@punctthin = {\xpg@unskip}% "(?" -> "(?" and not "( ?"
\XeTeXinterchartoks \french@punctthin \french@closebrackets = {\xpg@unskip}% "?)" -> "?)" (code not need, just for symetry with previous one)
- \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\thinspace}% ")?" -> ")\,?"
+ \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\xpg@french@thinsp}% ")?" -> ")\,?"
\XeTeXinterchartoks \french@closebrackets \french@punctthick = {\nobreakspace}% "):" -> ") :"
\fi
- }
+}
\def\nofrench@punctuation{%
\lccode"2019=\z@
\ifluatex
- \xpg@frpt=0\relax %
- % Though it would make compilation slightly faster, it is not possible to
- % safely uncomment the following line. Imagine the following case: you start
- % a paragraph by some french text, then, in the same paragraph, you change
- % the language to something else, and thus call the following line. This means
- % that, at then end of the paragraph, the function won't be in the callback,
- % so the beginning of the paragraph won't be processed by it.
- %\directlua{polyglossia.desactivate_frpt()}
+ \directlua{polyglossia.deactivate_french_punct()}%
\else
\XeTeXcharclass `\! \z@
\XeTeXcharclass `\? \z@
@@ -191,9 +259,17 @@
\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\captionsfrench{%
\def\refname{Références}%
@@ -223,7 +299,7 @@
\def\ccname{Copie à }%
\def\headtoname{}%
\def\proofname{Démonstration}%
- }
+}
\def\datefrench{%
\def\today{\ifx\ier\undefined\def\ier{er}\fi