[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix bugs and optimize (c653f9c)
Marcel Fabian Krüger
tex at 2krueger.de
Wed Oct 28 04:02:44 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/c653f9ca39d14feb8edec77f2cbe8a063a200342
>---------------------------------------------------------------
commit c653f9ca39d14feb8edec77f2cbe8a063a200342
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Wed Oct 28 04:00:42 2020 +0100
Fix bugs and optimize
Whitespace out of sync to simplify diff
>---------------------------------------------------------------
c653f9ca39d14feb8edec77f2cbe8a063a200342
src/luaotfload-harf-plug.lua | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index 27f4548..d96468b 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -384,8 +384,6 @@ function shape(head, firstnode, run)
cluster = glyph.cluster
for i = nodeindex, cluster do node = getnext(node) end
nodeindex = cluster + 1
- local hex = ""
- local str = ""
local nextcluster
for j = i+1, #glyphs do
nextcluster = glyphs[j].cluster
@@ -399,31 +397,29 @@ function shape(head, firstnode, run)
glyph.nglyphs = #glyphs + 1 - i
::NEXTCLUSTERFOUND:: -- end
glyph.nextcluster = nextcluster
+ local disc, discindex
do
+ local hex = ""
+ local str = ""
local node = node
- for j = cluster,nextcluster-1 do
- local id = getid(node)
- if id == glyph_t or (id == glue_t and getsubtype(node) == spaceskip_t) then
- local code = codes[j + 1]
- hex = hex..to_utf16_hex(code)
- str = str..utf8.char(code)
+ for j = cluster+1,nextcluster do
+ local char, id = is_char(node, fontid)
+ if char then
+ -- assert(char == codes[j])
+ hex = hex .. to_utf16_hex(char)
+ str = str .. utf8.char(char)
+ elseif not discindex and id == disc_t then
+ local props = properties[disc]
+ if not (props and props.zwnj) then
+ disc, discindex = node, j
+ end
end
+ node = getnext(node)
end
glyph.tounicode = hex
glyph.string = str
end
- if not fordisc then
- local discindex = nil
- local disc = node
- for j = cluster + 1, nextcluster do
- local props = properties[disc]
- if (not (props and props.zwnj)) and getid(disc) == disc_t then
- discindex = j
- break
- end
- disc = getnext(disc)
- end
- if discindex then
+ if not fordisc and discindex then
-- Discretionary found.
local startindex, stopindex = nil, nil
local startglyph, stopglyph = nil, nil
@@ -551,7 +547,6 @@ function shape(head, firstnode, run)
node = disc
cluster = glyph.cluster
nodeindex = cluster + 1
- end
end
end
end
More information about the latex3-commits
mailing list.