[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Add expansion font feature (4907e23)

Marcel Fabian Krüger tex at 2krueger.de
Sun Jun 7 18:35:16 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/4907e23407c52437cca56966d11d3b4548bba585

>---------------------------------------------------------------

commit 4907e23407c52437cca56966d11d3b4548bba585
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Jun 7 18:35:16 2020 +0200

    Add expansion font feature


>---------------------------------------------------------------

4907e23407c52437cca56966d11d3b4548bba585
 src/luaotfload-features.lua | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua
index 59fe42d..822248f 100644
--- a/src/luaotfload-features.lua
+++ b/src/luaotfload-features.lua
@@ -602,6 +602,29 @@ do
     }
 end
 
+do
+    local number = lpeg.R'09'^1/tonumber
+    local patt = number * ' ' * number * ' ' * number * -1
+    local function setexpansion(tfmdata, _, value)
+        local stretch, shrink, step = patt:match(value)
+        if not stretch then
+            report("term and log", 0, "features",
+                "Invalid expansion parameter provided")
+            return
+        end
+        tfmdata.stretch, tfmdata.shrink, tfmdata.step = stretch, shrink, step
+    end
+    fonts.constructors.features.otf.register {
+        name = 'expansion',
+        description = 'Set expansion parameters',
+        manipulators = {
+            base = setexpansion,
+            node = setexpansion,
+            plug = setexpansion,
+        },
+    }
+end
+
 return function ()
     if not fonts and fonts.handlers then
         report ("log", 0, "features",





More information about the latex3-commits mailing list.