From e419c0c89b5d20699307d32913bda2c4318e78da Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 28 May 2013 22:13:58 +0000 Subject: polyglossia (28may13) git-svn-id: svn://tug.org/texlive/trunk@30787 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/polyglossia/polyglossia.sty | 47 +++++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty') diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty index a2f3bfd6fcd..08a05e72028 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{polyglossia}[2013/05/20 v1.33.0 +\ProvidesPackage{polyglossia}[2013/05/28 v1.33.3 Babel replacement for XeLaTeX and LuaTeX] \RequirePackage{etoolbox} \RequirePackage{makecmds} @@ -24,9 +24,6 @@ \RequireLuaModule{polyglossia} \fi -%% for \docvslist (etoolbox) -\providecommand*{\do}[1]{}% - %% custom message macros \providecommand*{\xpg@error}[1]{% \PackageError{polyglossia}{#1}{}% @@ -139,7 +136,6 @@ %% options currently available: %% language : the name of the language (as understood by fontspec) %% hyphennames : the different hyphenation patterns to try (comma separated list) -%%% TODO: what if a language has no hyphenation possible? ex: tibetan %%% TODO: if pattern is prefixed by !, then it should be loaded as a fallback, with \xpg@nopatterns@fallback - i.e. with a warning: e.g. sanskrit for hindi, or catalan for asturian. %% script : the name of the script (as understood by fontspec) – default is Latin %% direction : the direction of the script: LR or RL @@ -168,7 +164,7 @@ \csgdef{init@noextras@#1}{}% we don't use this yet: remove? \csgdef{xpg@langname@#1}{\xpg@uppercasefirst{#1}}% %needed for docvslist with hyphennames key: - \renewcommand*{\do}[1]{% + \def\do##1{% \ifcsdef{l@#1}{}{% \ifstrequal{#1}{##1}{}% {\ifcsdef{l@##1}% @@ -186,7 +182,7 @@ {\xpg@info{Skipping~ automatic~ font~ setup~ for~ language~ #1}}% %% TODO? \toggletrue{#1@setup@done}% % reinit \do - \renewcommand*{\do}[1]{\setotherlanguage{##1}}% + \def\do##1{\setotherlanguage{##1}}% } \def\xpg@first#1,#2{#1} @@ -249,6 +245,36 @@ %TODO same thing with localdigits } +\def\xpg@lastlanguage{0}% + +\providebool{xpg@hyphenation@disabled}% +\boolfalse{xpg@hyphenation@disabled} + +\def\xpg@disablehyphenation{% + \ifbool{xpg@hyphenation@disabled}{}{% + \booltrue{xpg@hyphenation@disabled}% + \xdef\xpg@lastlanguage{\the\language}% + \xpg@set@language@luatex@ii{nohyphenation} + \language=\l@nohyphenation% + \ifluatex % + \directlua{polyglossia.disable_hyphenation()}% + \fi % + }% +} + +\def\xpg@enablehyphenation{% + \ifbool{xpg@hyphenation@disabled}{% + \boolfalse{xpg@hyphenation@disabled}% + \language=\csname xpg@lastlanguage\endcsname% + \ifluatex % + \directlua{polyglossia.enable_hyphenation()}% + \fi % + }{}% +} + +\let\disablehyphenation\xpg@disablehyphenation +\let\enablehyphenation\xpg@enablehyphenation + %\def\xpg@fontsetup#1{\xpg@csifdef@warn{xpg@fontsetup@#1}} %\def\xpg@fontsetup@none#1{\csgdef{#1@font}{\ifcsdef{#1font}{\csname #1font\endcsname}{}}} %<-- simplistic %\def\xpg@fontsetup@custom#1{\csuse{#1@font}} @@ -282,8 +308,7 @@ \edef\tmp@@scriptparam{Script=#2}% \expandafter\expandafter\expandafter\fontspec_if_script:nTF \expandafter{#1}% {\expandafter\expandafter\expandafter\addfontfeature\expandafter{\tmp@@scriptparam}}% - {\xpg@error{The~ current~ roman~ font~ does~ not~ contain\MessageBreak - the~ \expandafter\noexpand#2 ~ script!\MessageBreak + {\xpg@error{The~ current~ roman~ font~ does~ not~ contain~ the~ \expandafter\noexpand#2 ~ script!\MessageBreak Please~ define~ \expandafter\string\csname \xpg@lowercasefirst{#2}font\endcsname\space with~ \string\newfontfamily}}% } @@ -453,7 +478,7 @@ %we call this macro when a gloss file is not found for a given language \def\xpg@nogloss#1{% - \xpg@warning{File~ gloss-#1.ldf~ does~ not~ exist!^^J + \xpg@warning{File~ gloss-#1.ldf~ does~ not~ exist!\MessageBreak I~ will~ nevertheless~ try~ to~ use~ hyphenation~ patterns~ for~ #1.}% \PolyglossiaSetup{#1}{hyphenmins,hyphennames={#1},fontsetup=true}% % the above amounts to: @@ -617,7 +642,7 @@ } \newcommand\setotherlanguages[1]{% - \renewcommand*{\do}[1]{\setotherlanguage{##1}}% + \def\do##1{\setotherlanguage{##1}}% \docsvlist{#1}}% \def\common@language{% FIXME is this really needed??? -- cgit v1.2.3