[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Normalize harf letterspacing and drop unused function (1ab6c12)
Marcel Fabian Krüger
tex at 2krueger.de
Tue Feb 11 11:18:09 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/1ab6c1206270c99112c5510bbdd23fa1191a47c8
>---------------------------------------------------------------
commit 1ab6c1206270c99112c5510bbdd23fa1191a47c8
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Mon Feb 10 15:46:02 2020 +0100
Normalize harf letterspacing and drop unused function
>---------------------------------------------------------------
1ab6c1206270c99112c5510bbdd23fa1191a47c8
src/luaotfload-harf-define.lua | 9 ---------
src/luaotfload-harf-plug.lua | 5 ++---
src/luaotfload-letterspace.lua | 14 ++------------
3 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/src/luaotfload-harf-define.lua b/src/luaotfload-harf-define.lua
index 6b10655..6a19ffc 100644
--- a/src/luaotfload-harf-define.lua
+++ b/src/luaotfload-harf-define.lua
@@ -280,14 +280,6 @@ local function scalefont(data, spec)
end
end
- local letterspace = 0
- if features.letterspace then
- letterspace = tonumber(features.letterspace) / 100 * upem
- elseif features.kernfactor then
- letterspace = tonumber(features.kernfactor) * upem
- end
- space = space + letterspace
-
local slantfactor = nil
if features.slant then
slantfactor = tonumber(features.slant) * 1000
@@ -349,7 +341,6 @@ local function scalefont(data, spec)
spec = spec,
palette = palette,
shared = data,
- letterspace = letterspace,
hscale = hscale,
vscale = vscale,
},
diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index 81fd8bf..c538309 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -596,7 +596,6 @@ local function tonodes(head, node, run, glyphs)
local lastprops
local scale = hbdata.scale
- local letterspace = hbdata.letterspace
local haspng = hbshared.haspng
local fonttype = hbshared.fonttype
@@ -795,7 +794,7 @@ local function tonodes(head, node, run, glyphs)
if glyph.endactual then
setprop(node, endactual_p, true)
end
- local x_advance = glyph.x_advance + letterspace
+ local x_advance = glyph.x_advance
local width = fontglyph.width
if width ~= x_advance then
-- The engine always uses the glyph width from the font, so we need
@@ -810,7 +809,7 @@ local function tonodes(head, node, run, glyphs)
-- it from the default, so reset the glue using the new advance.
-- We are intentionally not comparing with the existing glue width as
-- spacing after the period is larger by default in TeX.
- local width = (glyph.x_advance + letterspace) * scale
+ local width = glyph.x_advance * scale
if fontdata.parameters.space ~= width then
setwidth(node, width)
setfield(node, "stretch", width / 2)
diff --git a/src/luaotfload-letterspace.lua b/src/luaotfload-letterspace.lua
index e7e5578..c8e79a9 100644
--- a/src/luaotfload-letterspace.lua
+++ b/src/luaotfload-letterspace.lua
@@ -461,18 +461,6 @@ local add_processor = function (processor, name, ...)
return true
end
---- string -> bool
-local remove_processor = function (name)
- local callbacks = registered_as[name]
- if callbacks then
- for i=1, #callbacks do
- luatexbase.remove_from_callback(callbacks[i], name)
- end
- return true
- end
- return false --> unregistered
-end
-
--- When font kerning is requested, usually by defining a font with the
--- ``letterspace`` parameter, we inject a wrapper for the
--- ``kerncharacters()`` node processor in the relevant callbacks. This
@@ -548,6 +536,7 @@ otffeatures.register {
initializers = {
base = initializefontkerning,
node = initializefontkerning,
+ plug = initializefontkerning,
}
}
@@ -580,6 +569,7 @@ otffeatures.register {
initializers = {
base = initializecompatfontkerning,
node = initializecompatfontkerning,
+ plug = initializecompatfontkerning,
}
}
More information about the latex3-commits
mailing list.