[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix variable TTF font in harf mode with component glyphs w/o variable data (e30babc)

Marcel Fabian Krüger tex at 2krueger.de
Thu Jun 2 00:23:31 CEST 2022


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

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

commit e30babc0171ed8cc8550238e2c2ac92c953aa623
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Thu Jun 2 00:23:31 2022 +0200

    Fix variable TTF font in harf mode with component glyphs w/o variable data


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

e30babc0171ed8cc8550238e2c2ac92c953aa623
 src/luaotfload-harf-var-ttf.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/luaotfload-harf-var-ttf.lua b/src/luaotfload-harf-var-ttf.lua
index 6e19083..2adeac1 100644
--- a/src/luaotfload-harf-var-ttf.lua
+++ b/src/luaotfload-harf-var-ttf.lua
@@ -398,7 +398,13 @@ local function interpolate_glyf(loca, gvar_index, gvar, glyf, gid, coords, map)
   if not var then
     local start = loca[gid+1] + 1
     local stop = loca[gid+2]
-    return glyf:sub(start, stop)
+    -- If the glyph uses components then we can never just copy it but have to parse
+    -- it to rewrite the components if necessary.
+    if stop >= start + 2 and sio.readinteger2(glyf, start) < 0 then
+      return serialize_glyf(parse_glyf(loca, glyf, gid), map)
+    else
+      return glyf:sub(start, stop)
+    end
   end
   local points = parse_glyf(loca, glyf, gid)
   if not points then return '' end





More information about the latex3-commits mailing list.