[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Move harf features into features (d560ccd)

Marcel Fabian Krüger tex at 2krueger.de
Sun Feb 23 01:38:15 CET 2020


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

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

commit d560ccd46b40ed6acfbea1cebbe3405936619581
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Feb 23 01:34:08 2020 +0100

    Move harf features into features


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

d560ccd46b40ed6acfbea1cebbe3405936619581
 src/luaotfload-harf-define.lua | 20 ++-------------
 src/luaotfload-szss.lua        | 57 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/src/luaotfload-harf-define.lua b/src/luaotfload-harf-define.lua
index 077071e..9acf51a 100644
--- a/src/luaotfload-harf-define.lua
+++ b/src/luaotfload-harf-define.lua
@@ -285,20 +285,6 @@ local function scalefont(data, spec)
     slantfactor = tonumber(features.slant) * 1000
   end
 
-  local hscale = upem
-  local extendfactor = nil
-  if features.extend then
-    extendfactor = tonumber(features.extend) * 1000
-    hscale = hscale * tonumber(features.extend)
-  end
-
-  local vscale = upem
-  local squeezefactor = nil
-  if features.squeeze then
-    squeezefactor = tonumber(features.squeeze) * 1000
-    vscale = vscale * tonumber(features.squeeze)
-  end
-
   if features.tlig then
     for char in next, characters do
       local ligatures = tlig[char]
@@ -322,8 +308,6 @@ local function scalefont(data, spec)
     tounicode = 1,
     nomath = true,
     format = data.fonttype,
-    slant = slantfactor,
-    extend = extendfactor,
     squeeze = squeezefactor,
     characters = characters,
     parameters = {
@@ -340,8 +324,8 @@ local function scalefont(data, spec)
       scale = scale,
       palette = palette,
       shared = data,
-      hscale = hscale,
-      vscale = vscale,
+      hscale = upem,
+      vscale = upem,
     },
     specification = spec,
     shared = {},
diff --git a/src/luaotfload-szss.lua b/src/luaotfload-szss.lua
index f9956e1..9546822 100644
--- a/src/luaotfload-szss.lua
+++ b/src/luaotfload-szss.lua
@@ -80,4 +80,61 @@ otfregister {
   },
 }
 
+-- harf-only features (for node they are implemented in the fontloader
+
+otfregister {
+  name = 'slant',
+  description = 'Fake slant',
+  default = false,
+  manipulators = {
+    plug = function(tfmdata, _, value, ...)
+      value = tonumber(value)
+      if not value then
+        error[[Invalid slant value]]
+      end
+      tfmdata.slant = value * 1000
+    end,
+  },
+}
+
+otfregister {
+  name = 'extend',
+  description = 'Fake bold',
+  default = false,
+  manipulators = {
+    plug = function(tfmdata, _, value)
+      value = tonumber(value)
+      if not value then
+        error[[Invalid extend value]]
+      end
+      tfmdata.extend = value * 1000
+      tfmdata.hb.hscale = tfmdata.units_per_em * value
+    end,
+  },
+}
+
+otfregister {
+  name = 'squeeze',
+  description = 'Fake squeeze',
+  default = false,
+  manipulators = {
+    plug = function(tfmdata, _, value)
+      value = tonumber(value)
+      if not value then
+        error[[Invalid squeeze value]]
+      end
+      tfmdata.squeeze = value * 1000
+      tfmdata.hb.vscale = tfmdata.units_per_em * value
+    end,
+  },
+}
+  -- if features.tlig then
+  --   for char in next, characters do
+  --     local ligatures = tlig[char]
+  --     if ligatures then
+  --       characters[char].ligatures = ligatures
+  --     end
+  --   end
+  -- end
+
 --- vim:sw=2:ts=2:expandtab:tw=71





More information about the latex3-commits mailing list.