summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua')
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua33
1 files changed, 17 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua
index 1fc02137cb0..b858c1b3458 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua
+++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua
@@ -4,6 +4,8 @@ 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
@@ -13,6 +15,7 @@ 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
-- node types as of April 2013
local glue_code = 10
@@ -26,22 +29,21 @@ local penalty_node = node.new(penalty_code)
penalty_node.penalty = 10000
local function get_penalty_node()
- return node.copy(penalty_node)
+ return node_copy(penalty_node)
end
-- same for glue node
-local glue_node = node.new(glue_code)
-glue_node.spec = node.new(glue_spec_code)
+local kern_node = node.new(kern_code)
-local function get_glue_node(dim)
- local n = node.copy(glue_node)
- n.spec.width = dim
+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 = {[20]=1, [160]=1, [5760]=1, [6158]=1, [8192]=1, [8193]=1, [8194]=1, [8195]=1,
+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
@@ -129,14 +131,14 @@ local function process(head)
-- penalty followed by glue
while start do
local id = start.id
- if id == glyph_code then -- 37 is glyph as of 2013/04
+ 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 = font.fonts[start.font].parameters.quad -- might be optimized
+ local quad = get_quad(start.font) -- might be optimized
local prev = start.prev
if map[1] == left and prev then
local prevprev = prev.prev
@@ -152,13 +154,12 @@ local function process(head)
end
end
insert_node_before(head,start,get_penalty_node())
- insert_node_before(head,start,get_glue_node(map[2]*quad))
+ 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)
@@ -172,7 +173,7 @@ local function process(head)
head = remove_node(head,next,true)
end
end
- insert_node_after(head,start,get_glue_node(right*quad))
+ insert_node_after(head,start,get_kern_node(map[2]*quad))
insert_node_after(head,start,get_penalty_node())
done = true
end
@@ -192,14 +193,14 @@ end
local callback_name = "pre_linebreak_filter"
local function activate()
- if not priority_in_callback (callback_name, "xpg-frpt.process") then
- add_to_callback(callback_name, process, "xpg-frpt.process", 1)
+ 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, "xpg-frpt.process") then
- remove_from_callback(callback_name, "xpg-frpt.process")
+ if priority_in_callback (callback_name, "polyglossia-frpt.process") then
+ remove_from_callback(callback_name, "polyglossia-frpt.process")
end
end