texlive[55206] Master/texmf-dist: lua-uni-algos (18may20)
commits+karl at tug.org
commits+karl at tug.org
Mon May 18 22:40:58 CEST 2020
Revision: 55206
http://tug.org/svn/texlive?view=revision&revision=55206
Author: karl
Date: 2020-05-18 22:40:58 +0200 (Mon, 18 May 2020)
Log Message:
-----------
lua-uni-algos (18may20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md
trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf
trunk/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua
Modified: trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md 2020-05-18 20:40:47 UTC (rev 55205)
+++ trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/README.md 2020-05-18 20:40:58 UTC (rev 55206)
@@ -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
Modified: trunk/Master/texmf-dist/doc/luatex/lua-uni-algos/lua-uni-algos.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua 2020-05-18 20:40:47 UTC (rev 55205)
+++ trunk/Master/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua 2020-05-18 20:40:58 UTC (rev 55206)
@@ -169,8 +169,17 @@
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 @@
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 @@
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 @@
::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)
More information about the tex-live-commits
mailing list.