diff options
author | Karl Berry <karl@freefriends.org> | 2013-06-28 21:56:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-06-28 21:56:49 +0000 |
commit | 0c6a78a9eafdb80c434d4e858bec827d5fc8259a (patch) | |
tree | 659a9cfca0126b74629a2db9917b93303dccad52 /Master/texmf-dist | |
parent | a41b6fc74912fbdd819966fff48a9780288bc947 (diff) |
polyglossia (28jun13)
git-svn-id: svn://tug.org/texlive/trunk@31010 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf | bin | 96141 -> 96179 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf | bin | 23609 -> 23501 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/examples.pdf | bin | 169745 -> 170624 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf | bin | 131329 -> 131696 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex | 1 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx | 274 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/polyglossia/babelsh.def | 1 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/polyglossia/gloss-breton.ldf | 18 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/polyglossia/gloss-turkish.ldf | 14 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/polyglossia/polyglossia-brpt.lua | 224 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty | 2 |
12 files changed, 528 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/polyglossia/README b/Master/texmf-dist/doc/latex/polyglossia/README index 58285f98c36..96bff2cf391 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/README +++ b/Master/texmf-dist/doc/latex/polyglossia/README @@ -1,7 +1,7 @@ ¦----------------------------------------------¦ ¦ ¦ - ¦ THE POLYGLOSSIA PACKAGE v1.33.3 ¦ + ¦ THE POLYGLOSSIA PACKAGE v1.33.4 ¦ ¦ ¦ ¦ Modern multilingual typesetting ¦ ¦ with XeLaTeX and LuaLaTeX ¦ diff --git a/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf b/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf Binary files differindex 20f010cfc36..849f314f6b8 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf +++ b/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf diff --git a/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf b/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf Binary files differindex 3bc9ce3ca12..669e13f26dd 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf +++ b/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf diff --git a/Master/texmf-dist/doc/latex/polyglossia/examples.pdf b/Master/texmf-dist/doc/latex/polyglossia/examples.pdf Binary files differindex 430c11454c4..91be7c3de16 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/examples.pdf +++ b/Master/texmf-dist/doc/latex/polyglossia/examples.pdf diff --git a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf Binary files differindex 72f051b649f..2c12c0320fb 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf +++ b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf diff --git a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex index 5305003ae3e..96f4d91c762 100644 --- a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex +++ b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex @@ -67,6 +67,7 @@ % COMMENT THE NEXT LINE TO INCLUDE THE CODE \AtBeginDocument{\OnlyDescription} \begin{document} +\hyphenation{Kha-li-ghi} \GetFileInfo{polyglossia.sty} \title{\textcolor{lightblue}{\Huge\fontspec[LetterSpace=40]{GFS Ambrosia} Πολυγλωσσια} diff --git a/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx b/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx index fa59bcd6be6..396ec705c6a 100644 --- a/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx +++ b/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx @@ -11,7 +11,7 @@ ¦----------------------------------------------¦ ¦ ¦ - ¦ THE POLYGLOSSIA PACKAGE v1.33.3 ¦ + ¦ THE POLYGLOSSIA PACKAGE v1.33.4 ¦ ¦ ¦ ¦ Modern multilingual typesetting ¦ ¦ with XeLaTeX and LuaLaTeX ¦ @@ -169,6 +169,7 @@ http://github.com/reutenauer/polyglossia/issues \generate{\file{farsidigits.map}{\from{polyglossia.dtx}{farsidigits.map}}} \generate{\file{thaidigits.map}{\from{polyglossia.dtx}{thaidigits.map}}} \def\MetaPrefix{-- } +\generate{\file{polyglossia-brpt.lua}{\from{polyglossia.dtx}{polyglossia-brpt.lua}}} \generate{\file{polyglossia-frpt.lua}{\from{polyglossia.dtx}{polyglossia-frpt.lua}}} \generate{\file{polyglossia-tibt.lua}{\from{polyglossia.dtx}{polyglossia-tibt.lua}}} \generate{\file{polyglossia.lua}{\from{polyglossia.dtx}{polyglossia.lua}}} @@ -267,6 +268,7 @@ http://github.com/reutenauer/polyglossia/issues % \errorcontextlines=999 % \makeatletter % +% \hyphenation{Kha-li-ghi} % \GetFileInfo{polyglossia.sty} % % \title{\textcolor{lightblue}{\Huge\fontspec[LetterSpace=40]{GFS Ambrosia} Πολυγλωσσια} @@ -1896,13 +1898,22 @@ and may look very wrong.} fontsetup=true, } -\newXeTeXintercharclass\breton@punctthin % ! ? ; -\newXeTeXintercharclass\breton@punctthick % : +\ifluatex + \newluatexattribute\xpg@frpt + \directlua{polyglossia.load_frpt()} +\else + \newXeTeXintercharclass\breton@punctthin % ! ? ; + \newXeTeXintercharclass\breton@punctthick % : +\fi \def\breton@punctthinspace{{\unskip\thinspace}} \def\breton@punctthickspace{{\unskip\nobreakspace}} \def\breton@punctuation{% + \ifluatex + \global\xpg@frpt=1\relax + \directlua{polyglossia.activate_frpt()}% + \else \XeTeXinterchartokenstate=1% \XeTeXcharclass `\! \breton@punctthin \XeTeXcharclass `\? \breton@punctthin @@ -1910,14 +1921,19 @@ and may look very wrong.} \XeTeXcharclass `\: \breton@punctthick \XeTeXinterchartoks \z@ \breton@punctthin = \breton@punctthinspace \XeTeXinterchartoks \z@ \breton@punctthick = \breton@punctthickspace + \fi } \def\nobreton@punctuation{% + \ifluatex + \global\xpg@frpt=0\relax + \else \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ \XeTeXcharclass `\; \z@ \XeTeXcharclass `\: \z@ \XeTeXinterchartokenstate=0% + \fi } @@ -7056,6 +7072,17 @@ and may look very wrong.} \XeTeXinterchartokenstate=0% } +\def\turkish@casing{% + \message{\string\turkish@casing\space called.} + \lccode`\I=`\ı + \uccode`\i=`\İ +} + +\def\noturkish@casing{% + \lccode`\I=`\i + \uccode`\i=`\I +} + \def\captionsturkish{% \def\prefacename{Önsöz}% \def\refname{Kaynaklar}% @@ -7095,14 +7122,17 @@ and may look very wrong.} \def\noextras@turkish{% \noturkish@punctuation% + \noturkish@casing% } \def\blockextras@turkish{% \turkish@punctuation% + \turkish@casing% } \def\inlineextras@turkish{% \turkish@punctuation% + \turkish@casing% } % \end{macrocode} @@ -7680,6 +7710,239 @@ U+0039 <> U+0E59 ; % \end{macrocode} % \iffalse %</thaidigits.map> +%<*polyglossia-brpt.lua> +% \fi +% \clearpage +% +% \subsection{polyglossia-brpt.lua} +% \begin{macrocode} +require('polyglossia') -- just in case... + +local add_to_callback = luatexbase.add_to_callback +local remove_from_callback = luatexbase.remove_from_callback +local priority_in_callback = luatexbase.priority_in_callback + +local get_quad = luaotfload.aux.get_quad -- needs luaotfload > 20130516 + +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 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 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 = new_node(penalty_code) +penalty_node.penalty = 10000 + +local function get_penalty_node() + return node_copy(penalty_node) +end + +-- same for glue node +local kern_node = new_node(kern_code) + +local function get_kern_node(dim) + local n = node_copy(kern_node) + n.kern = dim + return n +end + +-- we have here all possible space characters, referenced by their +-- unicode slot number, taken from char-def.lua +local space_chars = {[32]=1, [160]=1, [5760]=1, [6158]=1, [8192]=1, [8193]=1, [8194]=1, [8195]=1, + [8196]=1, [8197]=1, [8198]=1, [8199]=1, [8200]=1, [8201]=1, [8202]=1, [8239]=1, [8287]=1, [12288]=1} + +-- from nodes-tst.lua, adapted +local function somespace(n,all) + if n then + local id = n.id + if id == glue_code then + return (all or (n.spec.width ~= 0)) and glue_code + elseif id == kern_code then + return (all or (n.kern ~= 0)) and kern_code + elseif id == glyph_code then + if space_chars[n.char] then + return true + else + return false + end + end + end + return false +end + +-- idem +local function somepenalty(n,value) + if n then + local id = n.id + if id == penalty_code then + if value then + return n.penalty == value + else + return true + end + end + end + return false +end + +local xpgfrptattr = luatexbase.attributes['xpg@frpt'] + +local left=1 +local right=2 +local byte = unicode.utf8.byte + +-- Now there is a good question: how do we now, in lua, what a \thinspace is? +-- In the LaTeX source (ltspace.dtx) it is defined as: +-- \def\thinspace{\kern .16667em }. I see no way of seeing if it has been +-- overriden or not... So we stick to this value. +local thinspace = 0.16667 +-- thickspace is defined in amsmath.sty as: +-- \renewcommand{\;}{\mspace+\thickmuskip{.2777em}}. Same problem as above, we +-- stick to this fixed value. +local thickspace = 0.2777 -- 5/18 + +local mappings = { + [byte(':')] = {left, thickspace}, --really? + [byte('!')] = {left, thinspace}, + [byte('?')] = {left, thinspace}, + [byte(';')] = {left, thinspace}, + [byte('‼')] = {left, thinspace}, + [byte('⁇')] = {left, thinspace}, + [byte('⁈')] = {left, thinspace}, + [byte('⁉')] = {left, thinspace}, + [byte('»')] = {left, thinspace}, + [byte('>')] = {left, thinspace}, + [byte('«')] = {right, thinspace}, + [byte('‹')] = {right, thinspace}, + } + +local function set_spacings(thinsp, thicksp) + for _, m in pairs(mappings) do + if m[2] == thinspace then + m[2] = thinsp + elseif m[2] == thickspace then + m[2] = thicksp + end + end + thickspace = thicksp + thinspace = thinsp +end + +-- from typo-spa.lua +local function process(head) + local done = false + local start = head + -- head is always begin of par (whatsit), so we have at least two prev nodes + -- penalty followed by glue + while start do + local id = start.id + if id == glyph_code then + local attr = has_attribute(start, xpgfrptattr) + if attr and attr > 0 then + local char = start.char + local map = mappings[char] + --node.unset_attribute(start, xpgfrptattr) -- needed? + if map then + local quad = get_quad(start.font) -- might be optimized + local prev = start.prev + if map[1] == left and prev then + local prevprev = prev.prev + local somespace = somespace(prev,true) + -- TODO: there is a question here: do we override a preceding space or not?... + if somespace then + local somepenalty = somepenalty(prevprev,10000) + if somepenalty then + head = remove_node(head,prev,true) + head = remove_node(head,prevprev,true) + else + head = remove_node(head,prev,true) + end + end + insert_node_before(head,start,get_penalty_node()) + insert_node_before(head,start,get_kern_node(map[2]*quad)) + done = true + end + local next = start.next + if map[1] == right and next then + local nextnext = next.next + local somepenalty = somepenalty(next,10000) + if somepenalty then + local somespace = somespace(nextnext,true) + if somespace then + head = remove_node(head,next,true) + head = remove_node(head,nextnext,true) + end + else + local somespace = somespace(next,true) + if somespace then + head = remove_node(head,next,true) + end + end + insert_node_after(head,start,get_kern_node(map[2]*quad)) + insert_node_after(head,start,get_penalty_node()) + done = true + end + end + end + elseif id == math_code then + -- warning: this is a feature of luatex > 0.76 + start = end_of_math(start) -- weird, can return nil .. no math end? + end + if start then + start = start.next + end + end + return head, done +end + +local callback_name = "pre_linebreak_filter" + +local function activate() + if not priority_in_callback (callback_name, "polyglossia-frpt.process") then + add_to_callback(callback_name, process, "polyglossia-frpt.process", 1) + end +end + +local function desactivate() + if priority_in_callback (callback_name, "polyglossia-frpt.process") then + remove_from_callback(callback_name, "polyglossia-frpt.process") + end +end + +polyglossia.activate_frpt = activate +polyglossia.desactivate_frpt = desactivate +polyglossia.set_spacings = set_spacings +polyglossia.thinspace = thinspace +polyglossia.thickspace = thickpace +% \end{macrocode} +% \iffalse +%</polyglossia-brpt.lua> %<*polyglossia-frpt.lua> % \fi % \clearpage @@ -8128,7 +8391,7 @@ polyglossia.enable_hyphenation = enable_hyphenation ¦----------------------------------------------¦ ¦ ¦ - ¦ THE POLYGLOSSIA PACKAGE v1.33.3 ¦ + ¦ THE POLYGLOSSIA PACKAGE v1.33.4 ¦ ¦ ¦ ¦ Modern multilingual typesetting ¦ ¦ with XeLaTeX and LuaLaTeX ¦ @@ -8165,6 +8428,9 @@ Hum, sorry, wishful thinking. Please report any bugs, problems or requests on: http://github.com/reutenauer/polyglossia/issues %</../README> %<*Changelog> +1.33.4 (27-06-2013) + * Emergency release for a bug introduced in babelsh.def + 1.33.3 (28-05-2013) * Changed formatting of some error messages (emergency fixes for TeX Live 2013) diff --git a/Master/texmf-dist/tex/latex/polyglossia/babelsh.def b/Master/texmf-dist/tex/latex/polyglossia/babelsh.def index a03d7950aaa..7d14c291783 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/babelsh.def +++ b/Master/texmf-dist/tex/latex/polyglossia/babelsh.def @@ -63,6 +63,7 @@ \def\\{\MessageBreak}% \PackageInfo{polyglossia}{#1}% \endgroup} +\fi % % ------------------------------------------------------------------------------ % diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-breton.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-breton.ldf index 21ab4a12da8..3b299b36c77 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-breton.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-breton.ldf @@ -7,13 +7,22 @@ fontsetup=true, } -\newXeTeXintercharclass\breton@punctthin % ! ? ; -\newXeTeXintercharclass\breton@punctthick % : +\ifluatex + \newluatexattribute\xpg@frpt + \directlua{polyglossia.load_frpt()} +\else + \newXeTeXintercharclass\breton@punctthin % ! ? ; + \newXeTeXintercharclass\breton@punctthick % : +\fi \def\breton@punctthinspace{{\unskip\thinspace}} \def\breton@punctthickspace{{\unskip\nobreakspace}} \def\breton@punctuation{% + \ifluatex + \global\xpg@frpt=1\relax + \directlua{polyglossia.activate_frpt()}% + \else \XeTeXinterchartokenstate=1% \XeTeXcharclass `\! \breton@punctthin \XeTeXcharclass `\? \breton@punctthin @@ -21,14 +30,19 @@ \XeTeXcharclass `\: \breton@punctthick \XeTeXinterchartoks \z@ \breton@punctthin = \breton@punctthinspace \XeTeXinterchartoks \z@ \breton@punctthick = \breton@punctthickspace + \fi } \def\nobreton@punctuation{% + \ifluatex + \global\xpg@frpt=0\relax + \else \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ \XeTeXcharclass `\; \z@ \XeTeXcharclass `\: \z@ \XeTeXinterchartokenstate=0% + \fi } diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-turkish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-turkish.ldf index 6f40cf2cd3d..b9d130f2ba9 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-turkish.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-turkish.ldf @@ -30,6 +30,17 @@ \XeTeXinterchartokenstate=0% } +\def\turkish@casing{% + \message{\string\turkish@casing\space called.} + \lccode`\I=`\ı + \uccode`\i=`\İ +} + +\def\noturkish@casing{% + \lccode`\I=`\i + \uccode`\i=`\I +} + \def\captionsturkish{% \def\prefacename{Önsöz}% \def\refname{Kaynaklar}% @@ -69,14 +80,17 @@ \def\noextras@turkish{% \noturkish@punctuation% + \noturkish@casing% } \def\blockextras@turkish{% \turkish@punctuation% + \turkish@casing% } \def\inlineextras@turkish{% \turkish@punctuation% + \turkish@casing% } \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-brpt.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-brpt.lua new file mode 100644 index 00000000000..56af011152a --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-brpt.lua @@ -0,0 +1,224 @@ +require('polyglossia') -- just in case... + +local add_to_callback = luatexbase.add_to_callback +local remove_from_callback = luatexbase.remove_from_callback +local priority_in_callback = luatexbase.priority_in_callback + +local get_quad = luaotfload.aux.get_quad -- needs luaotfload > 20130516 + +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 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 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 = new_node(penalty_code) +penalty_node.penalty = 10000 + +local function get_penalty_node() + return node_copy(penalty_node) +end + +-- same for glue node +local kern_node = new_node(kern_code) + +local function get_kern_node(dim) + local n = node_copy(kern_node) + n.kern = dim + return n +end + +-- we have here all possible space characters, referenced by their +-- unicode slot number, taken from char-def.lua +local space_chars = {[32]=1, [160]=1, [5760]=1, [6158]=1, [8192]=1, [8193]=1, [8194]=1, [8195]=1, + [8196]=1, [8197]=1, [8198]=1, [8199]=1, [8200]=1, [8201]=1, [8202]=1, [8239]=1, [8287]=1, [12288]=1} + +-- from nodes-tst.lua, adapted +local function somespace(n,all) + if n then + local id = n.id + if id == glue_code then + return (all or (n.spec.width ~= 0)) and glue_code + elseif id == kern_code then + return (all or (n.kern ~= 0)) and kern_code + elseif id == glyph_code then + if space_chars[n.char] then + return true + else + return false + end + end + end + return false +end + +-- idem +local function somepenalty(n,value) + if n then + local id = n.id + if id == penalty_code then + if value then + return n.penalty == value + else + return true + end + end + end + return false +end + +local xpgfrptattr = luatexbase.attributes['xpg@frpt'] + +local left=1 +local right=2 +local byte = unicode.utf8.byte + +-- Now there is a good question: how do we now, in lua, what a \thinspace is? +-- In the LaTeX source (ltspace.dtx) it is defined as: +-- \def\thinspace{\kern .16667em }. I see no way of seeing if it has been +-- overriden or not... So we stick to this value. +local thinspace = 0.16667 +-- thickspace is defined in amsmath.sty as: +-- \renewcommand{\;}{\mspace+\thickmuskip{.2777em}}. Same problem as above, we +-- stick to this fixed value. +local thickspace = 0.2777 -- 5/18 + +local mappings = { + [byte(':')] = {left, thickspace}, --really? + [byte('!')] = {left, thinspace}, + [byte('?')] = {left, thinspace}, + [byte(';')] = {left, thinspace}, + [byte('‼')] = {left, thinspace}, + [byte('⁇')] = {left, thinspace}, + [byte('⁈')] = {left, thinspace}, + [byte('⁉')] = {left, thinspace}, + [byte('»')] = {left, thinspace}, + [byte('>')] = {left, thinspace}, + [byte('«')] = {right, thinspace}, + [byte('‹')] = {right, thinspace}, + } + +local function set_spacings(thinsp, thicksp) + for _, m in pairs(mappings) do + if m[2] == thinspace then + m[2] = thinsp + elseif m[2] == thickspace then + m[2] = thicksp + end + end + thickspace = thicksp + thinspace = thinsp +end + +-- from typo-spa.lua +local function process(head) + local done = false + local start = head + -- head is always begin of par (whatsit), so we have at least two prev nodes + -- penalty followed by glue + while start do + local id = start.id + if id == glyph_code then + local attr = has_attribute(start, xpgfrptattr) + if attr and attr > 0 then + local char = start.char + local map = mappings[char] + --node.unset_attribute(start, xpgfrptattr) -- needed? + if map then + local quad = get_quad(start.font) -- might be optimized + local prev = start.prev + if map[1] == left and prev then + local prevprev = prev.prev + local somespace = somespace(prev,true) + -- TODO: there is a question here: do we override a preceding space or not?... + if somespace then + local somepenalty = somepenalty(prevprev,10000) + if somepenalty then + head = remove_node(head,prev,true) + head = remove_node(head,prevprev,true) + else + head = remove_node(head,prev,true) + end + end + insert_node_before(head,start,get_penalty_node()) + insert_node_before(head,start,get_kern_node(map[2]*quad)) + done = true + end + local next = start.next + if map[1] == right and next then + local nextnext = next.next + local somepenalty = somepenalty(next,10000) + if somepenalty then + local somespace = somespace(nextnext,true) + if somespace then + head = remove_node(head,next,true) + head = remove_node(head,nextnext,true) + end + else + local somespace = somespace(next,true) + if somespace then + head = remove_node(head,next,true) + end + end + insert_node_after(head,start,get_kern_node(map[2]*quad)) + insert_node_after(head,start,get_penalty_node()) + done = true + end + end + end + elseif id == math_code then + -- warning: this is a feature of luatex > 0.76 + start = end_of_math(start) -- weird, can return nil .. no math end? + end + if start then + start = start.next + end + end + return head, done +end + +local callback_name = "pre_linebreak_filter" + +local function activate() + if not priority_in_callback (callback_name, "polyglossia-frpt.process") then + add_to_callback(callback_name, process, "polyglossia-frpt.process", 1) + end +end + +local function desactivate() + if priority_in_callback (callback_name, "polyglossia-frpt.process") then + remove_from_callback(callback_name, "polyglossia-frpt.process") + end +end + +polyglossia.activate_frpt = activate +polyglossia.desactivate_frpt = desactivate +polyglossia.set_spacings = set_spacings +polyglossia.thinspace = thinspace +polyglossia.thickspace = thickpace diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty index 08a05e72028..7e5c3251f61 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/28 v1.33.3 +\ProvidesPackage{polyglossia}[2013/06/27 v1.33.4 Babel replacement for XeLaTeX and LuaTeX] \RequirePackage{etoolbox} \RequirePackage{makecmds} |