[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Allow id: lookups for reloading fonts with adaptions (4b53eb9)

Marcel Fabian Krüger tex at 2krueger.de
Sun May 29 15:55:09 CEST 2022


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/4b53eb97fcc934f94c1eb64cee5872d36e5b1a48

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

commit 4b53eb97fcc934f94c1eb64cee5872d36e5b1a48
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun May 29 15:55:09 2022 +0200

    Allow id: lookups for reloading fonts with adaptions


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

4b53eb97fcc934f94c1eb64cee5872d36e5b1a48
 src/luaotfload-features.lua | 19 +++++++++++++++++++
 src/luaotfload-parsers.lua  |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua
index 4e47d2a..0b1aba6 100644
--- a/src/luaotfload-features.lua
+++ b/src/luaotfload-features.lua
@@ -408,6 +408,25 @@ local function analyze(spec_string, size)
         features = features,
     }
 
+    if lookup == 'id' then
+        local original_font = fontidentifiers [request.id]
+        if not original_font then return end
+        local original_spec = original_font.specification
+        if not original_spec then return end
+        if size < 0 then
+            specification.size = original_spec.size * size // -1000
+        end
+        specification.lookup = original_spec.lookup
+        specification.name = original_spec.name
+        specification.sub = specification.sub or original_spec.sub
+        specification.style = original_spec.style
+        specification.optsize = original_spec.optsize
+        specification.forced = original_spec.forced
+        if original_spec.features then
+            features.raw = table.merged(original_spec.features.raw, features.raw)
+        end
+    end
+
     local processed_features = apply_default_features(features.raw)
 
     if request.modifiers then
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua
index e02d517..807c0d5 100644
--- a/src/luaotfload-parsers.lua
+++ b/src/luaotfload-parsers.lua
@@ -593,6 +593,8 @@ local combo             = Cg(P"combo", "lookup") * colon * ws
 --- we’ll emit a warning.
 local prefixed          = Cg(P"name" + "file" + "kpse" + "my", "lookup")
                           * colon * ws * Cg(fontname, "name")
+                        + Cg(P"id", "lookup")
+                          * colon * ws * Cg(R'09'^1 / tonumber, "id")
 local unprefixed        = Cg(Cc"anon", "lookup") * Cg(fontname, "name")
 --- Bracketed “path” lookups: These may contain any character except
 --- for unbalanced brackets. A backslash escapes any following





More information about the latex3-commits mailing list.