From be40844cfd078c8ec6b7ace73185a318e6d47840 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 6 Oct 2010 15:53:25 +0200 Subject: Fix GPOS mark placement for LTR text Fix by Hans. fixes #18 --- otfl-node-inj.lua | 18 ++++++++++++------ tests/marks.tex | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 tests/marks.tex diff --git a/otfl-node-inj.lua b/otfl-node-inj.lua index 5b55c8c..fdea7f1 100644 --- a/otfl-node-inj.lua +++ b/otfl-node-inj.lua @@ -115,7 +115,7 @@ function nodes.set_mark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, m set_attribute(base,markbase,bound) set_attribute(start,markmark,bound) set_attribute(start,markdone,index) - marks[bound] = { [index] = { dx, dy } } + marks[bound] = { [index] = { dx, dy, rlmode } } return dx, dy, bound end @@ -314,17 +314,23 @@ function nodes.inject_kerns(head,where,keep) local index = has_attribute(n,markdone) or 1 local d = mrks[index] if d then - -- local rlmode = d[3] -- not used - -- if rlmode and rlmode > 0 then - -- todo - -- else + local rlmode = d[3] + if rlmode and rlmode > 0 then + -- new per 2010-10-06 + local k = wx[p] + if k then -- maybe (d[1] - p.width) and/or + k[2] + n.xoffset = p.xoffset - (p.width - d[1]) - k[2] + else + n.xoffset = p.xoffset - (p.width - d[1]) + end + else local k = wx[p] if k then n.xoffset = p.xoffset - d[1] - k[2] else n.xoffset = p.xoffset - d[1] end - -- end + end if mk[p] then n.yoffset = p.yoffset + d[2] else diff --git a/tests/marks.tex b/tests/marks.tex new file mode 100644 index 0000000..9e7755e --- /dev/null +++ b/tests/marks.tex @@ -0,0 +1,4 @@ +\input luaotfload.sty +\font\test={file:GenBasR.ttf:script=latn} +\test ä\quad Ä +\bye -- cgit v1.2.3