diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-28 22:13:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-28 22:13:58 +0000 |
commit | e419c0c89b5d20699307d32913bda2c4318e78da (patch) | |
tree | 0378799ebc39f1f1f1faeb041577fbde8c8f8d95 /Master/texmf-dist/tex/latex/polyglossia | |
parent | 87b2d1358e32a16c879c30fc456627b2659f03c2 (diff) |
polyglossia (28may13)
git-svn-id: svn://tug.org/texlive/trunk@30787 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia')
7 files changed, 128 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf index b1685259ce6..007b11ef5ec 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf @@ -16,7 +16,7 @@ %% we need to handle it differently \define@key{english}{variant}{% %needs to be reset for loop over hyphennames below: - \renewcommand*{\do}[1]{% + \def\do##1{% \ifcsdef{l@#1}% {\csletcs{l@english}{l@#1}\listbreak}% {}% @@ -60,7 +60,7 @@ \gdef\english@language{\language=\l@ukenglish\xpg@set@language@luatex@ii{ukenglish}}% \fi % and we reset \do to its previous definition here: - \renewcommand*{\do}[1]{\setotherlanguage{#1}}% + \def\do##1{\setotherlanguage{#1}}% } \def\captionsenglish{% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-nko.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-nko.ldf index b64b367776e..63a3c0f02d7 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-nko.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-nko.ldf @@ -38,20 +38,42 @@ % The word "ߕߟߋ߬" is mandatory between month name and day number. \def\datenko{% - \def\today{\nkonumber{\day}\space ߕߟߋ߬\space\ifcase\month\or -ߓߌ߲ߠߊߥߎߟߋ߲\or -ߞߏ߲ߞߏߜߍ\or -ߕߙߊߓߊ\or -ߞߏ߲ߞߏߘߌ߬ߓߌ\or -ߘߓߊ߬ߕߊ\or -ߥߊ߬ߛߌߥߊ߬ߙߊ\or -ߞߊ߬ߙߌߝߐ߭\or -ߘߓߊ߬ߓߌߟߊ\or -ߕߎߟߊߝߌ߲\or -ߞߏ߲ߓߌߕߌ߮\or -ߣߍߣߍߓߊ\or -ߞߏ߬ߟߌ߲߬ߞߏߟߌ߲\fi -\space\nkonumber{\year} + \def\today{% + \nkonumber{\year}\space + \ifcase\month + \orߓߌ߲ߠߊߥߎߟߋ߲% + \orߞߏ߲ߞߏߜߍ% + \orߕߙߊߓߊ + \orߞߏ߲ߞߏߘߌ߬ߓߌ% + \orߘߓߊ߬ߕߊ% + \orߥߊ߬ߛߌߥߊ߬ߙߊ% + \orߞߊ߬ߙߌߝߐ߭% + \orߘߓߊ߬ߓߌߟߊ% + \orߕߎߟߊߝߌ߲% + \orߞߏ߲ߓߌߕߌ߮% + \orߣߍߣߍߓߊ% + \orߞߏ߬ߟߌ߲߬ߞߏߟߌ߲\fi + \spaceߕߟߋ߬ + \space\nkonumber{\day} + }% + + \def\today{% + \nkonumber{\year}\space + \ifcase\month + \or ߓߌ߲ߠߊߥߎߟߋ߲% + \or ߞߏ߲ߞߏߜߍ% + \or ߕߙߊߓߊ% + \or ߞߏ߲ߞߏߘߌ߬ߓߌ% + \or ߘߓߊ߬ߕߊ% + \or ߥߊ߬ߛߌߥߊ߬ߙߊ% + \or ߞߊ߬ߙߌߝߐ߭% + \or ߘߓߊ߬ߓߌߟߊ% + \or ߕߎߟߊߝߌ߲% + \or ߞߏ߲ߓߌߕߌ߮% + \or ߣߍߣߍߓߊ% + \or ߞߏ߬ߟߌ߲߬ߞߏߟߌ߲\fi + \space ߕߟߋ߬ + \space\nkonumber{\day} }% }% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf index 26d3906ff4e..e7001edda42 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf @@ -90,8 +90,8 @@ \def\cosec{\mathop{\operator@font cosec}\nolimits} \def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits} \def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits} -\def\nsd{\mathop{\mathrm{н.х.д.}}\nolimits} -\def\nsk{\mathop{\mathrm{н.х.к.}}\nolimits} +\def\nsd{\mathop{\mathrm{н.с.д.}}\nolimits} +\def\nsk{\mathop{\mathrm{н.с.к.}}\nolimits} \def\NSD{\mathop{\mathrm{НСД}}\nolimits} \def\NSK{\mathop{\mathrm{НСК}}\nolimits} \def\nod{\mathop{\mathrm{н.о.д.}}\nolimits} % ?????? diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua index b858c1b3458..56af011152a 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua @@ -10,22 +10,35 @@ local next, type = next, type local nodes, fonts, node = nodes, fonts, node +local nodecodes = nodes.nodecodes + local insert_node_before = node.insert_before local insert_node_after = node.insert_after local remove_node = nodes.remove -local end_of_math = node.end_of_math local has_attribute = node.has_attribute local node_copy = node.copy +local new_node = node.new + +local end_of_math = node.end_of_math +if not end_of_math then -- luatex < .76 + local traverse_nodes = node.traverse_id + local math_code = nodecodes.math + local end_of_math = function (n) + for n in traverse_nodes(math_code, n.next) do + return n + end + end +end --- node types as of April 2013 -local glue_code = 10 -local glue_spec_code= 47 -local glyph_code = 37 -local penalty_code = 12 -local kern_code = 11 +-- node types according to node.types() +local glue_code = nodecodes.glue +local glue_spec_code = nodecodes.glue_spec +local glyph_code = nodecodes.glyph +local penalty_code = nodecodes.penalty +local kern_code = nodecodes.kern -- we make a new node, so that we can copy it later on -local penalty_node = node.new(penalty_code) +local penalty_node = new_node(penalty_code) penalty_node.penalty = 10000 local function get_penalty_node() @@ -33,7 +46,7 @@ local function get_penalty_node() end -- same for glue node -local kern_node = node.new(kern_code) +local kern_node = new_node(kern_code) local function get_kern_node(dim) local n = node_copy(kern_node) diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-tibt.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-tibt.lua index 04355384029..46370c46af2 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-tibt.lua +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-tibt.lua @@ -8,14 +8,24 @@ local next, type = next, type local nodes, fonts, node = nodes, fonts, node +local nodecodes = nodes.nodecodes --- <= preloaded node.types() + local insert_node_before = node.insert_before local insert_node_after = node.insert_after local remove_node = nodes.remove local copy_node = node.copy -local end_of_math = node.end_of_math local has_attribute = node.has_attribute -local nodecodes = nodes.nodecodes --- <= preloaded node.types() +local end_of_math = node.end_of_math +if not end_of_math then -- luatex < .76 + local traverse_nodes = node.traverse_id + local math_code = nodecodes.math + local end_of_math = function (n) + for n in traverse_nodes(math_code, n.next) do + return n + end + end +end -- node types as of April 2013 local glyph_code = nodecodes.glyph @@ -24,7 +34,7 @@ local kern_code = nodecodes.kern -- we make a new node, so that we can copy it later on local penalty_node = node.new(penalty_code) -penalty_node.penalty = -2000 -- rather arbitrary... if someone has a better idea...? +penalty_node.penalty = 50 -- corresponds to the penalty LaTeX sets at explicit hyphens local function get_penalty_node() return copy_node(penalty_node) diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua index 2a344720ec6..cb1e789ad63 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua @@ -20,6 +20,7 @@ polyglossia = polyglossia or {} local polyglossia = polyglossia local current_language +local last_language local default_language local function loadlang(lang, id) @@ -30,13 +31,26 @@ end local function select_language(lang, id) loadlang(lang, id) - polyglossia.current_language = lang + current_language = lang + last_language = lang end local function set_default_language(lang, id) polyglossia.default_language = lang end +local function falsefun() + return false +end + +local function disable_hyphenation() + luatexbase.add_to_callback("hyphenate", falsefun, "polyglossia.disable_hyphenation") +end + +local function enable_hyphenation() + luatexbase.remove_from_callback("hyphenate", "polyglossia.disable_hyphenation") +end + local check_char if luaotfload and luaotfload.aux and luaotfload.aux.font_has_glyph then @@ -80,3 +94,5 @@ polyglossia.default_language = default_language polyglossia.check_char = check_char polyglossia.load_frpt = load_frpt polyglossia.load_tibt_eol = load_tibt_eol +polyglossia.disable_hyphenation = disable_hyphenation +polyglossia.enable_hyphenation = enable_hyphenation 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??? |