From 0f30cb5dadd870fbc2d4633417ecd48933715760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Fri, 6 Dec 2019 21:49:34 +0100 Subject: [PATCH] Use fontmode instead of textmode in layered glyphs Fixes #124 for harf mode. --- src/luaotfload-harf-plug.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua index 6848de14..adbf884d 100644 --- a/src/luaotfload-harf-plug.lua +++ b/src/luaotfload-harf-plug.lua @@ -565,8 +565,17 @@ end local push_cmd = { "push" } local pop_cmd = { "pop" } local nop_cmd = { "nop" } -local save_cmd = { "pdf", "page", "q" } -local restore_cmd = { "pdf", "page", "Q" } +--[[ + In the following, "text" actually refers to "font" mode and not to "text" + mode. "font" mode is called "text" inside of virtual font commands (don't + ask me why, but the LuaTeX source does make it clear that this is intentional) + and behaves mostly like "page" (especially it does not enter a "BT" "ET" + block) except that it always resets the current position to the origin. + This is necessary to ensure that the q/Q pair does not interfere with TeX's + position tracking. + ]] +local save_cmd = { "pdf", "text", "q" } +local restore_cmd = { "pdf", "text", "Q" } -- Convert glyphs to nodes and collect font characters. local function tonodes(head, node, run, glyphs)