[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Secret features (635e482)
Marcel Fabian Krüger
tex at 2krueger.de
Sun Feb 23 00:42:03 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/635e4825ecdc1d4f9b0706724fb14777dec8c740
>---------------------------------------------------------------
commit 635e4825ecdc1d4f9b0706724fb14777dec8c740
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sun Feb 23 00:42:03 2020 +0100
Secret features
>---------------------------------------------------------------
635e4825ecdc1d4f9b0706724fb14777dec8c740
src/luaotfload-harf-plug.lua | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index adf096c..cd79986 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -105,6 +105,8 @@ local fl_unsafe = hb.Buffer.GLYPH_FLAG_UNSAFE_TO_BREAK
local startactual_p = "luaotfload_startactualtext"
local endactual_p = "luaotfload_endactualtext"
+local empty_table = {}
+
-- "Copy" properties as done by LuaTeX: Make old properties metatable
local function copytable(old)
local new = {}
@@ -333,6 +335,41 @@ function shape(head, node, run)
local vscale = hbdata.vscale
hbfont:set_scale(hscale, vscale)
+ do
+ features = table.merged(features) -- We don't want to modify the global features
+ local current_features = {}
+ local n = node
+ for i = offset-1, offset+len-2 do
+ local props = properties[n] or empty_table
+ if props then
+ local local_feat = props.glyph_features or empty_table
+ if local_feat then
+ for tag, value in next, current_features do
+ local loc = local_feat[tag]
+ loc = loc ~= nil and (tonumber(loc) or (loc and 1 or 0)) or nil
+ if value.value ~= loc then -- This includes loc == nil
+ value._end = i
+ features[#features + 1] = value
+ current_features[tag] = nil
+ end
+ end
+ for tag, value in next, local_feat do
+ if not current_features[tag] then
+ local feat = hb.Feature.new(tag)
+ feat.value = tonumber(value) or (value and 1 or 0)
+ feat.start = i
+ current_features[tag] = feat
+ end
+ end
+ end
+ end
+ n = getnext(n)
+ end
+ for _, feat in next, current_features do
+ features[#features + 1] = feat
+ end
+ end
+
if hb.shape_full(hbfont, buf, features, shapers) then
-- The engine wants the glyphs in logical order, but HarfBuzz outputs them
-- in visual order, so we reverse RTL buffers.
More information about the latex3-commits
mailing list.