summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-05-18 20:40:58 +0000
committerKarl Berry <karl@freefriends.org>2020-05-18 20:40:58 +0000
commitddad52fbcdd8fdcff155009cf9b0d82a32a8a5b6 (patch)
tree0117f8a7cbbb45daa5912ed021d22dbcaa45137c /Master
parent64ff205837dfa8fa805e4e3edde437799e630463 (diff)
lua-uni-algos (18may20)
git-svn-id: svn://tug.org/texlive/trunk@55206 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/lua-uni-algos/README.md4
-rw-r--r--Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdfbin60471 -> 60487 bytes
-rw-r--r--Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua25
3 files changed, 20 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md b/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md
index c964c8e8836..9409918ab90 100644
--- a/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md
+++ b/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md
@@ -1,8 +1,8 @@
# The lua-uni-algos Package
-Version: v0.1
+Version: v0.2
-Date: 2020-05-14
+Date: 2020-05-17
Author: Marcel Krüger
diff --git a/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf b/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf
index d1100c84c52..52d31ecd939 100644
--- a/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf
+++ b/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua b/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua
index dc1356568cb..4536a1b977b 100644
--- a/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua
+++ b/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua
@@ -169,8 +169,17 @@ local function ccc_reorder(codepoints, i, j, k)
codepoints[new_pos] = first
return ccc_reorder(codepoints, i, j, k == i and i or k-1)
end
+local result_table = {}
+local function get_string()
+ local result_table = result_table
+ local s = char(unpack(result_table))
+ for i=1,#result_table do
+ result_table[i] = nil
+ end
+ return s
+end
function to_nfd_table(s, decomposition_mapping)
- local new_codepoints = newtable(#s, 0)
+ local new_codepoints = result_table
local j = 1
for _, c in codes(s) do
local decomposed = decomposition_mapping[c]
@@ -197,16 +206,18 @@ function to_nfd_table(s, decomposition_mapping)
end
end
ccc_reorder(new_codepoints, 1, #new_codepoints, 1)
- return new_codepoints
end
local function to_nfd(s)
- return char(unpack(to_nfd_table(s, decomposition_mapping)))
+ to_nfd_table(s, decomposition_mapping)
+ return get_string()
end
local function to_nfkd(s)
- return char(unpack(to_nfd_table(s, compatibility_mapping)))
+ to_nfd_table(s, compatibility_mapping)
+ return get_string()
end
local function to_nfc_generic(s, decomposition_mapping)
- local codepoints = to_nfd_table(s, decomposition_mapping)
+ to_nfd_table(s, decomposition_mapping)
+ local codepoints = result_table
local starter, lookup, last_ccc, lvt
local j = 1
for i, c in ipairs(codepoints) do
@@ -222,7 +233,7 @@ local function to_nfc_generic(s, decomposition_mapping)
end
elseif lvt then
if lvt == 1 then
- if c >= 0x1161 and c <= 0x11A7 then
+ if c >= 0x1161 and c <= 0x1175 then
lvt = 2
codepoints[starter] = ((codepoints[starter] - 0x1100) * 21 + c - 0x1161) * 28 + 0xAC00
goto CONTINUE
@@ -249,7 +260,7 @@ local function to_nfc_generic(s, decomposition_mapping)
::CONTINUE::
end
for i = j,#codepoints do codepoints[i] = nil end
- return char(unpack(codepoints))
+ return get_string()
end
local function to_nfc(s)
return to_nfc_generic(s, decomposition_mapping)